internal override void ProcessEvent(ActivityExecutionContext context)
 {
     StateMachineExecutionState state = StateMachineExecutionState.Get(StateMachineHelpers.GetRootState((StateActivity) context.Activity));
     ExternalEventAction action = new ExternalEventAction(this.StateName, this.EventDrivenName);
     state.EnqueueAction(action);
     state.ProcessActions(context);
 }
Example #2
0
        /// <summary>
        /// Check RMN
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            string prod = currentProduct.ProId;
            IProductRepository iproductRepository =RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            string boxid = (string)CurrentSession.GetValue(Session.SessionKeys.boxId);
            string infovalue = string.Empty;
            infovalue = iproductRepository.GetProductInfoValue(prod, "BoxId");
            if (string.IsNullOrEmpty(infovalue))
            {
                infovalue = iproductRepository.GetProductInfoValue(prod, "UCC");
                if (string.IsNullOrEmpty(infovalue))
                {
                    FisException fe = new FisException("PAK034", new string[] { });   //此机器无BoxId!请返回Ship To Label 确认!
                    fe.stopWF = false;
                    throw fe;
                }
            }

            if (infovalue != boxid)
            {
                FisException fe = new FisException("PAK035", new string[] { });   //Box ID / UCC 与机器不匹配!
                fe.stopWF = false;
                throw fe;
            }
	        return base.DoExecute(executionContext);
        }
Example #3
0
	      	//protected override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext)

	      	protected override ActivityExecutionStatus Execute (ActivityExecutionContext executionContext)
	      	{
	      		bool condition_true = false;

			foreach (IfElseBranchActivity activity in Activities) {

				if (activity == null || activity.Condition == null)
					continue;

				if (activity.Condition.Evaluate (this, executionContext) == true) {
					condition_true = true;
					break;
				}
			}

			if (Activities.Count > 1) {
				if (condition_true == true) {
					ActivitiesToExecute.Enqueue (Activities[0]);
				} else {
					ActivitiesToExecute.Enqueue (Activities[1]);
				}
			}

			NeedsExecution = false;
			return ActivityExecutionStatus.Closed;
	      	}
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);

            string FAIinPAK = (string)product.GetExtendedProperty("FAIinPAK");
            if ("Y" != FAIinPAK)
            {
                // 非FAI機器,不允許做FAI Input
                throw new FisException("CQCHK50012", new string[] {  });
            }

            if (CheckFaiIn(product.Model))
            {
                // 此Model:%1 已有機器進入FAI In,不可再刷入!
                throw new FisException("CQCHK50064", new string[] { product.Model });
            }

            if (CheckFaiOut(product.Model))
            {
                // 此Model:%1 已有機器完成FAI Out,不可再刷入!
                throw new FisException("CQCHK50065", new string[] { product.Model });
            }

            return base.DoExecute(executionContext);
        }
Example #5
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ExternalRuleSetService.ExternalRuleSetService ruleSetService = context.GetService<ExternalRuleSetService.ExternalRuleSetService>();

            if (ruleSetService != null)
            {
                RuleSet ruleSet = ruleSetService.GetRuleSet(new RuleSetInfo(this.RuleSetName, this.MajorVersion, this.MinorVersion));
                if (ruleSet != null)
                {
                    Activity targetActivity = this.GetRootWorkflow(this.Parent);
                    RuleValidation validation = new RuleValidation(targetActivity.GetType(), null);
                    RuleExecution execution = new RuleExecution(validation, targetActivity, context);
                    ruleSet.Execute(execution);
                }
            }
            else
            {
                throw new InvalidOperationException("A RuleSetService must be configured on the host to use the PolicyFromService activity.");
            }

            return ActivityExecutionStatus.Closed;
        }
Example #6
0
        /// <summary>
        /// 检查ECR是否存在
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            MB currenMB = CurrentSession.GetValue(Session.SessionKeys.MB) as MB;
            string CheckCode = currenMB.Sn.Substring(5, 1);
            if (currenMB.Sn.Substring(5, 1) == "M" || currenMB.Sn.Substring(5, 1) == "B")
            {
                CheckCode = currenMB.Sn.Substring(6, 1);
            }
            if ("0123456789".IndexOf(CheckCode) == -1)
            {
                IMBRepository CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
                MBCodeDef resultMBCode = CurrentRepository.GetMBCode(currenMB.MBCode);

                if (resultMBCode != null)
                {
                    if (resultMBCode.Type == "1")
                    {
                        IList<MBLog> resultLogList = CurrentRepository.GetMBLog(currenMB.Sn, "09", 1);
                        if (resultLogList == null || resultLogList.Count == 0)
                        {
                            throw new FisException("ICT004", new string[] { currenMB.Sn });
                        }
                    }
                    if (resultMBCode.Qty > 1)
                    {
                        CurrentSession.AddValue(Session.SessionKeys.MultiQty, resultMBCode.Qty);
                    }
                }
            }
            return base.DoExecute(executionContext);
        }
