public long Execute(AddPartMasterCM model) { using (var sqlCommand = CreateCommand()) { sqlCommand.Connection = Connection; sqlCommand.CommandText = "[dbo].[uspAddPartMaster]"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(AddParameter("@VendorCode", SsDbType.BigInt, ParameterDirection.Input, model.VendorCode)); sqlCommand.Parameters.Add(AddParameter("@Description", SsDbType.VarChar, ParameterDirection.Input, model.Description)); sqlCommand.Parameters.Add(AddParameter("@DrawingNumber", SsDbType.VarChar, ParameterDirection.Input, model.DrawingNumber)); sqlCommand.Parameters.Add(AddParameter("@DrawingUnit", SsDbType.VarChar, ParameterDirection.Input, model.DrawingUnit)); sqlCommand.Parameters.Add(AddParameter("@DrawingNoRevision", SsDbType.VarChar, ParameterDirection.Input, model.DrawingNumberRevision)); sqlCommand.Parameters.Add(AddParameter("@ItemCode", SsDbType.VarChar, ParameterDirection.Input, model.ItemCode)); sqlCommand.Parameters.Add(AddParameter("@RatePiece", SsDbType.Decimal, ParameterDirection.Input, model.RatePiece)); sqlCommand.Parameters.Add(AddParameter("@RawWeight", SsDbType.Decimal, ParameterDirection.Input, model.RawWeight)); sqlCommand.Parameters.Add(AddParameter("@FinishWeight", SsDbType.Decimal, ParameterDirection.Input, model.FinishWeight)); sqlCommand.Parameters.Add(AddParameter("@MaterialCode", SsDbType.Decimal, ParameterDirection.Input, model.MaterialCode)); 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("@PartCode", SsDbType.BigInt, ParameterDirection.Output, default(Int64))); sqlCommand.ExecuteNonQuery(); return(Convert.ToInt64(sqlCommand.Parameters["@PartCode"].Value)); } }
public AddPartMasterQM AddPartMaster(AddPartMasterCM addPartMasterCM) { using (var connection = new DbConnectionProvider().CreateConnection()) { connection.Open(); var command = new PartMasterInsertCommand { Connection = connection }; command.Execute(addPartMasterCM); } return(new AddPartMasterQM()); }
public AddPartMasterResponseDto AddPartMaster(AddPartMasterRequestDto addPartMasterRequestDto) { var cModel = new AddPartMasterCM { Description = addPartMasterRequestDto.Description, DrawingNumber = addPartMasterRequestDto.DrawingNumber, DrawingUnit = addPartMasterRequestDto.DrawingUnit, DrawingNumberRevision = addPartMasterRequestDto.DrawingNumberRevision, FinishWeight = addPartMasterRequestDto.FinishWeight, ItemCode = addPartMasterRequestDto.ItemCode, MaterialCode = addPartMasterRequestDto.MaterialCode, RatePiece = addPartMasterRequestDto.RatePiece, RawWeight = addPartMasterRequestDto.RawWeight, VendorCode = addPartMasterRequestDto.VendorCode }; var response = partMasterRepository.AddPartMaster(cModel); return(new AddPartMasterResponseDto()); }