public long?StatementStatus_Save(List <StatementStatus> listStatementStatus) { if (listStatementStatus.Count == 1) { StatementStatus statementStatus = listStatementStatus[0]; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.AddInputParameter("@StatementID", SqlDbType.BigInt, statementStatus.StatementID); parameters.AddInputParameter("@UserID", SqlDbType.BigInt, statementStatus.UserID); parameters.AddInputParameter("@StatusDate", SqlDbType.DateTime, statementStatus.StatusDate); parameters.AddInputParameter("@StatusID", SqlDbType.BigInt, statementStatus.StatusID); parameters.AddInputParameter("@Comment", SqlDbType.NVarChar, statementStatus.Comment); parameters.AddInputParameter("@AssignedToUserID", SqlDbType.BigInt, statementStatus.AssignedToUserID); parameters.AddInputParameter("@ExecuteToDate", SqlDbType.DateTime, statementStatus.ExecuteToDate); SqlParameter StatementStatusID = parameters.AddInputOutputParameter("@StatementStatusID", SqlDbType.BigInt, statementStatus.Id); Execute_StoredProcedure("StatementStatus_Save", parameters); return((long)StatementStatusID.Value); } else { List <SqlParameter> parameters = new List <SqlParameter>(); StatementStatusTableSet set = new StatementStatusTableSet(listStatementStatus); parameters.AddInputParameter("@tableStatementStatus", SqlDbType.Structured, set.StatementStatusResultTable); Execute_StoredProcedure("StatementStatus_SaveTable", parameters); return(null); } }
public long Statement_SaveAll(Statement statement) { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.AddInputParameter("@CreateDate", SqlDbType.DateTime, statement.CreateDate); parameters.AddInputParameter("@LastStatementStatusID", SqlDbType.BigInt, statement.LastStatementStatusID); parameters.AddInputParameter("@CuratorID", SqlDbType.BigInt, statement.CuratorID); parameters.AddInputParameter("@ResponsibleID", SqlDbType.BigInt, statement.ResponsibleID); parameters.AddInputParameter("@ExecutiveID", SqlDbType.BigInt, statement.ExecutiveID); parameters.AddInputParameter("@LastStatusDate", SqlDbType.DateTime, statement.LastStatusDate); parameters.AddInputParameter("@StatementTypeID", SqlDbType.BigInt, statement.StatementTypeID); parameters.AddInputParameter("@Lastname", SqlDbType.NVarChar, statement.Lastname); parameters.AddInputParameter("@Firstname", SqlDbType.NVarChar, statement.Firstname); parameters.AddInputParameter("@Secondname", SqlDbType.NVarChar, statement.Secondname); parameters.AddInputParameter("@Birthday", SqlDbType.DateTime, statement.Birthday); parameters.AddInputParameter("@Sex", SqlDbType.NVarChar, statement.Sex); parameters.AddInputParameter("@Phone", SqlDbType.NVarChar, statement.Phone); parameters.AddInputParameter("@Email", SqlDbType.NVarChar, statement.Email); parameters.AddInputParameter("@ReasonID", SqlDbType.BigInt, statement.ReasonID); parameters.AddInputParameter("@ClientID", SqlDbType.BigInt, statement.ClientID); parameters.AddInputParameter("@VisitGroupID", SqlDbType.BigInt, statement.VisitGroupID); parameters.AddInputParameter("@MedDocumentTypeID", SqlDbType.BigInt, statement.MedDocumentTypeID); parameters.AddInputParameter("@Series", SqlDbType.NVarChar, statement.Series); parameters.AddInputParameter("@Number", SqlDbType.NVarChar, statement.Number); parameters.AddInputParameter("@UnifiedPolicyNumber", SqlDbType.NVarChar, statement.UnifiedPolicyNumber); parameters.AddInputParameter("@SubjectInsuranceID", SqlDbType.BigInt, statement.SubjectInsuranceID); parameters.AddInputParameter("@LocalityID", SqlDbType.BigInt, statement.LocalityID); parameters.AddInputParameter("@IncidentDate", SqlDbType.DateTime, statement.IncidentDate); parameters.AddInputParameter("@Description", SqlDbType.NVarChar, statement.Description); parameters.AddInputParameter("@IncomingСhannelID", SqlDbType.BigInt, statement.IncomingChannelID); parameters.AddInputParameter("@ExpertiseID", SqlDbType.BigInt, statement.ExpertiseID); parameters.AddInputParameter("@UpdateDate", SqlDbType.DateTime, DateTime.Now); SqlParameter StatementID = parameters.AddInputOutputParameter("@StatementID", SqlDbType.BigInt, statement.Id); StatementStatusTableSet statusSet = new StatementStatusTableSet(statement.StatementStatuses); parameters.AddInputParameter("@tableStatementStatus", SqlDbType.Structured, statusSet.StatementStatusResultTable); FileTableSet fileSet = new FileTableSet(statement.Files); parameters.AddInputParameter("@tableFile", SqlDbType.Structured, fileSet.FileResultTable); parameters.AddInputParameter("@Validity", SqlDbType.Bit, statement.Execution.Validity); parameters.AddInputParameter("@Judicial", SqlDbType.Bit, statement.Execution.Judicial); parameters.AddInputParameter("@ExpertiseDate", SqlDbType.DateTime, statement.Execution.ExpertiseDate); parameters.AddInputParameter("@FinancialSanctions", SqlDbType.Float, statement.Execution.FinancialSanctions); parameters.AddInputParameter("@Straf", SqlDbType.Float, statement.Execution.Straf); parameters.AddInputParameter("@DescriptionExecution", SqlDbType.NVarChar, statement.Execution.DescriptionExecution); parameters.AddInputParameter("@LPU_Code", SqlDbType.NVarChar, statement.Execution.LPU_Code); parameters.AddInputParameter("@LPU_Name", SqlDbType.NVarChar, statement.Execution.LPU_Name); SqlParameter ExecutionID = parameters.AddInputOutputParameter("@ExecutionID", SqlDbType.BigInt, statement.Execution.Id); Execute_StoredProcedure("Statement_SaveAll", parameters); return((long)StatementID.Value); }