public void UpdateJobCardMaintance(UpdateJobCardMaintanceCM updateJobCardMaintanceCM) { using (var connection = new DbConnectionProvider().CreateConnection()) { connection.Open(); var command = new UpdateJobCardMaintanceUpdateCommand { Connection = connection }; command.Execute(updateJobCardMaintanceCM.GetUpdateJobCardDetails.ToDataTableWithNull(), updateJobCardMaintanceCM); } }
public UpdateJobCardMaintanceResponseDto UpdateJobCardMaintance(GetJobCardMaintanceResponseDto getJobCardMaintanceResponseDto) { UpdateJobCardMaintanceResponseDto response = new UpdateJobCardMaintanceResponseDto(); UpdateJobCardMaintanceCM updateJobCardMaintanceCM = new UpdateJobCardMaintanceCM(); GetJobCardMaintanceDetails getJobCardMaintanceDetails = new GetJobCardMaintanceDetails(); UpdateJobCardDetails updateJobCardDetails = new UpdateJobCardDetails(); var updateJobCardDetailsList = new List <UpdateJobCardDetails>(); #region Update JobCard Master foreach (var master in getJobCardMaintanceResponseDto.GetJobCardMaintanceResponseList) { updateJobCardMaintanceCM.PartCode = master.PartCode; updateJobCardMaintanceCM.SequenceNumber = master.SequenceNumber; updateJobCardMaintanceCM.SerialNo = master.SerialNo; updateJobCardMaintanceCM.ActualRunningTime = master.ActualRunningTime; updateJobCardMaintanceCM.ActualSettingTime = master.ActualSettingTime; updateJobCardMaintanceCM.OperationDate = master.OperationDate; updateJobCardMaintanceCM.Shift = master.Shift; updateJobCardMaintanceCM.EmployeeCode = master.EmployeeCode; foreach (var details in master.getJobCardMaintanceDetails) { updateJobCardDetails = new UpdateJobCardDetails { SerialNo = details.SerialNo, PartCode = details.PartCode, SequenceNumber = details.SequenceNumber, Serial = details.Serial, DimensionActual = details.DimensionActual, DatumDimensionActual = details.DatumDimesionActual, UpdatedBy = new Guid("783F190B-9B66-42AC-920B-E938732C1C01"), //Later needs to be remove, UpdatedDateTime = System.DateTime.UtcNow }; updateJobCardDetailsList.Add(updateJobCardDetails); } ; } ; updateJobCardMaintanceCM.GetUpdateJobCardDetails = updateJobCardDetailsList; jobCardGenerationRepository.UpdateJobCardMaintance(updateJobCardMaintanceCM); #endregion #region Update JobCard Details #endregion return(response); }
public void Execute(DataTable dataTableForInvoiceDetails, UpdateJobCardMaintanceCM updateJobCardMaintanceCM) { using (var sqlCommand = CreateCommand()) { sqlCommand.Connection = Connection; sqlCommand.CommandText = "[dbo].[uspUpdateJobCardMaintance]"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(AddParameter("@PartCode", SsDbType.Decimal, ParameterDirection.Input, updateJobCardMaintanceCM.PartCode)); sqlCommand.Parameters.Add(AddParameter("@SequeneNumber", SsDbType.Decimal, ParameterDirection.Input, updateJobCardMaintanceCM.SequenceNumber)); sqlCommand.Parameters.Add(AddParameter("@SerialNo", SsDbType.VarChar, ParameterDirection.Input, updateJobCardMaintanceCM.SerialNo)); sqlCommand.Parameters.Add(AddParameter("@ActualSettingTime", SsDbType.Decimal, ParameterDirection.Input, updateJobCardMaintanceCM.ActualSettingTime)); sqlCommand.Parameters.Add(AddParameter("@ActualRunningTime", SsDbType.Decimal, ParameterDirection.Input, updateJobCardMaintanceCM.ActualRunningTime)); sqlCommand.Parameters.Add(AddParameter("@OperationDate", SsDbType.DateTime, ParameterDirection.Input, updateJobCardMaintanceCM.OperationDate)); sqlCommand.Parameters.Add(AddParameter("@Shift", SsDbType.VarChar, ParameterDirection.Input, updateJobCardMaintanceCM.Shift)); sqlCommand.Parameters.Add(AddParameter("@EmployeeCode", SsDbType.VarChar, ParameterDirection.Input, updateJobCardMaintanceCM.EmployeeCode)); sqlCommand.Parameters.Add(AddParameter("@UpdateJobCardDetails", SsDbType.Structured, ParameterDirection.Input, dataTableForInvoiceDetails)); sqlCommand.ExecuteNonQuery(); } }