public void DeleteClassificator(int id, string host) { using (IUnitOfWork work = UnitOfWork.Begin()) { IEnumerable <ClassificatorValue> cv1 = _classificatorValueRepository.FindByClassificatorId(id); foreach (var obj in cv1) { _classificatorValueRepository.Delete(obj); } work.Commit(); Classificator c = _classificatorRepository.FindById(id); var logClassificatorEntity = new ClassificatorEventEntity(c); _classificatorRepository.Delete(c); work.Commit(); _logService.CreateLog(CurrentUser.Get().Id, "web", flag, host, CurrentUser.Get().CompanyId, logClassificatorEntity.GetDeleteMessage()); } }
public void EditClassificator(int id, string name, string comment, string host) { using (IUnitOfWork work = UnitOfWork.Begin()) { Classificator c = _classificatorRepository.FindById(id); var logClassificatorEntity = new ClassificatorEventEntity(c); c.Description = name; c.Comments = comment; work.Commit(); logClassificatorEntity.SetNewClassificator(c); _logService.CreateLog(CurrentUser.Get().Id, "web", flag, host, CurrentUser.Get().CompanyId, logClassificatorEntity.GetEditMessage()); } }
public void CreateClassificator(string name, string comment, string host) { using (IUnitOfWork work = UnitOfWork.Begin()) { Classificator c = DomainObjectFactory.CreateClassificator(); c.Description = name; c.Comments = comment; _classificatorRepository.Add(c); work.Commit(); var classificatorLogEntity = new ClassificatorEventEntity(c); _logService.CreateLog(CurrentUser.Get().Id, "web", flag, host, CurrentUser.Get().CompanyId, classificatorLogEntity.GetCreateMessage()); } }