Example #7
0
        /// <summary>
        /// lightoff
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IFlatBOM curBom = (IFlatBOM)CurrentSession.GetValue(Session.SessionKeys.SessionBom);
            string stationDescr = CurrentSession.GetValue(Session.SessionKeys.StationDescr) as string;

            IFlatBOMItem curMatchBomItem = curBom.CurrentMatchedBomItem;
            if (curMatchBomItem != null && curMatchBomItem.CheckedPart != null && curMatchBomItem.CheckedPart.Count > 0 && curMatchBomItem.Qty == curMatchBomItem.CheckedPart.Count)
            {
                IList<WipBuffer> wipbuffers = (IList<WipBuffer>)CurrentSession.GetValue(Session.SessionKeys.PizzaKitWipBuffer);

                foreach (WipBuffer wipbufobj in wipbuffers)
                {
                    if (PartMatchWipBuffer(wipbufobj.PartNo, curMatchBomItem.AlterParts))
                    {

                        IPalletRepository pltRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
                        IList<KittingLocPLMappingStInfo> kitlocstinfos = pltRepository.GetKitLocPLMapST(Line.Substring(0, 1), stationDescr, short.Parse(wipbufobj.LightNo));
                        if (kitlocstinfos != null && kitlocstinfos.Count > 0)
                        {
                            //only one
                            pltRepository.UpdateKitLocationFVOffDefered(CurrentSession.UnitOfWork, kitlocstinfos[0].tagID, false, true);
                        }

                        break;
                    }
                }

            }
            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// Get Pallet Object and put it into Session.SessionKeys.Pallet
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            string palletNo = (string)CurrentSession.GetValue(Session.SessionKeys.PalletNo);
            IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IProductRepository ProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            List<string> erpara = new List<string>();
            FisException ex;

            int qty= DeliveryRepository.GetSumofDeliveryQtyFromDeliveryPallet( palletNo);
            int qty1 = ProductRepository.GetFactCartonQtyByPalletNo(palletNo);
            if (qty != qty1)
            {
                erpara.Add(palletNo);
                ex = new FisException("CHK878", erpara);
                throw ex;
            }
            IList<IProduct> prodList = ProductRepository.GetProductListByPalletNo2(palletNo);
            if (prodList.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.Product, prodList[0]);
            }
            else
            {
                erpara.Add(palletNo);
                ex = new FisException("CHK878", erpara);
                throw ex;
            }
            //CurrentSession.AddValue(Session.SessionKeys.PalletQty, qty);
            //CurrentSession.AddValue(Session.SessionKeys.PalletNo, palletNo);
            return base.DoExecute(executionContext);
        }
Example #9
0
 protected override ActivityExecutionStatus Execute(ActivityExecutionContext context)
 {
     // Create an Outlook Application object. 
     Outlook.Application outlookApp = new Outlook.Application();
     // Create a new TaskItem.
     Outlook.NoteItem newNote = (Outlook.NoteItem)outlookApp.CreateItem(Outlook.OlItemType.olNoteItem);
     // Configure the task at hand and save it.
     if (this.Parent.Parent is ParallelActivity)
     {
         newNote.Body = (this.Parent.Parent.Parent.Activities[1] as DummyActivity).TitleProperty;
         if ((this.Parent.Parent.Parent.Activities[1] as DummyActivity).TitleProperty != "")
         {
             MessageBox.Show("Creating Outlook Note");
             newNote.Save();
         }
     }
     else if (this.Parent.Parent is SequentialWorkflowActivity)
     {
         newNote.Body = (this.Parent.Parent.Activities[1] as DummyActivity).TitleProperty;
         if ((this.Parent.Parent.Activities[1] as DummyActivity).TitleProperty != "")
         {
             MessageBox.Show("Creating Outlook Note");
             newNote.Save();
         }
     }
     return ActivityExecutionStatus.Closed;
 }
Example #10
0
        /// <summary>
        /// 检查dn是否与机器结合了
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            CurrentSession.AddValue(Session.SessionKeys.DNCombineProduct, false);
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            string inputNo = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
            IList<IProduct> lstProduct = productRepository.GetProductListByDeliveryNo(inputNo);
            if (lstProduct != null && lstProduct.Count != 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.DNCombineProduct, true);
                List<string> productIDList = new List<string>();
                List<string> cartonSNList = new List<string>();
                List<string> productCustSNList = new List<string>();
                foreach (var product in lstProduct)
                {
                    productIDList.Add(product.ProId);
                    cartonSNList.Add(product.CartonSN);
                    //collect customer sn
                    productCustSNList.Add(product.CUSTSN);

                    
                }
                CurrentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList);
                CurrentSession.AddValue(Session.SessionKeys.CartonSNList, cartonSNList);
                CurrentSession.AddValue(Session.SessionKeys.NewScanedProductCustSNList, productCustSNList);
               
            }
           
            
            return base.DoExecute(executionContext);
        }
