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
添加的业务:
/// /// 添加一条合同信息对象并返回当前合同编号 /// /// BioCRMContract /// int 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
业务逻辑的代码:
/// /// 修改一条合同信息对象 /// /// BioCRMContract /// int 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 )
添加的代码:
/// /// 合同文档对象添加 /// /// CRMContractDocument /// int 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
业务逻辑:
/// /// 合同文档对象修改 /// /// CRMContractDocument /// int 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 )
写在共用类中的业务:
/// /// 向任务流程表添加一条记录 /// /// TaskListRecord /// int 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{ 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" %>