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连接数据库.让自己来写,记忆中已无从搜 ...
随机推荐
- browser-sync & http server
browser-sync & http server browser-sync https://www.browsersync.io/ usage # step 1 $ npm install ...
- Jenkins之自动构建
修改job的配置: Build periodically:不管版本是否修改,都会执行: Poll SCM:只有当版本有修改才会执行.
- 一本通1646GT 考试
1646:GT 考试 时间限制: 1000 ms 内存限制: 524288 KB [题目描述] 阿申准备报名参加 GT 考试,准考证号为 n 位数 X1X2⋯Xn(0≤Xi≤9),他不 ...
- 【刷题】LOJ 6008 「网络流 24 题」餐巾计划
题目描述 一个餐厅在相继的 \(n\) 天里,每天需用的餐巾数不尽相同.假设第 \(i\) 天需要 \(r_i\) 块餐巾.餐厅可以购买新的餐巾,每块餐巾的费用为 \(P\) 分:或者把旧餐巾送到快洗 ...
- 【题解】 bzoj1088: [SCOI2005]扫雷Mine (神奇的做法)
bzoj1088,懒得复制,戳我戳我 Solution: 其实这个有个结论,答案只会有\(0\),\(1\),\(2\)三种(我真的是个弱鸡,这个都想不到) 然后我们假设第一个就可以推出所有的状态(显 ...
- CRM 2013发邮件的插件报错Cannot open Sql Encryption Symmetric Key because Symmetric Key password does not exist in Config DB
解决方法: 1. 依次打开Settings->Data management –> Data Encryption 然后在上面红框里填上任意一个key即可.
- 【NOIP 2018】填数游戏(思考与推导)
题目链接 这道题讲道理还是不错的,因为你需要不断挖掘其中的性质来帮助解题.可惜数据范围开在这里让考试时的我很慌,勉强也就写了$65$分就没了.回忆在考场上,思路是没有错的,就是发掘不够深入,思路还不够 ...
- hdu5449 Robot Dog (树形dp+倍增lca)
(警告:本篇博客包含大量人类本质内容) 先处理出来lca,然后就只需要知道从每个点到他的父亲.和从他的父亲到这个点的期望时间就可以了 我们设f[x]为x到他父亲的期望时间:g[x]为从x的父亲到x的期 ...
- 使用Metasploit绕过UAC的多种方法
一.用户帐户控制(UAC)简介 在本文中,我们将简要介绍一下用户帐户控制,即UAC.我们还将研究它如何潜在地保护免受恶意软件的攻击并忽略UAC提示可能给系统带来的一些问题. 1.什么是用户帐户控制 ...
- java基础基础总结----- 随机数(产生四个随机数)
前言:在开发的时候经常会遇见,一些验证码登录,其实这些东西,很简单.我曾经开发过一个验证码登录的页面,那时用的插件.但是作为一个合格的开发者,要了解其内部的核心知识,有些东西,可以不深入了解,但是要做 ...