Example #11
0
 /// <summary>
 /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
 /// </summary>
 /// <param name="executionContext"></param>
 /// <returns></returns>
 protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
 {
     IProduct defaultProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
     string deliveryNo = defaultProduct.DeliveryNo;
     if (deliveryNo=="")
     {
        /* List<string> errpara = new List<string>();
         errpara.Add("no deliveryNo");
         throw new FisException("CHK107", errpara);*/
         return base.DoExecute(executionContext);
     }
     IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
     Delivery CurrentDelivery = DeliveryRepository.Find(deliveryNo);
     if (CurrentDelivery == null)
     {
        /* List<string> errpara = new List<string>();
         errpara.Add(deliveryNo);
         throw new FisException("CHK107", errpara);*/
         return base.DoExecute(executionContext);
     }
     CurrentSession.AddValue(Session.SessionKeys.Delivery, CurrentDelivery);
     if (CurrentDelivery.Status == "98") {
         List<string> errpara = new List<string>();
         errpara.Add("已经上传SAP,不能Unpack!");
         throw new FisException("CHK290", errpara);
     }
     return base.DoExecute(executionContext);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string data = (string)CurrentSession.GetValue("DeliveryNo");
            IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
            bool flag = false;            
            flag = repPizza.CheckExistPakDashPakComnByInternalID(data.Substring(0,10));

            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "DN");
                CurrentSession.AddValue(Session.SessionKeys.DeliveryNo, data.Substring(0, 10));
                return base.DoExecute(executionContext);                
            }
            
            flag = repPizza.CheckExistVShipmentPakComnByConsolInvoiceOrShipment(data);
            if (flag == true)
            {
                CurrentSession.AddValue(Session.SessionKeys.VCode, "Shipment");
                return base.DoExecute(executionContext);                
            }
            
            CurrentSession.AddValue(Session.SessionKeys.VCode, "Unknown");
            List<string> errpara = new List<string>();
            errpara.Add(data);
            FisException ex = new FisException("CHK277", errpara);
            //ex.stopWF = false;
            throw ex;

        }        
Example #13
0
        /// <summary>
        /// 用于Repair时修改Defect信息。
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IRepairTarget repairTarget = GetRepairTarget();
            //IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            //if (product != null)
            //{
            //    string value = (string)CurrentSession.GetValue(Session.SessionKeys.MAC);
            //    product.MAC = value;
            //}

            RepairDefect defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect);

            //Dean 20110530 因為PartType為Disable ,在新增時就要塞入PartType,來判斷是否回F0或40
            const string repairPartType = "";
            if (CurrentSession.GetValue(ExtendSession.SessionKeys.RepairPartType) != null)
            {
                defect.PartType = CurrentSession.GetValue(ExtendSession.SessionKeys.RepairPartType).ToString().Trim();
            }
            else
            {
                defect.PartType = repairPartType.Trim();
            }
            //Dean 20110530 因為PartType為Disable ,在新增時就要塞入PartType,來判斷是否回F0或40

            repairTarget.UpdateRepairDefect(defect.RepairID, defect);
            UpdateRepairTarget(repairTarget);

            return base.DoExecute(executionContext);
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            SPWorkflowActivationProperties ap = __ActivationProperties;
            try
            {
                string name = ap.Workflow.ParentAssociation.Name;
                SPWorkflow wf = ap.Workflow;

                Utils.WriteToHistory(ap, "Sending item to records center");
                SPListItem item = ap.Item;
                SPFile file = ap.Web.GetFile(item.Url);

                string recordSeries = item.ContentType.Name;
                string additionalInformation;
                OfficialFileResult fileResult = file.SendToOfficialFile(recordSeries, out additionalInformation);

                Utils.WriteToHistory(ap, "Sent item to records center:" + additionalInformation);
            }
            catch (Exception ex)
            {
                string sMsg = ex.Message;

                Utils.WriteToHistory(ap, "Send item to records center error:" + sMsg);

                TraceProvider.TraceException("SentToRecordCenter", sMsg);
                Utils.WriteToHistory(__ActivationProperties, "SentToRecordsCenter has generate an exception: " + sMsg);
                throw ex;
            }
            return ActivityExecutionStatus.Closed;
        }
Example #15
0
        /// <summary>
        /// Get QCStatus of Product
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        /// 

        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currentProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            List<string> errpara = new List<string>();
            string productID = currentProduct.ProId;

            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //ProductLog 
            string[] tps = new string[1];
            tps[0] = "PIA2";
            string status = "EFI";  //exemption from inspection
            IList<ProductQCStatus> QCStatusList = new List<ProductQCStatus>();
            QCStatusList = productRepository.GetQCStatusOrderByCdtDesc(productID, tps);
            if (QCStatusList != null && QCStatusList.Count > 0)
            {
                foreach (ProductQCStatus qcStatus in QCStatusList)
                {
                    if (qcStatus.Remark == "1")
                    {
                        status = "EPIA";
                        break;
                    }
                }
            }
            CurrentSession.AddValue(Session.SessionKeys.QCStatus, status);
            return base.DoExecute(executionContext);
        }
Example #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="executionContext"></param>
 /// <returns></returns>
 protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
 {
     IMiscRepository miscRep = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>();
     Session session = CurrentSession;
     IList<DefectComponentInfo> defectComponentInfoList = (IList<DefectComponentInfo>)session.GetValue("DefectComponentInfo");
     foreach (DefectComponentInfo item in defectComponentInfoList)
     {
         DefectComponentLogInfo saveItem = new DefectComponentLogInfo();
         saveItem.ActionName = ActionName;
         saveItem.ComponentID = item.ID;
         saveItem.RepairID = item.RepairID;
         saveItem.PartSn = item.PartSn;
         saveItem.Customer = item.Customer;
         saveItem.Model = item.Model;
         saveItem.Family = item.Family;
         saveItem.DefectCode = item.DefectCode;
         saveItem.DefectDescr = item.DefectDescr;
         saveItem.ReturnLine = item.ReturnLine;
         saveItem.Remark = "";
         saveItem.BatchID = item.BatchID;
         saveItem.Comment = item.Comment;
         saveItem.Status = item.Status;
         saveItem.Editor = this.Editor;
         saveItem.Cdt = DateTime.Now;
         miscRep.InsertDataWithIDDefered<DefectComponentLog, DefectComponentLogInfo>(session.UnitOfWork,saveItem);
     }
     return base.DoExecute(executionContext);
 }
