public int Execute(AddInstrumentMasterCM model) { using (var sqlCommand = CreateCommand()) { sqlCommand.Connection = Connection; sqlCommand.CommandText = "[dbo].[uspAddInstrumentMaster]"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(AddParameter("@InstrumentName", SsDbType.VarChar, ParameterDirection.Input, model.InstrumentName)); sqlCommand.Parameters.Add(AddParameter("@AddedDate", SsDbType.DateTime, ParameterDirection.Input, model.AddedDate)); sqlCommand.Parameters.Add(AddParameter("@Make", SsDbType.VarChar, ParameterDirection.Input, model.Make)); sqlCommand.Parameters.Add(AddParameter("@Range", SsDbType.VarChar, ParameterDirection.Input, model.Range)); sqlCommand.Parameters.Add(AddParameter("@Accuracy", SsDbType.VarChar, ParameterDirection.Input, model.Accuracy)); sqlCommand.Parameters.Add(AddParameter("@Serial", SsDbType.VarChar, ParameterDirection.Input, model.Serial)); sqlCommand.Parameters.Add(AddParameter("@CalibratedDate", SsDbType.DateTime, ParameterDirection.Input, model.CalibratedDate)); sqlCommand.Parameters.Add(AddParameter("@Frequency", SsDbType.Decimal, ParameterDirection.Input, model.Frequency)); sqlCommand.Parameters.Add(AddParameter("@CalibratedDueDate", SsDbType.DateTime, ParameterDirection.Input, model.CalibrationDueDate)); sqlCommand.Parameters.Add(AddParameter("@VendorCode", SsDbType.VarChar, ParameterDirection.Input, model.VendorCode)); sqlCommand.Parameters.Add(AddParameter("@CreatedBy", SsDbType.UniqueIdentifier, ParameterDirection.Input, new Guid())); sqlCommand.Parameters.Add(AddParameter("@CreatedDateTime", SsDbType.DateTime, ParameterDirection.Input, DateTime.UtcNow)); sqlCommand.Parameters.Add(AddParameter("@InstrumentCode", SsDbType.Decimal, ParameterDirection.Output, default(int))); sqlCommand.ExecuteNonQuery(); return(Convert.ToInt32(sqlCommand.Parameters["@InstrumentCode"].Value)); } }
public AddInstrumentMasterQM AddInstrumentMaster(AddInstrumentMasterCM addInstrumentMasterCM) { using (var connection = new DbConnectionProvider().CreateConnection()) { connection.Open(); var command = new InstrumentMasterInsertCommand { Connection = connection }; command.Execute(addInstrumentMasterCM); } return(new AddInstrumentMasterQM()); }
public AddInstrumentMasterResponseDto AddInstrumentMaster(AddInstrumentMasterRequestDto addInstrumentMasterRequestDto) { var cModel = new AddInstrumentMasterCM() { InstrumentName = addInstrumentMasterRequestDto.InstrumentName, AddedDate = addInstrumentMasterRequestDto.AddedDate, Make = addInstrumentMasterRequestDto.Make, Range = addInstrumentMasterRequestDto.Range, Accuracy = addInstrumentMasterRequestDto.Accuracy, Serial = addInstrumentMasterRequestDto.Serial, CalibratedDate = addInstrumentMasterRequestDto.CalibratedDate, Frequency = addInstrumentMasterRequestDto.Frequency, CalibrationDueDate = addInstrumentMasterRequestDto.CalibrationDueDate, VendorCode = addInstrumentMasterRequestDto.VendorCode }; var response = instrumentMastersRepository.AddInstrumentMaster(cModel); return(new AddInstrumentMasterResponseDto()); }