ERP渠道文档详细和修改(二十五)
前端代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelDocumentDetail.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelDocument.ChannelDocumentDetail" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CustomerName.js" type="text/javascript"></script>
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script> <script type="text/javascript">
$(document).ready(function () {
$("#form1").validate();
}); </script>
<style type="text/css">
.style1
{
height: 20px;
}
.style2
{
height: 22px;
}
.style3
{
height: 17px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="maintable">
<tr>
<td colspan="2" class="titlebar"><span>渠道文档详细信息</span></td>
</tr>
<tr>
<td class="style1">主题</td><td class="style1"><asp:Label ID="txtsubJect" runat="server"></asp:Label></td>
</tr>
<tr>
<td class="style1">文件名</td><td class="style1">
<asp:Label ID="lbName" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件扩展名</td><td class="style1">
<asp:Label ID="lbExtendName" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件类型</td><td class="style1">
<asp:Label ID="lbType" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件大小</td><td class="style1">
<asp:Label ID="lbSize" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">上传时间</td><td class="style1">
<asp:Label ID="lbUpdateTime" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td class="style1">上传用户</td><td class="style1"> <asp:Label ID="txtUserName" runat="server"></asp:Label> </td>
</tr>
<tr>
<td>
文档等级</td>
<td>
<asp:Label ID="ddlLevel" runat="server"></asp:Label> </td>
</tr>
<tr>
<td class="style2">
文档下载</td>
<td class="style2">
<asp:LinkButton ID="lbtndown" runat="server" onclick="lbtndown_Click">下载此文档</asp:LinkButton>
</td>
</tr>
<tr>
<td>
所属渠道
</td>
<td >
<asp:Label ID="txtCHannelID" runat="server"></asp:Label> </td>
</tr>
<tr>
<td class="style3">
说明</td>
<td class="style3" >
<asp:Label ID="txtRemark" runat="server" ></asp:Label>
</td>
</tr>
<tr>
<td>
是否删除</td>
<td >
<asp:Label ID="lbIsDelete" runat="server" ></asp:Label> </td>
</tr>
<tr>
<td colspan="2" class="bottomtd"> <asp:HiddenField ID="hf_CustomerDocumentID" runat="server" /> <asp:Button ID="btnReturn" runat="server" UseSubmitBehavior="false" Text="返回列表" onclick="btnReturn_Click"
/>
<asp:Button ID="btnSubmit" runat="server" Text="文档编辑"
onclick="btnSubmit_Click" />
</td>
</tr> </table>
<br />
</div>
</form>
</body>
</html>
后端代码:
public partial class ChannelDocumentDetail : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{
Session["Userid"] = "29"; if (!IsPostBack)
{
pageinfobind();
}
} static byte[] filecontent = null; /// <summary>
/// 页面信息绑定
/// </summary>
protected void pageinfobind()
{
if (Request.QueryString["ID"] == null)
{
Response.Redirect("ChannelDocumentListShow.aspx");
return;
} string id = Request.QueryString["ID"].ToString();
ViewCRMChannelDocumentInfo documentinfo = new ViewCRMChannelDocumentInfo(); ChannelDocumentBLL db = new ChannelDocumentBLL();
documentinfo= db.getChannelDocumentViewByDocumentID(id);
txtsubJect.Text = documentinfo.Subject;
txtRemark.Text = documentinfo.Remark;
txtUserName.Text = documentinfo.UserName;
this.txtCHannelID.Text = documentinfo.ChannelName;
this.lbName.Text = documentinfo.Name;
this.lbExtendName.Text = documentinfo.ExetendName;
this.lbType.Text = documentinfo.Type;
this.lbSize.Text = documentinfo.DocumentSize.ToString();
this.lbUpdateTime.Text = documentinfo.UploadTime.ToString();
this.ddlLevel.Text = documentinfo.DocumentLevel.ToString();
this.lbIsDelete.Text = documentinfo.DeleteState == true ? "已删除" : "未删除"; filecontent = Comm.GetDownDocumet("dbo.BioCrmCorrelationDocument", "Content", "DocumentID=" + documentinfo.DocumentID); //文档属于当前用户或者当前用户是市场部经理角色则显示编辑按钮
if (documentinfo.UserID == int.Parse(Session["Userid"].ToString()) || Web.UserLogin.user.RoleId == 6)
{
this.btnSubmit.Visible = true;
}
else
{
this.btnSubmit.Visible = false;
}
} /// <summary>
/// 保存编辑内容
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSubmit_Click(object sender, EventArgs e)
{
Response.Redirect("ChannelDocumentEditAndDown.aspx?ID=" + Request.QueryString["ID"].ToString());
} protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("ChannelDocumentListShow.aspx");
}
protected void lbtndown_Click(object sender, EventArgs e)
{
//创建弹出式Windows下载窗体
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.lbName.Text));
//把二进制数组写入Http输出流
Response.BinaryWrite(filecontent);
//想当前客户端缓冲区输出
Response.Flush();
//停止执行
Response.End(); }
}
编辑的前端:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelDocumentEditAndDown.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelDocument.ChannelDocumentEditAndDown" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/ChannelChoose.js" type="text/javascript"></script>
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script> <script type="text/javascript">
$().ready(function () {
$("#form1").validate();
}); </script>
<style type="text/css">
.style1
{
height: 20px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="maintable">
<tr>
<td colspan="2" class="titlebar"><span>渠道文档信息编辑/下载</span></td>
</tr>
<tr>
<td class="style1">主题</td><td class="style1"><asp:TextBox ID="txtsubJect" runat="server" CssClass="required"></asp:TextBox></td>
</tr>
<tr>
<td class="style1">文件名</td><td class="style1">
<asp:Label ID="lbName" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件扩展名</td><td class="style1">
<asp:Label ID="lbExtendName" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件类型</td><td class="style1">
<asp:Label ID="lbType" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">文件大小</td><td class="style1">
<asp:Label ID="lbSize" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style1">上传时间</td><td class="style1">
<asp:Label ID="lbUpdateTime" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td class="style1">上传用户</td><td class="style1"> <asp:TextBox ID="txtUserName" runat="server" CssClass="{required:true,number:true, min:1}"></asp:TextBox><input type="button" value="选择" style=" width:100px;" onclick="showDialog2()" />
(原来用户:)<asp:Label
ID="lbUser" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
文档等级</td>
<td>
<asp:DropDownList ID="ddlLevel" runat="server">
<asp:ListItem Selected="True">一般文件</asp:ListItem>
<asp:ListItem>重要文件</asp:ListItem>
<asp:ListItem>非常重要文件</asp:ListItem>
<asp:ListItem>特别重要</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
文档选择</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
</tr>
<tr>
<td>
所属渠道
</td>
<td >
<asp:TextBox ID="txtSuperChannelID" CssClass="{required:true,number:true, min:1}" runat="server"></asp:TextBox><input type="button" value="选择" style=" width:100px;" onclick="showChannel()" />(原来渠道:)<asp:Label
ID="lbCHannel" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
说明</td>
<td >
<asp:TextBox ID="txtRemark" TextMode="MultiLine" Rows="5" runat="server"
Width="380px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
是否删除</td>
<td >
<asp:CheckBox ID="cbDelete" runat="server" />
</td>
</tr>
<tr>
<td colspan="2" class="bottomtd"> <asp:HiddenField ID="hf_channeldocumentid" runat="server" /> <asp:Button ID="btnSubmit" runat="server" Text="文档编辑保存"
onclick="btnSubmit_Click" /> <asp:Button ID="btnReturn" runat="server" UseSubmitBehavior="false" Text="返回列表" onclick="btnReturn_Click"
/>
</td>
</tr>
</table>
<br />
</div>
</form>
</body>
</html>
后台代码:
public partial class ChannelDocumentEditAndDown : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{
Session["Userid"] = "29"; if (!IsPostBack)
{
pageinfobind();
}
} static byte[] filecontent = null;
/// <summary>
/// 页面信息绑定
/// </summary>
protected void pageinfobind()
{
if (Request.QueryString["ID"] == null)
{
Response.Redirect("ChannelDocumentListShow.aspx");
return;
} string id = Request.QueryString["ID"].ToString();
ViewCRMChannelDocumentInfo documentinfo = new ViewCRMChannelDocumentInfo(); ChannelDocumentBLL db = new ChannelDocumentBLL();
documentinfo = db.getChannelDocumentViewByDocumentID(id);
txtsubJect.Text = documentinfo.Subject;
txtRemark.Text = documentinfo.Remark;
txtUserName.Text = documentinfo.UserID.ToString();
this.txtSuperChannelID.Text = documentinfo.ChannelID.ToString();
this.lbName.Text = documentinfo.Name;
this.lbExtendName.Text = documentinfo.ExetendName;
this.lbType.Text = documentinfo.Type;
this.lbSize.Text = documentinfo.DocumentSize.ToString();
this.lbUpdateTime.Text = documentinfo.UploadTime.ToString();
this.ddlLevel.Text = documentinfo.DocumentLevel.ToString();
this.cbDelete.Checked = documentinfo.DeleteState;
this.lbUser.Text = "姓名:" + documentinfo.UserName + "编号:" + documentinfo.UserID;
this.lbCHannel.Text = "名称:" + documentinfo.ChannelName;
this.hf_channeldocumentid.Value = documentinfo.ChannelDocumentID.ToString(); filecontent = Comm.GetDownDocumet("dbo.BioCrmCorrelationDocument", "Content", "DocumentID=" + documentinfo.DocumentID);
} /// <summary>
/// 保存编辑内容
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSubmit_Click(object sender, EventArgs e)
{
BioCrmCorrelationDocument document = new BioCrmCorrelationDocument();
document.DocumentID = int.Parse(Request.QueryString["ID"].ToString());
document.Subject = this.txtsubJect.Text; document.UserID = int.Parse(Session["Userid"].ToString());
document.Remark = this.txtRemark.Text;
document.DocumentLevel = this.ddlLevel.SelectedValue; if (this.FileUpload1.HasFile)
{
document.Name = DateTime.Now.ToString("yyyyMMddhhmmss") + this.FileUpload1.FileName;
document.Content = this.FileUpload1.FileBytes;
document.Type = this.FileUpload1.PostedFile.ContentType;
document.UploadTime = DateTime.Now;
document.DocumentSize = this.FileUpload1.FileContent.Length;
document.ExetendName = System.IO.Path.GetExtension(this.FileUpload1.FileName);
}
else
{
document.Name = this.lbName.Text;
document.Content = filecontent;
document.Type = this.lbType.Text;
document.UploadTime = Convert.ToDateTime(lbUpdateTime.Text);
document.DocumentSize = long.Parse(this.lbSize.Text);
document.ExetendName = this.lbExtendName.Text;
} if (this.FileUpload1.HasFile)
{
//物理文件上传
string filepath = Server.MapPath(@"\Files\CRMChannelFiles\");
//如果存在文件则删除
if (Comm.FileExists(filepath + this.lbName.Text))
{
Comm.FileDelete(filepath + this.lbName.Text);
} Comm.FileUpLoad(this.FileUpload1, filepath, document.Name);
}
BioCrmCorrelationDocumentBLL documentbll = new BioCrmCorrelationDocumentBLL();
//文档信息添加 包括文件上传(转换为二进制数组后上传)
int count = documentbll.BioCrmCorrelationDocumentUpdate(document); //文档信息添加成功
if (count != 0)
{
BioErpCrmChannelDocument cd = new BioErpCrmChannelDocument();
cd.ChannelID = int.Parse(this.txtSuperChannelID.Text);
cd.DocumentID = int.Parse( Request.QueryString["ID"].ToString());
cd.DeleteState = cbDelete.Checked;
cd.ChannelDocumentID = int.Parse(this.hf_channeldocumentid.Value); ChannelDocumentBLL dbll = new ChannelDocumentBLL();
int count1 = dbll.BioErpCrmChannelDocumentUpdate(cd);
if (count1 == 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('文档信息修改失败')", true);
}
else
{
Response.Redirect("ChannelDocumentListShow.aspx");
}
}
} protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("ChannelDocumentListShow.aspx");
}
}
ERP渠道文档详细和修改(二十五)的更多相关文章
- ERP渠道文档管理(二十四)
基本需求: 用例图: 存储过程: CREATE PROCEDURE [dbo].[BioErpCrmChannelDocument_ADD] @DocumentID int, @ChannelID i ...
- 12.1 文档相关 Webbrowser 该文档已被修改,是否保存修改结果
附件:http://files.cnblogs.com/xe2011/Webbrowser_Document_IsModified.rar 该文档已被修改,是否保存修改结果?是:保存修改结果 ...
- PoiDocxDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0),目前只能java生成】
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 这个是<PoiDemo[Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)]>的扩展,上一篇是根 ...
- PoiDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)】
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 使用Poi实现android中根据模板文件生成Word文档的功能.这里的模板文件是doc文件.如果模板文件是docx文件的话,请阅读 ...
- 《手把手教你》系列技巧篇(二十五)-java+ selenium自动化测试-FluentWait(详细教程)
1.简介 其实今天介绍也讲解的也是一种等待的方法,有些童鞋或者小伙伴们会问宏哥,这也是一种等待方法,为什么不在上一篇文章中竹筒倒豆子一股脑的全部说完,反而又在这里单独写了一篇.那是因为这个比较重要,所 ...
- WCF技术剖析之二十五: 元数据(Metadata)架构体系全景展现[元数据描述篇]
原文:WCF技术剖析之二十五: 元数据(Metadata)架构体系全景展现[元数据描述篇] 在[WS标准篇]中我花了很大的篇幅介绍了WS-MEX以及与它相关的WS规范:WS-Policy.WS-Tra ...
- [转载]Windows Server 2008 R2 之二十五AD RMS信任策略
原文地址:Windows Server 2008 R2 之二十五AD RMS信任策略作者:从心开始 可以通过添加信任策略,让 AD RMS 可以处理由不同的 AD RMS 群集进行权限保护的内容的授权 ...
- JAVA基础再回首(二十五)——Lock锁的使用、死锁问题、多线程生产者和消费者、线程池、匿名内部类使用多线程、定时器、面试题
JAVA基础再回首(二十五)--Lock锁的使用.死锁问题.多线程生产者和消费者.线程池.匿名内部类使用多线程.定时器.面试题 版权声明:转载必须注明本文转自程序猿杜鹏程的博客:http://blog ...
- Java进阶(二十五)Java连接mysql数据库(底层实现)
Java进阶(二十五)Java连接mysql数据库(底层实现) 前言 很长时间没有系统的使用java做项目了.现在需要使用java完成一个实验,其中涉及到java连接数据库.让自己来写,记忆中已无从搜 ...
随机推荐
- 扩展名为DBF的是什么文件啊?
扩展名为DBF的文件: .dbf文件是dBase和FoxPro所使用的数据库格式,在没有这两种软件的情况下,可以使用Excel打开文件.在Excel的“打开”文件的对话框中,选择文件类型为“dBase ...
- apache 运行一段时间出现错误
环境是win2008,apache 2.4.29 Win64 VC15,php 7.1.10(7.1.11).事件完整内容: “-------------------------- 错误应用程序名称: ...
- Python学习--------------Atm+购物车系统
一.程序需求 模拟实现一个ATM + 购物商城程序: 1.额度 15000或自定义 2.实现购物商城,买东西加入 购物车,调用信用卡接口结账 3.可以提现,手续费5% 4.每月22号出账单,每月10号 ...
- jQuery源码之 empty与html('')的区别
empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nod ...
- string::replace
#include <string> #include <cctype> #include <algorithm> #include <iostream> ...
- linux driver error ------ 编译驱动出现 ERROR: Kernel configuration is invalid
ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/au ...
- 小朋友学Linux<一>基础篇
Linux最基础之<小朋友也能学会Linux>... 1.Linux 知识积累: Linux 英文解释为 Linux is not Unix.学习Linux必须要熟练使用的操作系统是Cen ...
- C语言复习---用筛选法求100之内的素数
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int i, j; ] ...
- Codeforces 923 D. Picking Strings
http://codeforces.com/contest/923/problem/D 题意: A-->BC , B-->AC , C-->AB , AAA-->empty 问 ...
- AngularJS 启程二
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> ...