Example #17
0
        /// <summary>
        /// 检查ECR是否存在
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            MB currenMB = CurrentSession.GetValue(Session.SessionKeys.MB) as MB;
            IPartRepository CurrentPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            
            IPart currentPart = CurrentPartRepository.Find(currenMB.Model);
            IEcrVersionRepository CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>();
            if (currentPart ==null ||currentPart.Descr == null)
            {
                throw new FisException("CHK223", new string[] { currenMB.Sn });
            }
            else {
                CurrentSession.AddValue(Session.SessionKeys.FamilyName, currentPart.Descr);
            }
            string ecr = CurrentSession.GetValue(Session.SessionKeys.ECR) as string;

            IList<EcrVersion> ECRList = CurrentRepository.GetECRVersionByFamilyMBCodeAndECR(currentPart.Descr, currenMB.MBCode, ecr);
            if (ECRList == null || ECRList.Count == 0)
            {
                throw new FisException("ICT001", new string[] { currenMB.Sn });
            }
            else {
                CurrentSession.AddValue(Session.SessionKeys.IECVersion, ECRList[0].IECVer);
            }

             CurrentSession.AddValue(Session.SessionKeys.PrintLogName,"ECR Label");
             CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, currenMB.Sn);
             CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, currenMB.Sn);
             CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr,Line+" "+currenMB.PCBModelID);
                               
            return base.DoExecute(executionContext);
        }
Example #18
0
		protected override ActivityExecutionStatus Execute (ActivityExecutionContext executionContext)
		{
			List <Activity> list = new List <Activity> ();
			Activity child = this;

			// Indicate that all children activites can be executed in paralell
			while (child != null) {
				//Console.WriteLine ("Child {0}", child);
				// TODO: if (IsBasedOnType (current, typeof (CompositeActivity))) {
				if (child.GetType ().BaseType == typeof (CompositeActivity)) {
					CompositeActivity composite = (CompositeActivity) child;
					foreach (Activity activity in composite.Activities) {
						list.Add (activity);
					}
				}

				if (list.Count == 0) {
					break;
				}

				child = list [0];
				child.ParallelParent = this;
				list.Remove (child);
			}

			foreach (Activity activity in Activities) {
				ActivitiesToExecute.Enqueue (activity);
			}

			NeedsExecution = false;
			return ActivityExecutionStatus.Closed;
		}
Example #19
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            var palletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            IList<PickIDCtrlInfo> lstPickIDCtrlInfo = palletRepository.GetPickIDCtrlInfoByPickID(Key);
            PickIDCtrlInfo pickIDCtrlInfo;

            if (lstPickIDCtrlInfo == null || lstPickIDCtrlInfo.Count == 0)
            {
                List<string> errpara = new List<string>();
                errpara.Add(this.Key);
                throw new FisException("CHK149", errpara);
            }

            pickIDCtrlInfo = lstPickIDCtrlInfo[0];
            //ITC-1268-0052 Tong.Zhi-Yong 2011-04-14
            lstPickIDCtrlInfo = palletRepository.GetPickIDCtrlInfoByPickIDAndDate(Key, DateTime.Now);

            if (lstPickIDCtrlInfo != null && lstPickIDCtrlInfo.Count != 0)
            {
                pickIDCtrlInfo = lstPickIDCtrlInfo[0];
            }

            CurrentSession.AddValue(Session.SessionKeys.PickIDCtrl, pickIDCtrlInfo);

            return base.DoExecute(executionContext);
        }
        public virtual void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext)
        {
            if (executionContext == null)
                throw new ArgumentNullException("executionContext");

            NextDynamicChangeExecutorInChain(executionContext.Activity).OnWorkflowChangesCompleted(executionContext);
        }
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currentProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            bool isHasDefect = (bool)CurrentSession.GetValue(Session.SessionKeys.HasDefect);
            List<string> errpara = new List<string>();
            string productID = currentProduct.ProId;

            IProductRepository repProduct = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //ProductLog 
            string[] tps = new string[2];
            tps[0] = "PIA";
            tps[1]= "PIA1";
            IList<ProductQCStatus> QCStatusList = new List<ProductQCStatus>();
            QCStatusList = repProduct.GetQCStatusOrderByUdtDesc(productID, tps);
            if (QCStatusList != null && QCStatusList.Count > 0)
            {
                ProductQCStatus qcStatus = QCStatusList[0];
                if ((qcStatus.Status == "3" || qcStatus.Status == "6") && isHasDefect==false)
                {
                    //errpara.Add("pia再刷output一定要帶defect.");
                    FisException ex = new FisException("CHK260", errpara);
                    ex.stopWF = false;
                    throw ex;
                }
            }

            return base.DoExecute(executionContext);
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            MembershipUser memUser = Membership.GetUser(this.UserGuid);

            //aspnet_User user = db.aspnet_Users.Single(u => u.LoweredUserName == this._UserName && u.ApplicationId == DatabaseHelper.ApplicationGuid);
            aspnet_User user = DatabaseHelper.GetSingle<aspnet_User, string>(DatabaseHelper.SubsystemEnum.User,
                memUser.UserName, LinqQueries.CompiledQuery_GetUserFromUserName);

            using (TransactionScope ts = new TransactionScope())
            {
                //update user email
                memUser.Email = this.NewEmail;
                Membership.UpdateUser(memUser);

                //update username
                if (!string.Equals(memUser.UserName, this.NewEmail))
                {
                    user.UserName = this.NewEmail;
                    user.LoweredUserName = this.NewEmail.ToLower();
                }

                DatabaseHelper.UpdateObject<aspnet_User>(DatabaseHelper.SubsystemEnum.User,
                    user, null, null);

                ts.Complete();
            }

            return ActivityExecutionStatus.Closed;
        }
