博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ERP渠道文档详细和修改(二十五)
阅读量:5251 次
发布时间:2019-06-14

本文共 10618 字,大约阅读时间需要 35 分钟。

前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelDocumentDetail.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannelDocument.ChannelDocumentDetail"  %>        
渠道文档详细信息
主题
文件名
文件扩展名
文件类型
文件大小
上传时间
上传用户
 
文档等级
文档下载
下载此文档
所属渠道
 
说明
是否删除

 后端代码:

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;        ///         /// 页面信息绑定        ///         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;            }        }          ///         /// 保存编辑内容        ///         ///         ///         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"  %>        
渠道文档信息编辑/下载
主题
文件名
文件扩展名
文件类型
文件大小
上传时间
上传用户
(原来用户:)
文档等级
一般文件
重要文件
非常重要文件
特别重要
文档选择
所属渠道
(原来渠道:)
说明
是否删除

 后台代码:

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;        ///         /// 页面信息绑定        ///         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);        }          ///         /// 保存编辑内容        ///         ///         ///         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");        }    }

 

转载于:https://www.cnblogs.com/sunliyuan/p/7191799.html

你可能感兴趣的文章
Mac版OBS设置详解
查看>>
优雅地书写回调——Promise
查看>>
android主流开源库
查看>>
AX 2009 Grid控件下多选行
查看>>
PHP的配置
查看>>
Struts框架----进度1
查看>>
Round B APAC Test 2017
查看>>
MySQL 字符编码问题详细解释
查看>>
perl 学习笔记
查看>>
31 Days of Windows Phone
查看>>
poj 1184(聪明的打字员)
查看>>
Ubuntu下面安装eclipse for c++
查看>>
C#压缩或解压(rar和zip文件)
查看>>
让IE浏览器支持CSS3圆角属性的方法
查看>>
巡风源码阅读与分析---nascan.py
查看>>
LiveBinding应用 dataBind 数据绑定
查看>>
Linux重定向: > 和 &> 区别
查看>>
nginx修改内核参数
查看>>
【欧拉函数模板题】最大公约数
查看>>
C 筛选法找素数
查看>>