public int CreateCardType(string name, bool isCardCode, bool isSerDK, string description) { int result = 0; using (IUnitOfWork work = UnitOfWork.Begin()) { UserAccessUnitType cType = DomainObjectFactory.CreateUserAccessUnitType(); cType.Name = name; cType.IsCardCode = isCardCode; cType.IsSerDK = isSerDK; cType.Description = description; cType.IsDeleted = false; _cardTypeRepository.Add(cType); var logCardTypeEntity = new CardTypeEventEntity(cType); work.Commit(); result = cType.Id; _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, logCardTypeEntity.GetCreateMessage()); } return result; }
public void DeleteCardType(int id) { using (IUnitOfWork work = UnitOfWork.Begin()) { UserAccessUnitType cType = _cardTypeRepository.FindAll(x => x.Id == id && !x.IsDeleted).FirstOrDefault(); cType.IsDeleted = true; var logCardTypeEntity = new CardTypeEventEntity(cType); work.Commit(); _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, logCardTypeEntity.GetDeleteMessage()); } }
public void EditCardType(int id, string name, bool isCardCode, bool isSerDK, string description) { using (IUnitOfWork work = UnitOfWork.Begin()) { UserAccessUnitType cType = _cardTypeRepository.FindById(id); var logCardTypeEntity = new CardTypeEventEntity(cType); cType.Name = name; cType.IsCardCode = isCardCode; cType.IsSerDK = isSerDK; cType.Description = description; logCardTypeEntity.SetNewCardType(cType); work.Commit(); _logService.CreateLog(CurrentUser.Get().Id, "web", flag,CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, logCardTypeEntity.GetEditMessage()); } }