Example #23
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //logger.InfoFormat("GetProductActivity: Key: {0}", this.Key);
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            //var currentProduct = productRepository.Find(this.Key);
            //var currentProductCustSN = productRepository.FindOneProductWithProductIDOrCustSN(this.Key);
            var product = productRepository.GetProductByCustomSn(this.Key);

            if (product == null)
            {
                List<string> errpara = new List<string>();

                errpara.Add(this.Key);

                throw new FisException("CHK152", errpara);
            }
            //logger.InfoFormat("GetProductActivity: IProduct Hash: {0}; IProduct Key: {1}", currentProduct.GetHashCode().ToString(), currentProduct.Key);
            
            CurrentSession.AddValue(Session.SessionKeys.CustSN, this.Key);
            //add by sheng-ju for FRU 20110907
            CurrentSession.AddValue(Session.SessionKeys.ProductIDOrCustSN,product.ProId);
            CurrentSession.AddValue(Session.SessionKeys.Product, product);

            //logger.InfoFormat("GetProductActivity: CurrentSession Hash: {0}; CurrentSession Key: {1}; CurrentSession Type: {2}", CurrentSession.GetHashCode().ToString(), CurrentSession.Key, CurrentSession.Type.ToString());
            
            return base.DoExecute(executionContext);
        }
Example #24
0
        /// <summary>
        /// Get Bom and put it into Session.SessionKeys.SessionBom
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //获取当前站要刷的BOM,此时BOM是空的
            var sessionBOM = this.GetSessionBOM();
            //var owner = GetPartOwner();
            //if (owner != null)
            //{
            //    IList<IProductPart> parts = owner.GetProductPartByStation(this.Station);
            //    {
            //        ////获取当前站已刷的Part并加入BOM中
            //        foreach (var part in parts)
            //        {
            //            var matchedPart = sessionBOM.Match(part.Value, Station);
            //            if (matchedPart != null)
            //            {
            //                sessionBOM.AddCheckedPart(matchedPart);
            //            }
            //        }
            //    }
            //}

            CurrentSession.AddValue(Session.SessionKeys.SessionBom, sessionBOM);
            CurrentSession.AddValue("ClearBom", sessionBOM);

            return base.DoExecute(executionContext);
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) {

            AddressServiceInterface.VerifyAddress(AddressToVerify);

            return ActivityExecutionStatus.Closed;

        }
Example #26
0
        /// <summary>
        /// Check RMN
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            if (curProduct == null)
            {
                List<string> errpara = new List<string>();
                errpara.Add(this.Key);
                throw new FisException("SFC002", errpara);
            }

            // OfflinePizzaFamily : 是否需要Pizza Id及 PizzaID Label(不需要打印)
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            string keyOfflinePizzaFamily = "OfflinePizzaFamily";

            string isOfflinePizzaFamily = "N";
            IList<ConstValueTypeInfo> lstCnst = partRepository.GetConstValueTypeList(keyOfflinePizzaFamily);
            foreach (ConstValueTypeInfo cv in lstCnst)
            {
                if (cv.value.Equals(curProduct.Family))
                {
                    isOfflinePizzaFamily = "Y";
                    break;
                }
            }

            CurrentSession.AddValue(keyOfflinePizzaFamily, isOfflinePizzaFamily);

            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// Called by the workflow runtime to execute an activity.
        /// </summary>
        /// <param name="executionContext">The <see cref="T:Mediachase.Commerce.WorkflowCompatibility.ActivityExecutionContext"/> to associate with this <see cref="T:Mediachase.Commerce.WorkflowCompatibility.Activity"/> and execution.</param>
        /// <returns>
        /// The <see cref="T:Mediachase.Commerce.WorkflowCompatibility.ActivityExecutionStatus"/> of the run task, which determines whether the activity remains in the executing state, or transitions to the closed state.
        /// </returns>
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            try
            {
                // Check for multiple warehouses. In the default, we simply reject processing an order if the application has
                //  multiple warehouses. Any corresponding fulfillment process is the responsibility of the client.
                this.CheckMultiWarehouse();

                // Validate the properties at runtime
                this.ValidateRuntime();

                var orderForms = OrderGroup.OrderForms.Where(o => !OrderForm.IsReturnOrderForm(o));

                foreach (OrderForm orderForm in orderForms)
                {
                    foreach (Shipment shipment in orderForm.Shipments)
                    {
                        foreach (var lineItem in Shipment.GetShipmentLineItems(shipment))
                        {
                            AdjustStockItemQuantity(shipment, lineItem);
                        }
                    }
                }

                // Retun the closed status indicating that this activity is complete.
                return ActivityExecutionStatus.Closed;
            }
            catch
            {
                // An unhandled exception occured.  Throw it back to the WorkflowRuntime.
                throw;
            }
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            string pageName = this.PageName;

            List<Page> userPages = DatabaseHelper.GetList<Page, Guid>(DatabaseHelper.SubsystemEnum.Page,
                this.UserGuid, LinqQueries.CompiledQuery_GetPagesByUserId);

            // Find the page that has the specified Page Name and make it as current
            // page. This is needed to make a tab as current tab when the tab name is
            // known
            if (!string.IsNullOrEmpty(pageName))
            {

                foreach (Page page in userPages)
                {
                    if (page.Title.Replace(' ', '_') == pageName)
                    {
                        this.CurrentPageId = page.ID;
                        this.CurrentPage = page;
                        break;
                    }
                }
            }

            // If there's no such page, then the first page user has will be the current
            // page. This happens when a page is deleted.
            if (this.CurrentPageId == 0)
            {
                this.CurrentPageId = userPages[0].ID;
                this.CurrentPage = userPages[0];
            }

            return ActivityExecutionStatus.Closed;
        }
