public long?File_Save(List <File> listFiles) { if (listFiles.Count == 1) { File file = listFiles[0]; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.AddInputParameter("@AttachmentDate", SqlDbType.DateTime, file.AttachmentDate); parameters.AddInputParameter("@UserID", SqlDbType.BigInt, file.UserID); parameters.AddInputParameter("@FileName", SqlDbType.NVarChar, file.FileName); parameters.AddInputParameter("@FIleUrl", SqlDbType.NVarChar, file.FIleUrl); parameters.AddInputParameter("@NominationID", SqlDbType.BigInt, file.NominationID); parameters.AddInputParameter("@Comment", SqlDbType.NVarChar, file.Comment); parameters.AddInputParameter("@StatementID", SqlDbType.BigInt, file.StatementID); parameters.AddInputParameter("@StatementStatusID", SqlDbType.BigInt, file.StatementStatusID); SqlParameter FileID = parameters.AddInputOutputParameter("@FileID", SqlDbType.BigInt, file.Id); Execute_StoredProcedure("File_Save", parameters); return((long)FileID.Value); } else { List <SqlParameter> parameters = new List <SqlParameter>(); FileTableSet set = new FileTableSet(listFiles); parameters.AddInputParameter("@tableFile", SqlDbType.Structured, set.FileResultTable); Execute_StoredProcedure("File_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); }