合同审核完成页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractOver.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractOver" %> <!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(); }); </script> <style type="text/css"> .style1 { 73px; } </style> </head> <body> <form id="form1" runat="server"> <div> <table class="maintable Inupttable" style=" 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="txtUser2" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> <td class="style7">所属部门</td><td class="style6"> <asp:TextBox ID="txtDepartMentID" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox> </td> <td>合同创建时间</td><td> <asp:TextBox ID="txtCreatTime" CssClass="{required:true,dateISO:true}" 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="txtSinTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> <td>生效时间</td><td><asp:TextBox ID="txtEffectiveTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> </tr> <tr> <td class="style1">截止时间</td><td class="style3" ><asp:TextBox ID="txtEndTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> <td class="style4"> </td><td colspan="5"> </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" Text="法律顾问意见"></asp:Label> </td><td> <asp:CheckBox ID="cbIsCheck" Text="符合法律效应" BorderStyle="None" runat="server" /></td> </tr> <tr> <td colspan="8" class="bottomtd"> <asp:Button ID="btnSubmit" runat="server" BackColor="#51C600" Text="结束流程" onclick="btnSubmit_Click" /> </td> </tr> <tr> <td colspan="8"> <asp:HiddenField ID="hf_FirstAccepter" runat="server" /> <asp:HiddenField ID="hf_FirstTransmitter" runat="server" /> <asp:HiddenField ID="hf_FirstDateTime" runat="server" /> <asp:HiddenField ID="hfFileName" runat="server" /> </td> </tr> </table> </div> </form> </body> </html>
是否符合法律效应:
if (this.cbIsCheck.Checked == false) { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('无法律资质审核不能执行')", true); return; }
结束流程的代码:
//如果不是合同负责人本人,则不能修改合同的相关信息,只能发表审批意见或则如果是法律顾问权限人员则可以修改法律审核备注 protected void btnSubmit_Click(object sender, EventArgs e) { TaskListRecord tasklistRecord =null; tasklistRecord = new TaskListRecord() { Accepter=int.Parse(this.txtUser2.Text), Transmitter = int.Parse(this.txtUser2.Text), AuditingSate = 3, 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('合同流程审核结束,可以签约')", true); } }
合同主体的跳转页面:(只用后台的代码)
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null || Request.QueryString["listid"] == null) { Response.Redirect("CRMContractListShow.aspx"); return; } string id = Request.QueryString["id"].ToString(); string listid = Request.QueryString["listid"].ToString(); System.Data.DataTable dt = CommTool.SqlComm.GetDataByCondition("dbo.TaskListRecord", "ListID,TaskID,TaskTableID,Accepter,AuditingSate", " ListID=" + listid).Tables[0]; if (dt.Rows.Count == 0) { Response.Redirect("CRMContractListShow.aspx"); return; } if (dt.Rows[0]["Accepter"].ToString() != Session["Userid"].ToString()) { Response.Redirect("") } if (dt.Rows[0]["Accepter"].ToString() != Session["Userid"].ToString()) { Response.Redirect("CRMContractShow.aspx?taskid=" + id + "&listid=" + listid); return; } else { if (dt.Rows[0]["AuditingSate"].ToString() == "0") { Response.Redirect("CRMContractEidt.aspx?taskid=" + id + "&listid=" + listid); return; } else if (dt.Rows[0]["AuditingSate"].ToString() == "2") { Response.Redirect("CRMContractOver.aspx?taskid=" + id + "&listid=" + listid); return; } else if (dt.Rows[0]["AuditingSate"].ToString() == "3") { Response.Redirect("CRMContractShow.aspx?taskid=" + id + "&listid=" + listid); return; } } }
执行一个sql语句
/// <summary> /// 执行一个Sql语句或相关的存储过程返回一个对象 /// </summary> /// <param name="tableName"></param> /// <param name="columns"></param> /// <param name="condition"></param> /// <returns></returns> public static Object GetObjectByCondition(string tableName, string columns, string condition) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@tableName",tableName), new SqlParameter("@columns",columns), new SqlParameter("@condition",condition) }; object obj = DataBaseHelper.SelectSQLReturnObject("GetDataByCondition", CommandType.StoredProcedure, pars); return obj; }
下载获取文件的后缀名:
Object o= SqlComm.GetObjectByCondition("BioCrmCorrelationDocument","Name"," DocumentID="+ contactinfo.DocumentID); if (o != null) { this.hfFileName.Value = o.ToString(); }
防止重复提交:
1.设计一个全局变量。点击后改变全局变量。
2.点击后设置按钮Enable属性。
bool issubmit = false; if (issubmit) { Response.Redirect("~/Web/Desk.aspx"); return; }
把下载的方法封装成通用的方法:
/// <summary> /// 根据文档编号下载文档内容 /// </summary> /// <param name="documentid"></param> public static void FileDownLoad(System.Web.UI.Page p, string documentid) { byte[] data = null; data= Comm.GetDownDocumet("BioCrmCorrelationDocument", "Content", " DocumentID=" + documentid); string filename = SqlComm.GetObjectByCondition("BioCrmCorrelationDocument", "Name", " DocumentID=" + documentid).ToString(); p.Response.ClearContent(); //创建弹出式Windows下载窗体 p.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename)); //把二进制数组写入Http输出流 p.Response.BinaryWrite(data); //想当前客户端缓冲区输出 p.Response.Flush(); //停止执行 p.Response.End(); }
通用方法的调用:
Comm.FileDownLoad(this, documentsid);