Example #29
0
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product));
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IDeliveryRepository deliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            string unpackType = ((string)CurrentSession.GetValue(Session.SessionKeys.CN));
            bool isPallet = ((bool)CurrentSession.GetValue(Session.SessionKeys.Pallet));
            productRepository.BackUpProduct(currentProduct.ProId,this.Editor);

            ShipBoxDetInfo setValue = new ShipBoxDetInfo();
            ShipBoxDetInfo condition = new ShipBoxDetInfo();
            setValue.snoId = "";
            condition.snoId = currentProduct.ProId;

            deliveryRepository.UpdateShipBoxDetInfo(setValue, condition);

            if (unpackType == "ALL")
            {
                currentProduct.PizzaID = string.Empty;
                currentProduct.CartonSN = string.Empty;
            }
            currentProduct.PalletNo = string.Empty;
            if (!isPallet)
            {
                currentProduct.DeliveryNo = string.Empty;
            }
            currentProduct.CartonWeight = 0;
            currentProduct.UnitWeight = 0;

            productRepository.Update(currentProduct, CurrentSession.UnitOfWork);

            productRepository.BackUpProductStatus(currentProduct.ProId, this.Editor);

            return base.DoExecute(executionContext);
        }
Example #30
0
        /// <summary>
        /// 判断是否是Product回流机器
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currenProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);

            bool isBackflowProductFlag = false;

            //select @RepairID = ID from ProductRepair nolock where ProductID = @PrdID order by Udt desc
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            int repairId = productRepository.GetNewestProductRepairIdRegardlessStatus(currenProduct.ProId);

            //select distinct Cause from ProductRepair_DefectInfo where ProductRepairID = @RepairID
            IList<string> causeLst = productRepository.GetCauseListByProductRepairId(repairId);

            if ((causeLst != null) && (causeLst.Count == 1))
            {
                if ((causeLst[0].Substring(0, 2).ToUpper() == "CN") || (causeLst[0].Substring(0, 2).ToUpper() == "WW"))
                {
                    isBackflowProductFlag = true;
                }
            }

            CurrentSession.AddValue("IsBackflowProduct", isBackflowProductFlag);

            return base.DoExecute(executionContext);
        }
Example #31
0
 protected virtual Task <ActivityExecutionResult> OnResumeAsync(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) => Task.FromResult(OnResume(activityContext, workflowContext));
Example #32
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite sitecollection = new SPSite(Url))
                {
                    using (SPWeb web = sitecollection.OpenWeb())
                    {
                        SPList list           = web.Lists["Aufgaben"];
                        SPListItem listitem   = list.Items.Add();
                        SPContentType ConType = list.ContentTypes[ContentType.ToString()];

                        if (ConType != null)
                        {
                            listitem["ContentTypeId"] = ConType.Id;
                        }

                        if (!String.IsNullOrEmpty(Title) & listitem.Fields.ContainsField("Title"))
                        {
                            listitem["Title"] = Title.ToString();
                        }

                        if (!String.IsNullOrEmpty(Descript) & (listitem.Fields.ContainsField("Beschreibung") | listitem.Fields.ContainsField("Body")))
                        {
                            listitem["Beschreibung"] = Descript.ToString();
                        }

                        if (!String.IsNullOrEmpty(Link) & listitem.Fields.ContainsField("Link"))
                        {
                            LinkFieldValue lfValue = new LinkFieldValue();
                            lfValue.NavigateUrl    = Link.ToString();
                            lfValue.Text           = "Link zu Dokument";
                            lfValue.UseDefaultIcon = false;

                            listitem["Link"] = lfValue;
                        }

                        if (!String.IsNullOrEmpty(AccountName) & listitem.Fields.ContainsField("AssignedTo"))
                        {
                            SPUserCollection users = web.Users;
                            SPUser user            = UserExists(users, AccountName.ToString());

                            if (user != null)
                            {
                                listitem["AssignedTo"] = user;
                            }
                            else
                            {
                                SPGroupCollection groups = web.Groups;

                                if (GroupExists(groups, AccountName.ToString()))
                                {
                                    listitem["AssignedTo"] = web.Groups[AccountName.ToString()];
                                }
                            }
                        }

                        if (!String.IsNullOrEmpty(Quelle) & listitem.Fields.ContainsField("Aufgabenquelle"))
                        {
                            listitem["Aufgabenquelle"] = Quelle.ToString();
                        }

                        if ((TargetDate.ToString() != string.Empty) & (listitem.Fields.ContainsField("DueDate")))
                        {
                            listitem["DueDate"] = TargetDate;
                        }

                        if (listitem.Fields.ContainsField("WorkflowID"))
                        {
                            listitem["WorkflowID"] = WorkflowID;
                        }

                        listitem.Update();
                        TaskID = listitem.ID;
                    }
                }
            });
            return(base.Execute(executionContext));
        }
