首页 > 代码库 > ERP合同管理(二十六)

ERP合同管理(二十六)

需要实现的基本业务:

技术分享

相关的用例图:

技术分享

相关业务的封装:

技术分享

相关的约定:

技术分享

合同信息添加业务流程:

技术分享

添加的存储过程

SET QUOTED_IDENTIFIER ONSET ANSI_NULLS ONGO--------------------------------------用途:增加一条记录 --项目名称:--说明:--时间:2011/11/11 22:07:38------------------------------------CREATE PROCEDURE [dbo].[BioCRMContract_ADD]@ContractID int output,@ContractName nvarchar(200),@CustomerID int,@CreateTime datetime,@ContractSum money,@SignTime datetime,@EffectiveTime datetime,@EndTime datetime,@ContractType nvarchar(100),@UserID int,@ExecutiveState nvarchar(50),@ContractDesc nvarchar(4000) AS 	INSERT INTO [BioCRMContract](	[ContractName],[CustomerID],[CreateTime],[ContractSum],[SignTime],[EffectiveTime],[EndTime],[ContractType],[UserID],[ExecutiveState],[ContractDesc]	)VALUES(	@ContractName,@CustomerID,@CreateTime,@ContractSum,@SignTime,@EffectiveTime,@EndTime,@ContractType,@UserID,@ExecutiveState,@ContractDesc	)	SET @ContractID = @@IDENTITY

 添加的业务:

  /// <summary>      /// 添加一条合同信息对象并返回当前合同编号      /// </summary>        /// <param name="mode">BioCRMContract</param>      /// <returns>int</returns>      public int BioCRMContractadd(BioCRMContract model)      {         SqlParameter[] parameters = {					new SqlParameter("@ContractID", SqlDbType.Int,4),					new SqlParameter("@ContractName", SqlDbType.NVarChar,200),					new SqlParameter("@ContractNumber", SqlDbType.NVarChar,100),					new SqlParameter("@CustomerID", SqlDbType.Int,4),					new SqlParameter("@CreateTime", SqlDbType.DateTime),					new SqlParameter("@ContractSum", SqlDbType.Money,8),					new SqlParameter("@SignTime", SqlDbType.DateTime),					new SqlParameter("@EffectiveTime", SqlDbType.DateTime),					new SqlParameter("@EndTime", SqlDbType.DateTime),					new SqlParameter("@ContractType", SqlDbType.NVarChar,100),					new SqlParameter("@UserID", SqlDbType.Int,4),					new SqlParameter("@ExecutiveState", SqlDbType.NVarChar,50),					new SqlParameter("@ContractDesc", SqlDbType.NVarChar,4000),					new SqlParameter("@AssessorID", SqlDbType.Int,4)					};          parameters[0].Direction = ParameterDirection.Output;          parameters[1].Value = http://www.mamicode.com/model.ContractName;"BioCRMContract_ADD", CommandType.StoredProcedure, parameters);         if (count != 0)         {             return int.Parse(parameters[0].Value.ToString());         }         else         {             return 0;         }      }

 修改的存储过程:

CREATE PROCEDURE [dbo].[BioCRMContract_Update]@ContractID int,@ContractName nvarchar(200),@CustomerID int,@CreateTime datetime,@ContractSum money,@SignTime datetime,@EffectiveTime datetime,@EndTime datetime,@ContractType nvarchar(100),@UserID int,@ExecutiveState nvarchar(50),@ContractDesc nvarchar(4000),@AssessorAuditing bit,@DeleteState bit AS 	UPDATE [BioCRMContract] SET 	[ContractName] = @ContractName,[CustomerID] = @CustomerID,[CreateTime] = @CreateTime,[ContractSum] = @ContractSum,[SignTime] = @SignTime,[EffectiveTime] = @EffectiveTime,[EndTime] = @EndTime,[ContractType] = @ContractType,[UserID] = @UserID,[ExecutiveState] = @ExecutiveState,[ContractDesc] = @ContractDesc,AssessorAuditing = @AssessorAuditing,[DeleteState] = @DeleteState	WHERE ContractID=@ContractID 

 业务逻辑的代码:

 /// <summary>      /// 修改一条合同信息对象      /// </summary>      /// <param name="mode">BioCRMContract</param>      /// <returns>int</returns>      public int BioCRMContractaUpdate(BioCRMContract model)      {          SqlParameter[] parameters = {					new SqlParameter("@ContractID", SqlDbType.Int,4),					new SqlParameter("@ContractName", SqlDbType.NVarChar,200),					new SqlParameter("@ContractNumber", SqlDbType.NVarChar,100),					new SqlParameter("@CustomerID", SqlDbType.Int,4),					new SqlParameter("@CreateTime", SqlDbType.DateTime),					new SqlParameter("@ContractSum", SqlDbType.Money,8),					new SqlParameter("@SignTime", SqlDbType.DateTime),					new SqlParameter("@EffectiveTime", SqlDbType.DateTime),					new SqlParameter("@EndTime", SqlDbType.DateTime),					new SqlParameter("@ContractType", SqlDbType.NVarChar,100),					new SqlParameter("@UserID", SqlDbType.Int,4),					new SqlParameter("@ExecutiveState", SqlDbType.NVarChar,50),					new SqlParameter("@ContractDesc", SqlDbType.NVarChar,4000),					new SqlParameter("@AssessorID", SqlDbType.Int,4),					new SqlParameter("@DeleteState", SqlDbType.Bit,1)};          parameters[0].Value =http://www.mamicode.com/model.ContractID;"BioCRMContract_Update", CommandType.StoredProcedure, parameters);          if (count != 0)          {              return int.Parse(parameters[0].Value.ToString());          }          else          {              return 0;          }      }

 合同对象添加的存储过程:

