private void SetFlagSentForBrand(List <InvalidBrandByCk1ForEmail> invalidCk1List, List <ZAIDM_EX_BRAND> allActiveBrand) { foreach (var invalidCk1 in invalidCk1List) { foreach (var brand in invalidCk1.BrandList) { var item = allActiveBrand.Where(x => x.WERKS == brand.PlantId && x.FA_CODE == brand.FaCode && x.STICKER_CODE == brand.StickerCode).FirstOrDefault(); item.IS_SENT_CHECK_BRAND = true; item.STATUS = !brand.IsDeactivated; _brandRegistrationService.Save(item); } } uow.SaveChanges(); }
public void Approve(string userId, int masterApprovalId) { var data = _repository.Get(x => x.APPROVAL_ID == masterApprovalId, null, includeTables).FirstOrDefault(); if (data.PAGE_ID == (int)Core.Enums.MenuList.MaterialMaster) { if (data.MASTER_DATA_APPROVAL_DETAIL.Any(x => x.COLUMN_NAME == "CONVERTION")) { var tempId = data.FORM_ID.Split('-'); var werks = tempId[0]; var materialnumber = tempId[1]; _materialBLL.ClearConvertion(materialnumber, werks); } } if (data != null) { data.STATUS_ID = Enums.DocumentStatus.Approved; data.APPROVED_BY = userId; data.APPROVED_DATE = DateTime.Now; bool isDelete; var newData = UpdateObjectByFormId(data, out isDelete); if (newData != null) { if (newData.GetType() == typeof(ZAIDM_EX_BRAND)) { var dataBrand = (ZAIDM_EX_BRAND)newData; dataBrand.CREATED_BY = data.CREATED_BY; dataBrand.CREATED_DATE = DateTime.Now; dataBrand.MODIFIED_BY = data.APPROVED_BY; dataBrand.MODIFIED_DATE = DateTime.Now; _brandRegistrationBLL.Save(dataBrand); } else if (newData.GetType() == typeof(POA)) { var dataPoa = (POA)newData; dataPoa.CREATED_BY = data.CREATED_BY; dataPoa.CREATED_DATE = DateTime.Now; dataPoa.MODIFIED_BY = data.APPROVED_BY; dataPoa.MODIFIED_DATE = DateTime.Now; _poaBll.Save(dataPoa); } else if (newData.GetType() == typeof(ZAIDM_EX_MATERIAL)) { var dataMaterial = (ZAIDM_EX_MATERIAL)newData; dataMaterial.CREATED_BY = data.CREATED_BY; dataMaterial.CREATED_DATE = DateTime.Now; dataMaterial.MODIFIED_BY = data.APPROVED_BY; dataMaterial.MODIFIED_DATE = DateTime.Now; _materialBLL.Save(dataMaterial); } else if (newData.GetType() == typeof(POA_MAP)) { var dataPoaMap = (POA_MAP)newData; dataPoaMap.CREATED_BY = data.CREATED_BY; dataPoaMap.CREATED_DATE = DateTime.Now; dataPoaMap.MODIFIED_BY = data.APPROVED_BY; dataPoaMap.MODIFIED_DATE = DateTime.Now; _poaMapBLL.Save(dataPoaMap); } } if (!isDelete) { UpdateChangesHistory(data); _uow.SaveChanges(); } else //delete non flagging { if (data.PAGE_ID == (int)Enums.MenuList.POAMap) { var tempId = data.FORM_ID.Split('-'); var poaId = tempId[0]; var nppbkc = tempId[1]; var plantid = tempId[2]; var dataPoaMap = _poaMapBLL.GetByNppbckId(nppbkc, plantid, poaId); _poaMapBLL.Delete(dataPoaMap.POA_MAP_ID); } } //create xml for brand registration SendEmailWorkflow(data.APPROVAL_ID); } }