Example #33
0
 private static string GetUserAction(ActivityExecutionContext context) => (string)context.Input !;
Example #34
0
        protected override bool OnCanExecute(ActivityExecutionContext context)
        {
            var userAction = GetUserAction(context);

            return(Actions.Contains(userAction, StringComparer.OrdinalIgnoreCase));
        }
Example #35
0
        private static void ExecuteStateFinalization(ActivityExecutionContext context, StateFinalizationActivity stateFinalization)
        {
            StateMachineExecutionState executionState = GetExecutionState(context);

            ExecuteChild(context, stateFinalization);
        }
Example #36
0
 public async Task <T?> EvaluateAsync <T>(string?expression, string syntax, ActivityExecutionContext context, CancellationToken cancellationToken = default) =>
 (T)(await EvaluateAsync(expression, syntax, typeof(T), context, cancellationToken)) !;
Example #37
0
        public async Task <Result <T?> > TryEvaluateAsync <T>(string?expression, string syntax, ActivityExecutionContext context, CancellationToken cancellationToken = default)
        {
            try
            {
                var result = await EvaluateAsync <T>(expression, syntax, context, cancellationToken);

                return(Result.Success(result));
            }
            catch
            {
                return(Result.Failure <T?>());
            }
        }
Example #38
0
 private IActivityExecutionResult ExecuteInternal(ActivityExecutionContext context)
 {
     Output = context.GetInput <HttpRequestModel>();
     return(Done());
 }
Example #39
0
 internal void Unsubscribe(ActivityExecutionContext context, IEventActivity eventActivity)
 {
     eventActivity.Unsubscribe(context, this);
 }
Example #40
0
 protected override void Enqueue(ActivityExecutionContext context)
 {
     StateMachineExecutionState.Get(StateMachineHelpers.GetRootState((StateActivity)context.Activity)).SubscriptionManager.Enqueue(context, this.QueueName);
 }
 // Token: 0x060011FB RID: 4603 RVA: 0x0001A0B6 File Offset: 0x000190B6
 protected internal override void Execute(ActivityExecutionContext context)
 {
     InternalLobby.Get().AcceptInvite();
 }
Example #42
0
 // Token: 0x0600139E RID: 5022 RVA: 0x0001C7BB File Offset: 0x0001B7BB
 protected internal override void Execute(ActivityExecutionContext context)
 {
     base.Entrant.Opponent.Vehicle.RepairTires(this.time);
 }
Example #43
0
        internal static void ExecuteState(ActivityExecutionContext context, StateActivity state)
        {
            StateMachineExecutionState executionState = GetExecutionState(context);

            ExecuteChild(context, state);
        }
Example #44
0
        /// <summary>
        /// Called when an exception is raised within the context of the execution of this instance.
        /// </summary>
        /// <param name="executionContext">The <see cref="T:System.Workflow.ComponentModel.ActivityExecutionContext"/> for this instance.</param>
        /// <param name="exception">The <see cref="T:System.Exception"/> that caused this fault.</param>
        /// <returns>
        /// The <see cref="T:System.Workflow.ComponentModel.ActivityExecutionStatus"/> resulting from an attempt to cancel this instance.
        /// </returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///     <paramref name="executionContext"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="T:System.ArgumentNullException">
        ///     <paramref name="exception"/> is a null reference (Nothing).</exception>
        protected override ActivityExecutionStatus HandleFault(ActivityExecutionContext executionContext, Exception exception)
        {
            SubSiteCreationException applicationException = new SubSiteCreationException(Resources.ErrorInCreateSubSiteActivity, exception);

            return(base.HandleFault(executionContext, applicationException));
        }
Example #45
0
        protected internal override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            TypedOperationInfo serviceOperationInfo = this.ServiceOperationInfo;

            if (serviceOperationInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new InvalidOperationException(SR2.GetString(SR2.Error_ServiceOperationInfoNotSpecified, this.Name)));
            }

            MethodInfo methodInfo = serviceOperationInfo.GetMethodInfo(executionContext);

            if (methodInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new InvalidOperationException(SR2.GetString(SR2.Error_MethodInfoNotAvailable, this.Name)));
            }

            ChannelToken channelToken = this.ChannelToken;

            LogicalChannel logicalChannel = ChannelToken.Register(this, channelToken, serviceOperationInfo.ContractType);

            if (!logicalChannel.Initialized)
            {
                logicalChannel.Initialize(channelToken.EndpointName, this.CustomAddress);
            }

            using (ChannelManagerService.ChannelTicket leasedChannel = ChannelManagerService.Take(executionContext, this.WorkflowInstanceId, logicalChannel))
            {
                using (OperationContextScope scope = new OperationContextScope((IContextChannel)leasedChannel.Channel))
                {
                    EventHandler <SendActivityEventArgs>[] invocationList = this.GetInvocationList <EventHandler <SendActivityEventArgs> >(SendActivity.BeforeSendEvent);
                    if (invocationList != null && invocationList.Length > 0)
                    {
                        base.RaiseGenericEvent(SendActivity.BeforeSendEvent, this, new SendActivityEventArgs(this));
                    }

                    SendOperationInfoHelper            helper   = this.OperationHelper;
                    WorkflowParameterBindingCollection bindings = this.ParameterBindings;

                    object[] parameters  = helper.GetInputs(this, bindings);
                    object   returnValue = null;

                    bool isSessionless  = ChannelManagerHelpers.IsSessionlessContract(logicalChannel.ContractType);
                    bool hasContext     = (logicalChannel.Context != null && logicalChannel.Context.Count > 0);
                    bool fatalException = false;

                    if (!isSessionless && hasContext)
                    {
                        ChannelManagerService.ApplyLogicalChannelContext(logicalChannel);
                    }

                    try
                    {
                        returnValue = this.InvokeOperation(methodInfo, leasedChannel.Channel, parameters);
                    }
                    catch (Exception exception)
                    {
                        if (Fx.IsFatal(exception))
                        {
                            fatalException = true;
                        }
                        throw;
                    }
                    finally
                    {
                        if (!fatalException &&
                            !hasContext && !isSessionless && !helper.IsOneWay)
                        {
                            ChannelManagerService.UpdateLogicalChannelContext(logicalChannel);
                        }
                    }

                    helper.PopulateOutputs(this, bindings, parameters, returnValue);

                    invocationList = this.GetInvocationList <EventHandler <SendActivityEventArgs> >(SendActivity.AfterResponseEvent);
                    if (invocationList != null && invocationList.Length > 0)
                    {
                        base.RaiseGenericEvent(SendActivity.AfterResponseEvent, this, new SendActivityEventArgs(this));
                    }
                }
            }

            return(ActivityExecutionStatus.Closed);
        }