CREATE PROCEDURE [dbo].[BioErpCRMContractDocument_ADD]@DocumentID int,@ContractID int AS 	INSERT INTO [BioErpCRMContractDocument](	[DocumentID],[ContractID]	)VALUES(	@DocumentID,@ContractID	)

 添加的代码:

       /// <summary>      /// 合同文档对象添加      /// </summary>      /// <param name="document">CRMContractDocument</param>      /// <returns>int</returns>      public int CRMContractDocumentADD(CRMContractDocument document)      {          SqlParameter[] parameters = {										new SqlParameter("@DocumentID", SqlDbType.Int,4),					new SqlParameter("@ContractID", SqlDbType.Int,4)					};                 parameters[0].Value = http://www.mamicode.com/document.DocumentID;"BioErpCRMContractDocument_ADD", CommandType.StoredProcedure, parameters);      }

文档修改的记录:

CREATE PROCEDURE BioErpCRMContractDocument_Update@AccessoryID int,@DocumentID int,@ContractID int,@DeleteState bit AS 	UPDATE [BioErpCRMContractDocument] SET 	[DocumentID] = @DocumentID,[ContractID] = @ContractID,[DeleteState] = @DeleteState	WHERE AccessoryID=@AccessoryID 

 业务逻辑:

   /// <summary>      /// 合同文档对象修改      /// </summary>      /// <param name="document">CRMContractDocument</param>      /// <returns>int</returns>      public int CRMContractDocumentUpdate(CRMContractDocument model)      {          SqlParameter[] parameters = {					new SqlParameter("@AccessoryID", SqlDbType.Int,4),					new SqlParameter("@DocumentID", SqlDbType.Int,4),					new SqlParameter("@ContractID", SqlDbType.Int,4),					new SqlParameter("@DeleteState", SqlDbType.Bit,1)};          parameters[0].Value = http://www.mamicode.com/model.AccessoryID;"BioErpCRMContractDocument_Update", CommandType.StoredProcedure, parameters);      }

 任务流程表中添加的存储过程:

CREATE PROCEDURE TaskListRecord_ADD@Subject nvarchar(100),@TaskID int,@TaskTableID int,@Transmitter int,@Accepter int,@Pass int,@AuditingSate int,@Mind nvarchar(500),@FirstSumitTime datetime,@FirstTransmitter int,@FirstAccepter int,@DepartMentId int,@SumitTime datetime AS 	INSERT INTO [TaskListRecord](	[Subject],[TaskID],[TaskTableID],[Transmitter],[Accepter],[Pass],[AuditingSate],[Mind],[FirstSumitTime],[FirstTransmitter],[FirstAccepter],[DepartMentId],[SumitTime]	)VALUES(	@Subject,@TaskID,@TaskTableID,@Transmitter,@Accepter,@Pass,@AuditingSate,@Mind,@FirstSumitTime,@FirstTransmitter,@FirstAccepter,@DepartMentId,@SumitTime	)

 写在共用类中的业务:

 /// <summary>        /// 向任务流程表添加一条记录        /// </summary>        /// <param name="record">TaskListRecord</param>        /// <returns>int</returns>        public int TaskListRecordAdd(TaskListRecord model)        {            SqlParameter[] parameters = {					new SqlParameter("@Subject", SqlDbType.NVarChar,100),					new SqlParameter("@TaskID", SqlDbType.Int,4),					new SqlParameter("@TaskTableID", SqlDbType.Int,4),					new SqlParameter("@Transmitter", SqlDbType.Int,4),					new SqlParameter("@Accepter", SqlDbType.Int,4),					new SqlParameter("@Pass", SqlDbType.Int,4),					new SqlParameter("@AuditingSate", SqlDbType.Int,4),					new SqlParameter("@Mind", SqlDbType.NVarChar,500),					new SqlParameter("@FirstSumitTime", SqlDbType.DateTime),					new SqlParameter("@FirstTransmitter", SqlDbType.Int,4),					new SqlParameter("@FirstAccepter", SqlDbType.Int,4),					new SqlParameter("@DepartMentId", SqlDbType.Int,4),					new SqlParameter("@SumitTime", SqlDbType.DateTime)};                     parameters[0].Value = http://www.mamicode.com/model.Subject;"TaskListRecord_ADD", CommandType.StoredProcedure, parameters);        }

 前端页面用到的CSS样式:

