标签:alert header ges direct org 业务 sage inf 跳转
未审核表单列表显示:
1.用户登录后,根据登录用户加载审核流程表中属于当前登录用户的未审核表单。
2.点击选中未审核表单跳转到指定审核流程页面
if (Request.QueryString["taskid"] != null && Request.QueryString["listid"] != null) { contractid = Request.QueryString["taskid"].ToString(); tasklistid = Request.QueryString["listid"].ToString(); } else { Response.Write("<script>window.history(-1)</script>"); }
防止匿名登录:
登录后将基本信息保存至Session["Userid"],
如果每个页面加载时候判断Session["Userid"],如果为空则跳转至指定登录页面。
public BasePage() { this.Load += new EventHandler(BasePage_Load); } void BasePage_Load(object sender, EventArgs e) { Session["Userid"] = "29"; if (Session["Userid"] == null) { Response.Redirect("~/Web/UserLogin.aspx"); } }
用法:
public partial class CRMContractEidt:BasePage { protected void Page_Load(object sender, EventArgs e) { this.txtCreatTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); if (!IsPostBack) { pageinfo(); } } }
合同基础信息表:
/// <summary> /// 合同基础信息表 /// </summary> /// <param name="id">编号</param> /// <returns>ViewContactInfo</returns> public ViewContactInfo getViewContactInfoByContactID2(string contactid,string listid) { SqlDataReader reader = SqlComm.GetDataReaderByCondition("BioCRMContract", "*", " ContractID=" + contactid); ViewContactInfo contactinfo= new ViewContactInfo(); if (reader.Read()==true) { contactinfo.UserID = Convert.ToInt32(reader["UserID"].ToString()); contactinfo. AssessorAuditing = Convert.ToBoolean(reader["AssessorAuditing"].ToString()); contactinfo.ContractDesc = reader["ContractDesc"].ToString(); contactinfo.ContractID = Convert.ToInt32(reader["ContractID"].ToString()); contactinfo.ContractName = reader["ContractName"].ToString(); contactinfo.ContractNumber = reader["ContractNumber"].ToString(); contactinfo.ContractSum = Decimal.Parse(reader["ContractSum"].ToString()); contactinfo.ContractType = reader["ContractType"].ToString(); contactinfo.CreateTime = Convert.ToDateTime(reader["CreateTime"].ToString()); contactinfo.CustomerID = Convert.ToInt32(reader["CustomerID"].ToString()); contactinfo.DeleteState = Convert.ToBoolean(reader["DeleteState"].ToString()); contactinfo.EndTime = Convert.ToDateTime(reader["EndTime"].ToString()); contactinfo. EffectiveTime = Convert.ToDateTime(reader["EffectiveTime"].ToString()); contactinfo. ExecutiveState = reader["ExecutiveState"].ToString(); contactinfo.SignTime = Convert.ToDateTime(reader["SignTime"].ToString()); } reader.Close(); return contactinfo; }
显示的前端代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractShow.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractShow" %> <!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" /> <script src="../../JS/CheckUserName.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/validateExtender.js" type="text/javascript"></script> <script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script> <script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script> <script src="../../JS/CustomerName.js" type="text/javascript"></script> <link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" /> <script src="../../JS/CheckDepartMent.js" type="text/javascript"></script> <script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script> <link href="../../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function () { $("#form1").validate(); $("#txtCreatTime").datepicker({ dateFormat: ‘yy-mm-dd‘ }); $("#txtSinTime").datepicker({ dateFormat: ‘yy-mm-dd‘ }); $("#txtEffectiveTime").datepicker({ dateFormat: ‘yy-mm-dd‘ }); $("#txtEndTime").datepicker({ dateFormat: ‘yy-mm-dd‘ }) }); </script> <style type="text/css"> .style1 { width: 73px; } </style> </head> <body> <form id="form1" runat="server"> <div> <table class="maintable Inupttable" style=" width:900px;"> <tr> <td colspan="8" class="titlebar">合同审核</td> </tr> <tr> <td class="style1">合同名称</td><td class="style3"><asp:TextBox ID="txtName" CssClass="required" runat="server"></asp:TextBox></td> <td class="style4">下次审批人</td><td><asp:TextBox ID="txtUser1" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> <td class="style7">合同负责人</td><td class="style6"><asp:TextBox ID="txtUser2" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> <td>所属部门</td><td> <asp:TextBox ID="txtDepartMentID" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="style1">签约客户</td><td class="style3"><asp:TextBox ID="txtCustomer" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> <td class="style4">签约金额</td><td><asp:TextBox ID="txtSum" CssClass="{required:true,number:true}" runat="server"></asp:TextBox>元(RMB)</td> <td class="style7">合同创建时间</td><td class="style6"><asp:TextBox ID="txtCreatTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> <td>计划签约时间</td><td><asp:TextBox ID="txtSinTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> </tr> <tr> <td class="style1">生效时间</td><td class="style3" ><asp:TextBox ID="txtEffectiveTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> <td class="style4">截止</td><td colspan="5"><asp:TextBox ID="txtEndTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> </tr> <tr> <td class="style1">合同内容</td><td colspan="7"> <asp:TextBox ID="txtDesc" CssClass="required" runat="server" Height="300px" Width="100%" Rows="10" TextMode="MultiLine"></asp:TextBox></td> </tr> <tr> <td class="style1">合同附件</td><td colspan="5"> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Web/images/files.gif" Width="26px" Height="24px" onclick="ImageButton1_Click"/> (下载)</td> <td>合同类型</td><td> <asp:DropDownList ID="ddlType" runat="server"> <asp:ListItem>买卖合同</asp:ListItem> <asp:ListItem>运输合同</asp:ListItem> <asp:ListItem>技术合同</asp:ListItem> <asp:ListItem>保管合同</asp:ListItem> <asp:ListItem>仓储合同</asp:ListItem> <asp:ListItem>委托合同</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td class="style1">历史意见</td><td colspan="7"> <asp:Label ID="lbHistory" Width="99%" runat="server" Text=""></asp:Label> </td> </tr> <tr> <td class="style1">审批意见</td><td colspan="5"> <asp:TextBox ID="txtMind" Width="80%" runat="server"></asp:TextBox> </td> <td> <asp:Label ID="lbIsCheck" runat="server" Visible="false" Text="法律顾问意见"></asp:Label> </td><td> <asp:CheckBox ID="cbIsCheck" Text="符合法律效应" Visible="false" BorderStyle="None" runat="server" /></td> </tr> <tr> <td colspan="8" class="bottomtd"> <asp:Button ID="btnSubmit" runat="server" Text="返回列表" onclick="btnSubmit_Click" /> </td> </tr> </table> </div> </form> </body> </html>
后端的代码:
public partial class CRMContractShow : BasePage { protected void Page_Load(object sender, EventArgs e) { this.txtCreatTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); if (!IsPostBack) { pageinfo(); //遍历页面所有TextBox控件,设置为只读 TextBox txt = null; foreach (Control c in Page.Controls) { if (c.GetType().Name == "HtmlForm") { foreach (Control c1 in c.Controls) { if (c1.GetType().Name == "TextBox") { txt = ((TextBox)c1); txt.ReadOnly = true; } } } } } } static byte[] filecontent = null; static string contractid = ""; static string tasklistid = ""; static string documentsid = ""; /// <summary> /// 绑定页面信息 /// </summary> protected void pageinfo() { contractid ="8"; tasklistid ="7"; #region 从合同信息表中绑定数据 CrmContractBLL cbll = new CrmContractBLL(); ViewContactInfo contactinfo = new ViewContactInfo(); contactinfo = cbll.getViewContactInfoByContactID2(contractid, tasklistid); this.txtName.Text = contactinfo.ContractName; this.txtUser2.Text = contactinfo.UserID.ToString(); this.txtSinTime.Text = Convert.ToDateTime(contactinfo.SignTime.ToString()).ToString("yyyy-MM-dd"); this.txtCreatTime.Text = Convert.ToDateTime(contactinfo.CreateTime.ToString()).ToString("yyyy-MM-dd"); this.txtCustomer.Text = contactinfo.CustomerID.ToString(); this.txtSum.Text = Convert.ToDecimal(contactinfo.ContractSum.ToString()).ToString("0.00"); this.txtEffectiveTime.Text = Convert.ToDateTime(contactinfo.EffectiveTime).ToString("yyyy-MM-dd"); this.txtDesc.Text = contactinfo.ContractDesc; this.txtEndTime.Text = Convert.ToDateTime(contactinfo.EndTime).ToString("yyyy-MM-dd"); this.ddlType.SelectedItem.Text = contactinfo.ContractType.ToString(); this.cbIsCheck.Checked =bool.Parse(contactinfo.AssessorAuditing.ToString()); #endregion #region 从流程表中绑定数据 //1代表 合同管理表单 System.Data.DataTable dt = SqlComm.getTaskListRecordsByCondition(contractid, "1"); System.Data.DataRow[] dr0 = dt.Select(" listID=" + tasklistid); string historys = ""; for (int i = 1; i < dt.Rows.Count; i++) { historys+= dt.Rows[i]["Mind"].ToString() + " " + Convert.ToDateTime(dt.Rows[i]["SumitTime"].ToString()).ToString("yyyy-MM-dd")+"</br>"; } if (historys.Length == 0) { historys = "暂无审核意见"; } this.lbHistory.Text = historys; this.txtDepartMentID.Text = dr0[0].ItemArray[12].ToString(); this.txtUser1.Text = dr0[0].ItemArray[5].ToString(); #endregion filecontent = Comm.GetDownDocumet("BioCrmCorrelationDocument", "Content", " DocumentID=" + contactinfo.DocumentID); documentsid = contactinfo.DocumentID.ToString(); if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("45") || this.cbIsCheck.Checked==true) { this.lbIsCheck.Visible = true; this.cbIsCheck.Visible = true; } else { this.lbIsCheck.Visible = false; this.cbIsCheck.Visible = false; } } /// <summary> /// 下载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (filecontent == null) { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert(‘没有要下载的文档‘)", true); return; } //创建弹出式Windows下载窗体 Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.txtName.Text)); //把二进制数组写入Http输出流 Response.BinaryWrite(filecontent); //想当前客户端缓冲区输出 Response.Flush(); //停止执行 Response.End(); } }
合同审单执行:
业务逻辑代码:
//判断当前登录用户是否是被提交人 if (dr0[0].ItemArray[5].ToString() == Session["Userid"].ToString()) { //45法律资质审核权限 if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("45")) { this.lbIsCheck.Visible = true; this.cbIsCheck.Visible = true; this.btnRun.Visible = true; } else { this.lbIsCheck.Visible = false; this.cbIsCheck.Visible = false; this.btnRun.Visible = false; } } //如果当前登录用户是合同负责人(第一次提交合同申请的用户) if (dr0[0].ItemArray[10].ToString() == Session["Userid"].ToString()) { this.FileUpload1.Visible = true; }else { this.FileUpload1.Visible = false; }
/// <summary> /// 下载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (filecontent == null) { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert(‘没有要下载的文档‘)", true); return; } //创建弹出式Windows下载窗体 Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.txtName.Text)); //把二进制数组写入Http输出流 Response.BinaryWrite(filecontent); //想当前客户端缓冲区输出 Response.Flush(); //停止执行 Response.End(); } protected void btnRun_Click(object sender, EventArgs e) { CrmContractBLL conbll = new CrmContractBLL(); BioCRMContract contract = new BioCRMContract(); TaskListRecord tasklistRecord = null; BioCrmCorrelationDocument document = null; //获取合同相关信息 contract.ContractID = int.Parse(contractid); contract.UserID = int.Parse(this.txtUser2.Text); contract.ContractName = this.txtName.Text; contract.CustomerID = int.Parse(this.txtCustomer.Text); contract.ContractSum = decimal.Parse(this.txtSum.Text); contract.ContractType = this.ddlType.SelectedValue; contract.EndTime = Convert.ToDateTime(this.txtEndTime.Text); contract.EffectiveTime = Convert.ToDateTime(this.txtEffectiveTime.Text); contract.SignTime = Convert.ToDateTime(this.txtSinTime.Text); contract.ContractDesc = this.txtDesc.Text; contract.ExecutiveState = "待审核"; if (this.cbIsCheck.Visible == true) { contract.AssessorAuditing = cbIsCheck.Checked; } contract.CreateTime = Convert.ToDateTime(this.txtCreatTime.Text); int count = conbll.BioCRMContractaUpdate(contract); //文档基本信息 if (this.FileUpload1.HasFile) { document = new BioCrmCorrelationDocument() { DocumentID = int.Parse(documentsid.ToString()), Subject = this.txtName.Text, Content = this.FileUpload1.FileBytes, DocumentSize = this.FileUpload1.FileContent.Length, Type = this.FileUpload1.PostedFile.ContentType, ExetendName = System.IO.Path.GetExtension(this.FileUpload1.FileName), DocumentLevel = "绝密", Name = this.FileUpload1.FileName, Remark = "合同附件文档", UserID = int.Parse(this.txtUser2.Text), UploadTime = DateTime.Now }; BioCrmCorrelationDocumentBLL documentbll = new BioCrmCorrelationDocumentBLL(); documentbll.BioCrmCorrelationDocumentUpdate(document); } tasklistRecord = new TaskListRecord() { Accepter = int.Parse(this.txtUser2.Text), Transmitter = int.Parse(Session["Userid"].ToString()), AuditingSate =2, DepartMentId = int.Parse(this.txtDepartMentID.Text), FirstAccepter = int.Parse(this.hf_FirstAccepter.Value), FirstSumitTime = Convert.ToDateTime(this.hf_FirstDateTime.Value), FirstTransmitter = int.Parse(this.hf_FirstTransmitter.Value), Mind = this.txtMind.Text, Pass = 1, Subject = this.txtName.Text, SumitTime = DateTime.Now, TaskID = int.Parse(contractid), TaskTableID = 1 }; //向流程表添加一条新的记录 if (SqlComm.TaskListRecordAdd(tasklistRecord) != 0) { SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + tasklistid); ClientScript.RegisterStartupScript(this.GetType(), "test", "alert(‘合同申请提交成功,下次审批人员编号:" + this.txtUser1.Text + "‘)", true); } }
标签:alert header ges direct org 业务 sage inf 跳转
原文地址:http://www.cnblogs.com/sunliyuan/p/7236748.html