zoukankan      html  css  js  c++  java
  • ERP合同管理(二十七)

    需要实现的基本业务:

    相关的用例图:

    相关业务的封装:

    相关的约定:

    合同信息添加业务流程:

    添加的存储过程

    SET QUOTED_IDENTIFIER ON
    SET ANSI_NULLS ON
    GO
    
    
    
    ------------------------------------
    --用途:增加一条记录 
    --项目名称:
    --说明:
    --时间: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 = model.ContractName;
              parameters[2].Value = model.ContractNumber;
              parameters[3].Value = model.CustomerID;
              parameters[4].Value = model.CreateTime;
              parameters[5].Value = model.ContractSum;
              parameters[6].Value = model.SignTime;
              parameters[7].Value = model.EffectiveTime;
              parameters[8].Value = model.EndTime;
              parameters[9].Value = model.ContractType;
              parameters[10].Value = model.UserID;
              parameters[11].Value = model.ExecutiveState;
              parameters[12].Value = model.ContractDesc;
              parameters[13].Value = model.AssessorID;
             
    
             int count= DataBaseHelper.ExcuteSqlReturnInt("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 =model.ContractID;
              parameters[1].Value = model.ContractName;
              parameters[2].Value = model.ContractNumber;
              parameters[3].Value = model.CustomerID;
              parameters[4].Value = model.CreateTime;
              parameters[5].Value = model.ContractSum;
              parameters[6].Value = model.SignTime;
              parameters[7].Value = model.EffectiveTime;
              parameters[8].Value = model.EndTime;
              parameters[9].Value = model.ContractType;
              parameters[10].Value = model.UserID;
              parameters[11].Value = model.ExecutiveState;
              parameters[12].Value = model.ContractDesc;
              parameters[13].Value = model.AssessorID;
              parameters[14].Value = model.DeleteState;
    
              int count = DataBaseHelper.ExcuteSqlReturnInt("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 = document.DocumentID;
              parameters[1].Value = document.ContractID;
              return DataBaseHelper.ExcuteSqlReturnInt("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 = model.AccessoryID;
              parameters[1].Value = model.DocumentID;
              parameters[2].Value = model.ContractID;
              parameters[3].Value = model.DeleteState;
              return DataBaseHelper.ExcuteSqlReturnInt("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 = model.Subject;
                parameters[1].Value = model.TaskID;
                parameters[2].Value = model.TaskTableID;
                parameters[3].Value = model.Transmitter;
                parameters[4].Value = model.Accepter;
                parameters[5].Value = model.Pass;
                parameters[6].Value = model.AuditingSate;
                parameters[7].Value = model.Mind;
                parameters[8].Value = model.FirstSumitTime;
                parameters[9].Value = model.FirstTransmitter;
                parameters[10].Value = model.FirstAccepter;
                parameters[11].Value = model.DepartMentId;
                parameters[12].Value = model.SumitTime;
    
                return DataBaseHelper.ExcuteSqlReturnInt("TaskListRecord_ADD", CommandType.StoredProcedure, parameters);
    
            }
    

     前端页面用到的CSS样式:

    .Inupttable{ 100%; border:solid 1px; border-collapse:collapse; }
    .Inupttable td{ border:solid 1px ;  height:30px;}
    .Inupttable input{ 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; 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=" 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='" + 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='" + 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 == "") {
                    alert("请输入员工姓名");
                    return;
                }
                document.getElementById("PersonIframeList").src = "DepartMentListSelect.aspx?DepartmentName=" + encodeURIComponent(document.getElementById("txtSearchName").value);
    
            }
            
            function choose() {
                window.returnValue = PersonIframeList.document.getElementById("sltUserList").value;
                window.close();
            }
        </script>
        <style type="text/css">
            .style1
            {
                 157px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <table style=" 310px; ">
             <tr>
                 <td class="style1">部门名称
                 </td>
                 <td>
                    <input id="txtSearchName" name="txtSearchName" type="text" size="10"  maxlength="10"/> <input type="button" value="查询" onclick="search()" />
                 </td>
             </tr>
             <tr>
                 <td class="style1">
                 <iframe width="120px" id="PersonIframeList" frameborder=0 src="DepartMentListSelect.aspx" height="310px" >
                 
                 </iframe>
                 </td>
                 <td style=" vertical-align:bottom; padding-bottom:20px;">
                 <input type="button"  value="选择" 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 == "" || txts[0].value == null) {
                txts[0].value = "请选择";
            }
        }
        else {
            txts[0].value = re;
        }
    }
    
  • 相关阅读:
    游戏 猜拳游戏
    python的变量 以及操作系统
    python的异常处理
    python 三元运算
    python random 的用法
    python基础
    Round #417 A. Sagheer and Crossroads(Div.2)
    Round #416 B. Vladik and Complicated Book(Div.2)
    Round #416 A. Vladik and Courtesy(Div.2)
    Educational Round 26 D. Round Subset
  • 原文地址:https://www.cnblogs.com/sunliyuan/p/7215206.html
Copyright © 2011-2022 走看看