public void EditService(AdministrativeService serviceNew, AdministrativeServiceLog log) { var service = _uow.Context.AdministrativeServices.Find(serviceNew.Id); if (service == null) { throw new Exception("Не постои таков запис"); } service.ItemNumber = serviceNew.ItemNumber; service.DateReceived = serviceNew.DateReceived; service.ApplicantNameAddress = serviceNew.ApplicantNameAddress; service.AdministrativeServiceName = serviceNew.AdministrativeServiceName; service.AdministrativeServiceDesc = serviceNew.AdministrativeServiceDesc; service.LegislationForAdminService = serviceNew.LegislationForAdminService; service.LegislationForAdminServicePayment = serviceNew.LegislationForAdminServicePayment; service.AdminServicePaymentAmount = serviceNew.AdminServicePaymentAmount; service.AdminServiceSubmissionLeagalDeadline = serviceNew.AdminServiceSubmissionLeagalDeadline; service.DeliveringSpecialFormData = serviceNew.DeliveringSpecialFormData; service.PreviousSubmittedDocDependencyData = serviceNew.PreviousSubmittedDocDependencyData; service.ElectronicDBTypeVersion = serviceNew.ElectronicDBTypeVersion; service.AuthorizedPersonData = serviceNew.AuthorizedPersonData; service.Note = serviceNew.Note; service.OptionalField1 = serviceNew.OptionalField1; service.OptionalField2 = serviceNew.OptionalField2; service.AdministrativeServiceLogs.Add(log); try { _uow.Context.Entry(service).State = EntityState.Modified; _uow.Context.SaveChanges(); } catch (Exception ex) { //ToDo } }
public void UpdateService(AdministrativeService ser) { var log = new AdministrativeServiceLog(); var oldService = _adminServiceRepo.GetService(ser.Id); log.ChangeDate = DateTime.Now; log.UserName = _loggedUser.Identity.Name; log.PerformedActivity = ""; log.AdministrativeServiceId = ser.Id; if (ser.ItemNumber != oldService.ItemNumber) log.PerformedActivity = log.PerformedActivity + oldService.ItemNumber.ToString() + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.DateReceived != oldService.DateReceived) log.PerformedActivity = log.PerformedActivity + oldService.DateReceived.ToString() + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.ApplicantNameAddress != oldService.ApplicantNameAddress) log.PerformedActivity = log.PerformedActivity + oldService.ApplicantNameAddress + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.AdministrativeServiceName != oldService.AdministrativeServiceName) log.PerformedActivity = log.PerformedActivity + oldService.AdministrativeServiceName + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.AdministrativeServiceDesc != oldService.AdministrativeServiceDesc) log.PerformedActivity = log.PerformedActivity + oldService.AdministrativeServiceDesc + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.LegislationForAdminService != oldService.LegislationForAdminService) log.PerformedActivity = log.PerformedActivity + oldService.LegislationForAdminService + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.LegislationForAdminServicePayment != oldService.LegislationForAdminServicePayment) log.PerformedActivity = log.PerformedActivity + oldService.LegislationForAdminServicePayment + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.AdminServicePaymentAmount != oldService.AdminServicePaymentAmount) log.PerformedActivity = log.PerformedActivity + oldService.AdminServicePaymentAmount + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.AdminServiceSubmissionLeagalDeadline != oldService.AdminServiceSubmissionLeagalDeadline) log.PerformedActivity = log.PerformedActivity + oldService.AdminServiceSubmissionLeagalDeadline + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.DeliveringSpecialFormData != oldService.DeliveringSpecialFormData) log.PerformedActivity = log.PerformedActivity + oldService.DeliveringSpecialFormData + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.PreviousSubmittedDocDependencyData != oldService.PreviousSubmittedDocDependencyData) log.PerformedActivity = log.PerformedActivity + oldService.PreviousSubmittedDocDependencyData + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.ElectronicDBTypeVersion != oldService.ElectronicDBTypeVersion) log.PerformedActivity = log.PerformedActivity + oldService.ElectronicDBTypeVersion + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.AuthorizedPersonData != oldService.AuthorizedPersonData) log.PerformedActivity = log.PerformedActivity + oldService.AuthorizedPersonData + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.Note != oldService.Note) log.PerformedActivity = log.PerformedActivity + oldService.Note + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.OptionalField1 != oldService.OptionalField1) log.PerformedActivity = log.PerformedActivity + oldService.OptionalField1 + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; if (ser.OptionalField2 != oldService.OptionalField2) log.PerformedActivity = log.PerformedActivity + oldService.OptionalField2 + ","; else log.PerformedActivity = log.PerformedActivity + "Нема промена" + ","; ser.DateReceived = ser.DateReceived.AddDays(1); _adminServiceRepo.EditService(ser, log); }