.Inupttable{ width:100%; border:solid 1px; border-collapse:collapse; }.Inupttable td{ border:solid 1px ;  height:30px;}.Inupttable input{ width:80px; border:none; border-bottom:solid #000 1px;  background-color:transparent;}.Inupttable textarea{border:none; border-bottom:solid #000 1px;  background-color:transparent;}.Inupttable select{border:none; border-bottom:solid #000 1px;  background-color:#eee;}.Inupttable option{ background-color:#eee;}.Inupttable .btnchoose{background-color:#FFAA00; width:50px;}

 部门下拉的列表:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DepartMentListSelect.aspx.cs" Inherits="BioErpWeb.PersonList.DepartMentListSelect" %><!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>    </head><body>    <form id="form1" runat="server">    <div>    <select multiple="multiple" id="sltUserList" style=" width:80px; height:270px; margin:0px;">     <%=this.GetUserList%>    </select>    </div>    </form></body></html>

显示的后台:

   public string GetUserList        {            get {                string strHtml = "";                if (Request.QueryString["DepartmentName"] == null)                {                    DataSet ds = SqlComm.GetDataByCondition("Department", "top 10 DepartmentId,DepartmentName", " 1=1 order by DisplayOrder");                    foreach (DataRow dr in ds.Tables[0].Rows)                    {                        strHtml += "<option value=http://www.mamicode.com/‘" + dr["DepartmentId"] + "‘>" + dr["DepartmentName"] + "</option>";                    }                }                else                {                    DataSet ds = SqlComm.GetDataByCondition("Department", "top 10  DepartmentId,DepartmentName", " DepartmentName like ‘" + Request.QueryString["DepartmentName"].ToString() + "%‘ order by DisplayOrder");                    foreach (DataRow dr in ds.Tables[0].Rows)                    {                        strHtml += "<option value=http://www.mamicode.com/‘" + dr["DepartmentId"] + "‘>" + dr["DepartmentName"] + "</option>";                    }                }                return strHtml;            }        }

部门显示的前端:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DepartMentList.aspx.cs" Inherits="BioErpWeb.PersonList.DepartMentList" %><!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>    <script type="text/javascript">        function search() {            if (document.getElementById("txtSearchName").value =http://www.mamicode.com/="") {                alert("请输入员工姓名");                return;            }            document.getElementById("PersonIframeList").src = "http://www.mamicode.com/DepartMentListSelect.aspx?DepartmentName=" + encodeURIComponent(document.getElementById("txtSearchName").value);        }                function choose() {            window.returnValue = http://www.mamicode.com/PersonIframeList.document.getElementById("sltUserList").value;            window.close();        }    </script>    <style type="text/css">        .style1        {            width: 157px;        }    </style></head><body>    <form id="form1" runat="server">    <div>     <table style=" width:310px; ">         <tr>             <td class="style1">部门名称             </td>             <td>                <input id="txtSearchName" name="txtSearchName" type="text" size="10"  maxlength="10"/> <input type="button" value="http://www.mamicode.com/查询" onclick="search()" />             </td>         </tr>         <tr>             <td class="style1">             <iframe width="120px" id="PersonIframeList" frameborder=0 src="http://www.mamicode.com/DepartMentListSelect.aspx" height="310px" >                          </iframe>             </td>             <td style=" vertical-align:bottom; padding-bottom:20px;">             <input type="button"  value="http://www.mamicode.com/选择" onclick="choose()"/>             </td>         </tr>     </table>    </div>    </form></body></html>

 客户选择的js:

//客户选择对话框 function showCustomerDialog3() {    var re = showModalDialog("../../PersonList/CustomerList.aspx", "", "dialogWidth=320px;dialogHeight=350px");    var obj = window.event.srcElement;    var td = obj.parentNode;    var txts = td.getElementsByTagName(‘input‘);    if (re == null || re == "") {        if (txts[0].value =http://www.mamicode.com/="" || txts[0].value =http://www.mamicode.com/= null) {"请选择";        }    }    else {        txts[0].value = http://www.mamicode.com/re;>

 

ERP合同管理(二十六)