/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string isBT = CurrentSession.GetValue("isBT") as string; if ("Y".Equals(isBT)) { Product currentProduct = CurrentSession.GetValue(Session.SessionKeys.Product) as Product; ProductBTInfo bt = new ProductBTInfo(); bt.productID = currentProduct.ProId; bt.bt = "BT" + DateTime.Now.ToString("yyyyMMdd"); bt.editor = Editor; bt.cdt = DateTime.Now; bt.udt = DateTime.Now; IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); productRep.InsertProductBTDefered(CurrentSession.UnitOfWork, bt); } return base.DoExecute(executionContext); }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>(); var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); var productList = CurrentSession.GetValue(Session.SessionKeys.ProdList) as List<IProduct>; if (productList == null) { throw new NullReferenceException("ProdList in session is null"); } int b = (int)CurrentSession.GetValue("BTProList"); if (b == 1) { var currentMO = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO); string modelName = (string)CurrentSession.GetValue(Session.SessionKeys.ModelName); IList<MpBtOrderInfo> infos = new List<MpBtOrderInfo>(); infos = repPizza.GetMpBtOrderInfoList(modelName); MpBtOrderInfo temp = new MpBtOrderInfo(); int inputQty = (int)CurrentSession.GetValue(Session.SessionKeys.Qty); //ITC-1360-1298 //foreach (MpBtOrderInfo temp in infos) if(infos != null && infos.Count > 0) { temp = infos[infos.Count - 1]; if (temp.qty - temp.prtQty >= inputQty) { foreach (var product in productList) { ProductBTInfo item = new ProductBTInfo(); item.productID = product.ProId; item.bt = temp.bt; item.editor = this.Editor; productRepository.InsertProductBT(item); } MpBtOrderInfo setValue = new MpBtOrderInfo(); //setValue.prtQty = temp.prtQty + inputQty; setValue.bt = temp.bt; setValue.id = temp.id; repPizza.UpdateForIncreasePrtQty(setValue, inputQty); } else { int n = temp.qty - temp.prtQty; for (int i = 0; i < n; i++) { ProductBTInfo item = new ProductBTInfo(); item.productID = productList[i].ProId; item.bt = temp.bt; item.editor = this.Editor; productRepository.InsertProductBT(item); } MpBtOrderInfo setValue = new MpBtOrderInfo(); setValue.prtQty = temp.qty; MpBtOrderInfo cond = new MpBtOrderInfo(); cond.bt = temp.bt; cond.id = temp.id; repPizza.UpdateMpBtOrder(setValue, cond); } } } return base.DoExecute(executionContext); }