Example #46
0
 public Task <bool> CanExecuteAsync(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) => OnCanExecuteAsync(activityContext, workflowContext, cancellationToken);
Example #47
0
 protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) => Suspend();
Example #48
0
 protected virtual Task <bool> OnCanExecuteAsync(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) => OnCanExecuteAsync((T)activityContext.Activity, workflowContext, cancellationToken);
Example #49
0
 // Token: 0x0600138B RID: 5003 RVA: 0x0001C519 File Offset: 0x0001B519
 protected internal override void Execute(ActivityExecutionContext context)
 {
     base.Entrant.Prepare(base.Event);
 }
Example #50
0
 /// <summary>
 /// The execution method for the activity.
 /// </summary>
 /// <param name="executionContext">The execution context.</param>
 /// <returns>The execution status.</returns>
 protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
 {
     // Fetch nth element and store it in local output variable.
     Sequence = SequenceList[Index];
     return(ActivityExecutionStatus.Closed);
 }
Example #51
0
 public Task <ActivityExecutionResult> ResumeAsync(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) => OnResumeAsync(activityContext, workflowContext, cancellationToken);
Example #52
0
 protected override bool OnCanExecute(ActivityExecutionContext context) => Message != null;
Example #53
0
 protected virtual Task <ActivityExecutionResult> OnHaltedAsync(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) => OnHaltedAsync((T)activityContext.Activity, workflowContext, cancellationToken);
Example #54
0
 protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) => context.IsFirstPass ? OnExecuteInternal(context) : Suspend();
Example #55
0
 protected virtual bool OnCanExecute(ActivityExecutionContext activityContext, WorkflowExecutionContext workflowContext) => OnCanExecute((T)activityContext.Activity, workflowContext);
Example #56
0
 protected override IActivityExecutionResult OnResume(ActivityExecutionContext context) => OnExecuteInternal(context);
Example #57
0
 // Token: 0x06001357 RID: 4951 RVA: 0x0001BF03 File Offset: 0x0001AF03
 protected override void OnExecute(ActivityExecutionContext context)
 {
 }
Example #58
0
        private void HandleChildActivityClosed(object sender, ActivityExecutionStatusChangedEventArgs eventArgs)
        {
            ActivityExecutionContext context = sender as ActivityExecutionContext;

            if (context == null)
            {
                throw new ArgumentException(SR.Error_SenderMustBeActivityExecutionContext, "sender");
            }
            if (eventArgs == null)
            {
                throw new ArgumentNullException("eventArgs");
            }

            Activity      completedChildActivity = eventArgs.Activity;
            StateActivity state = (StateActivity)context.Activity;

            StateMachineExecutionState executionState = GetExecutionState(context);

            executionState.SchedulerBusy = false;

            CleanupChildAtClosure(context, completedChildActivity);
            switch (state.ExecutionStatus)
            {
            case ActivityExecutionStatus.Canceling:
            case ActivityExecutionStatus.Faulting:
                context.CloseActivity();
                return;

            case ActivityExecutionStatus.Executing:
                if (completedChildActivity is EventDrivenActivity)
                {
                    HandleEventDrivenCompleted(context);
                    return;
                }

                StateInitializationActivity stateInitialization = completedChildActivity as StateInitializationActivity;
                if (stateInitialization != null)
                {
                    HandleStateInitializationCompleted(context, stateInitialization);
                    return;
                }

                if (completedChildActivity is StateFinalizationActivity)
                {
                    HandleStateFinalizationCompleted(context);
                    return;
                }

                if (completedChildActivity is StateActivity)
                {
                    HandleSubStateCompleted(context);
                    return;
                }

                InvalidChildActivity(state);
                break;

            default:
                throw new InvalidOperationException(SR.GetInvalidActivityStatus(context.Activity));
            }
        }
Example #59
0
 public ActivityExecuted(bool resuming, ActivityExecutionContext activityExecutionContext) : base(activityExecutionContext) => Resuming = resuming;
Example #60
0
 protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
 {
     DnaOrRnaOutput = Complementation.Complement(DnaOrRnaInput);
     return(ActivityExecutionStatus.Closed);
 }