public void SaveList(List <TraCafDto> data, BusinessObject.Business.Login CurrentUser) { var datatoSave = Mapper.Map <List <TRA_CAF> >(data); foreach (var caf in datatoSave) { TRA_CAF dataCaf = _CafService.GetCafByNumber(caf.SIRS_NUMBER); if (!string.IsNullOrEmpty(caf.VENDOR_NAME)) { var vendorData = _vendorService.GetByShortName(caf.VENDOR_NAME); caf.VENDOR_ID = vendorData.MST_VENDOR_ID; } else { caf.VENDOR_ID = null; } if (dataCaf == null) { caf.REMARK = null; caf.IS_ACTIVE = true; caf.DOCUMENT_NUMBER = _docNumberService.GenerateNumber(new GenerateDocNumberInput() { DocType = (int)Enums.DocumentType.CAF, Month = DateTime.Now.Month, Year = DateTime.Now.Year }); caf.DOCUMENT_STATUS = (int)Enums.DocumentStatus.Draft; _CafService.Save(caf, CurrentUser); } else { dataCaf.IS_ACTIVE = true; dataCaf.REMARK = null; } } _uow.SaveChanges(); }
public void Save(TRA_CAF datatoSave, BusinessObject.Business.Login CurrentUser) { _traCafRepository.InsertOrUpdate(datatoSave, CurrentUser, Core.Enums.MenuList.TraCaf); _uow.SaveChanges(); }
public void Save(BusinessObject.Dto.TraCafDto data, BusinessObject.Business.Login user) { throw new NotImplementedException(); }
public int SaveProgress(TraCafProgressDto traCafProgressDto, string sirsNumber, BusinessObject.Business.Login CurrentUser) { var data = Mapper.Map <TRA_CAF_PROGRESS>(traCafProgressDto); data.CREATED_BY = CurrentUser.USER_ID; data.CREATED_DATE = DateTime.Now; var caf = _CafService.GetCafByNumber(sirsNumber); var lastStatus = caf.DOCUMENT_STATUS; var countDetails = _CafService.SaveProgress(data, sirsNumber, CurrentUser); if (lastStatus != data.STATUS_ID) { if (countDetails == 0) { _workflowService.Save(new WorkflowHistoryDto() { ACTION = Enums.ActionType.Modified, ACTION_DATE = DateTime.Now, ACTION_BY = CurrentUser.USER_ID, FORM_ID = caf.TRA_CAF_ID, MODUL_ID = Enums.MenuList.TraCaf }); _uow.SaveChanges(); } caf.DOCUMENT_STATUS = data.STATUS_ID.HasValue ? data.STATUS_ID.Value : caf.DOCUMENT_STATUS; var dataCaf = Mapper.Map <TraCafDto>(caf); SendEmailWorkflow(dataCaf, Enums.ActionType.Submit); } return(lastStatus); }