Exemple #1
1
 public static void DoWithSwDoc(SldWorks swApp, CompType docType, string docId, Act doWithDoc)
 {   
     var doc = swApp.IActiveDoc2;            
     var select = doc.Extension.SelectByID2(docId + "@" + doc.GetTitle(), DocCompName(docType), 0, 0, 0, true, 0, null, 0);
     if (!select) return;
     
     if (doWithDoc == Act.DoNothing)
     {
         doc.ClearSelection2(true);
         return;
     }
     switch (doWithDoc)
     {
         case Act.Delete:
             doc.EditDelete();
             break;
         case Act.DeletWithOption:
             const int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed +
                                         (int)swDeleteSelectionOptions_e.swDelete_Children;
             doc.Extension.DeleteSelection2(deleteOption);
             break;
         case Act.Unsuppress:
             doc.EditUnsuppress2();
             break;
         case Act.Suppress:
             doc.EditSuppress2();
             break;
         default:
             break;
     }
     doc.ClearSelection2(true);
 }
 public ISubscription andThen(Act action)
 {
     return new Subscription(() => {
     unsubscribe();
     action();
       });
 }
Exemple #3
0
 public ForLoop(Act child, int iters, bool breakOnSuccess)
 {
     Name = "For(" + iters + ")";
     Iters = iters;
     Child = child;
     BreakOnSuccess = breakOnSuccess;
 }
		public SelectTargetUiBlock(TurnMessageUiBlock _messages, Rct _mapRct, AskMessage _message)
			: base(_mapRct, null, FColor.Gray)
		{
			m_messages = _messages;
			m_act = _message.Act;
			m_maxDistance = _message.GetFirstParameter<int>();
			var points = new List<Point>();

			for (var x = -m_maxDistance; x < m_maxDistance; ++x)
			{
				for (var y = -m_maxDistance; y < m_maxDistance; ++y)
				{
					var point = new Point(x, y);
					if (point.Lenght > m_maxDistance) continue;

					var liveCell = World.TheWorld.Avatar[point];
					if (liveCell.Creature != null && !liveCell.Creature.IsAvatar)
					{
						points.Add(point);
					}
				}
			}

			m_targets.AddRange(points.Where(_point => _point.Lenght < m_maxDistance).OrderBy(_point => _point.Lenght));

			Rebuild();
		}
Exemple #5
0
 public static long GetActMatsCount(Act act)
 {
     var matSno = 0;
     switch (act)
     {
         case Act.A1:
             matSno = Act1BountyMatSNO;
             break;
         case Act.A2:
             matSno = Act2BountyMatSNO;
             break;
         case Act.A3:
             matSno = Act3BountyMatSNO;
             break;
         case Act.A4:
             matSno = Act4BountyMatSNO;
             break;
         case Act.A5:
             matSno = Act5BountyMatSNO;
             break;
     }
     var stashCount = ZetaDia.Me.Inventory.StashItems.Where(i => i.IsValid && i.ActorSNO == matSno).Sum(i => i.ItemStackQuantity);
     var backpackCount = ZetaDia.Me.Inventory.Backpack.Where(i => i.IsValid && i.ActorSNO == matSno).Sum(i => i.ItemStackQuantity);
     return stashCount + backpackCount;
 }
		public SelectDestinationUiBlock(TurnMessageUiBlock _messages, Rct _mapRct, Act _act)
			: base(_mapRct, null, FColor.Gray)
		{
			m_messages = _messages;
			m_act = _act;
			Rebuild();
		}
 public VictimsWindow (Act act, Gtk.Window parent) : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     this.TransientFor = parent;
     this.Modal = true;
     this.act = act;
     Initialize ();
 }
 public ActDetailWindow (Act act, Gtk.Window parent) : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     this.Modal = true;
     this.TransientFor = parent;
     show.Act = act;
     show.IsEditable = false;
     show.HideActionButtons ();
 }
        public ActDetailWindow (Act act, EventHandler OnSave, Gtk.Window parent) : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();
            this.Modal = true;
            this.OnSaved = OnSave;
            this.TransientFor = parent;

            show.Act = act;
            show.IsEditable = false;
        }
 public VictimWindow (Act act, VictimEventHandler handler, Gtk.Window parent) : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     this.Modal = true;
     show.Victim = new Victim();
     show.Victim.Act = act;
     show.IsEditable = true;
     OnSaveOrUpdate = handler;
     this.TransientFor = parent;
 }
		protected ItemsSelectorUiBlock(Rct _rct,
		                               ESelectItemDialogBehavior _behavior,
		                               Act _act,
		                               IEnumerable<EssenceDescriptor> _descriptors)
			: base(_rct, Frame.Frame2, FColor.Green)
		{
			m_behavior = _behavior;
			m_act = _act;
			m_currentFilter = '*';
			m_descriptors = _descriptors;
		}
Exemple #12
0
		public void Walk(Folder folder, Act act)
		{
			foreach(Folder f in folder.Folders)
			{
				Walk(f, act);
			}
			
			foreach(DocumentNode node in folder.Documents)
			{
				act(node);
			}
		}
        protected static void Consume(Act message, NuclearStorage storage)
        {
            new TransactionTester
                {
                    OnCommit = () =>
                        {
                            var singleton = storage.AddOrUpdateSingleton(() => 1, i => i + 1);
                            Trace.WriteLine("Commit kicked " + singleton);
                        }
                };

            if (message.Fail)
                throw new InvalidOperationException("Fail requested");
        }
 public static List<BountyCoroutine> GetActBounties(Act act)
 {
     IEnumerable<BountyInfo> gameActBounties;
     if (act == Act.OpenWorld)
     {
         gameActBounties = ZetaDia.ActInfo.Bounties.Where(b => b.State != QuestState.Completed).OrderBy(b => b.Act);
     }
     else
     {
         gameActBounties = ZetaDia.ActInfo.Bounties.Where(b => b.Act == act && b.State != QuestState.Completed);
     }
     var actBounties = new List<BountyCoroutine>();
     actBounties.AddRange(gameActBounties.Select(GetBounty).Where(bounty => bounty != null));
     return actBounties;
 }
Exemple #15
0
        private void ResetAll()
        {
            _isDone = false;
            _currentAct = Act.Invalid;
            _currentActBountiesCoroutine = null;
            _acts = new List<Act>();
            _completedActs = new List<Act>();
            if (PluginSettings.Current.BountyAct1) _acts.Add(Act.A1);
            if (PluginSettings.Current.BountyAct2) _acts.Add(Act.A2);
            if (PluginSettings.Current.BountyAct3) _acts.Add(Act.A3);
            if (PluginSettings.Current.BountyAct4) _acts.Add(Act.A4);
            if (PluginSettings.Current.BountyAct5) _acts.Add(Act.A5);
            //_acts = new List<Act> { Act.A1, Act.A2, Act.A3, Act.A4, Act.A5 };

        }
        /// <summary>
        /// Refreshes the town run variables based on current act
        /// </summary>
        internal static RunStatus ActionsEvaluatedBehavior(object ret)
        {
            Navigator.Clear();
            Navigator.SearchGridProvider.Update();
            MovedToSafetyLocation = false;

            if (FunkyGame.AdventureMode)
                CurrentAct = GameCache.FindActByTownLevelAreaID(ZetaDia.CurrentLevelAreaId);
            else
                CurrentAct = ZetaDia.CurrentAct;

            switch (CurrentAct)
            {
                case Act.A1:
                    VendorName = "a1_uniquevendor_miner"; break;
                case Act.A2:
                    VendorName = "a2_uniquevendor_peddler"; break;
                case Act.A3:
                    VendorName = "a3_uniquevendor_collector"; break;
                case Act.A4:
                    VendorName = "a4_uniquevendor_collector"; break;
                case Act.A5:
                    VendorName = "x1_a5_uniquevendor_collector"; break;
            }

            RequiresRepair = Equipment.ShouldRepairItems(CharacterSettings.Instance.RepairWhenDurabilityBelow);
            SafetyVendorLocation = GameCache.ReturnTownRunMovementVector(GameCache.TownRunBehavior.Sell, CurrentAct);
            SafetySalvageLocation = GameCache.ReturnTownRunMovementVector(GameCache.TownRunBehavior.Salvage, CurrentAct);
            SafetyStashLocation = GameCache.ReturnTownRunMovementVector(GameCache.TownRunBehavior.Stash, CurrentAct);
            SafetyIdenifyLocation = GameCache.ReturnTownRunMovementVector(GameCache.TownRunBehavior.Idenify, CurrentAct);
            SafetyGambleLocation = GameCache.ReturnTownRunMovementVector(GameCache.TownRunBehavior.Gamble, CurrentAct);

            //Clear our item cache
            Backpack.ClearBackpackItemCache();

            bSalvageAllMagic = false;
            bSalvageAllNormal = false;
            bSalvageAllRare = false;

            FunkyGame.Bounty.RefreshActiveQuests();

            FunkyTownRunPlugin.DBLog.DebugFormat("Current Act: {0} VendorName: {1} Requires Repair: {2}", CurrentAct, VendorName, RequiresRepair);

            ActionsChecked = true;
            return RunStatus.Success;
        }
		private void WalkQueue(Queue queue, Act act)
		{
			while(queue.Count != 0)
			{
				Folder node = (Folder) queue.Dequeue();
				
				foreach(DocumentNode n in node.Documents)
				{
					act(n);
				}
								
				foreach(Folder child in node.Folders)
				{
					queue.Enqueue(child);
				}
			}
		}
        /// <summary>
        /// Do an action.
        /// </summary>
        /// <param name='action'>
        /// Action.
        /// </param>
        public void Do(Act action)
        {
            if (!Should(action)) return;

            var app = this;
            switch (action) {
                case Act.AnalyzeHorizontal: AnalyzeAction.AnalyzeHorizontal(app); return;
                case Act.AnalyzeVertical: AnalyzeAction.AnalyzeVertical(app); return;
                case Act.AnalyzeIslands: AnalyzeAction.AnalyzeIslands(app); return;
                case Act.Analyze: AnalyzeAction.Analyze(app); return;
                case Act.Clean: CleanAction.Clean(app); return;
                case Act.RemoveBackground: RemoveBackgroundAction.RemoveBackground(app); return;
                case Act.CopyToClipboard: CopyToClipboardAction.CopyToClipboard(app); return;
                case Act.RefreshIslandsOutputAction: RefreshIslandsOutputAction.Refresh(app); return;
                case Act.Process: ProcessAction.Process(app); return;
            }

            #if DEBUG
            throw new NotImplementedException(action.ToString());
            #endif
        }
Exemple #19
0
        static void Main(string[] args)
        {
            StringDelegate del = null;
            
            del += Down;
            del += Up;

            var st = "Hello";
            Print(st, del);
            //
            st = "World";
            Print(st, del);

            Act act = null;
            act += new Act(Act1);
            act += Act2;
            Do(act);

            act -= new Act(Act1);
            Do(act);

            Do(new Act(delegate 
                {
                    //act();
                    Console.WriteLine("Anonimous delegate");
                }));

            Do2(Console.WriteLine);

            Do2(new ActStr(delegate(string s)
                {
                    Console.WriteLine(s.ToUpper());
                }));

            Do(() => { Console.WriteLine("Simple Lambda"); });

            Do2(x => Console.WriteLine(x));

            Do3((s1, s2) => { });
        }
        internal static RunStatus ActionsEvaluatedBehavior(object ret)
        {
            //Player.UpdatePotions();
            //townRunItemCache.UpdateLists(Player.CacheItemList.Values.ToList());
            //FunkyTownRunPlugin.DBLog.Info(townRunItemCache.GetListString());
            Navigator.Clear();
            Navigator.SearchGridProvider.Update();

            MovedToSafetyLocation = false;
            //CurrentQuestSNO = GetQuestSNO();
            //IsInAdventureMode = (CurrentQuestSNO == 312429);
            CurrentAct = FindActByLevelID(ZetaDia.CurrentLevelAreaId);
            switch (CurrentAct)
            {
                case Act.A1:
                    VendorName = "a1_uniquevendor_miner"; break;
                case Act.A2:
                    VendorName = "a2_uniquevendor_peddler"; break;
                case Act.A3:
                    VendorName = "a3_uniquevendor_collector"; break;
                case Act.A4:
                    VendorName = "a4_uniquevendor_collector"; break;
                case Act.A5:
                    VendorName = "x1_a5_uniquevendor_collector"; break;
            }
            RequiresRepair = Backpack.ShouldRepairItems();
            SafetyVendorLocation = ReturnMovementVector(TownRunBehavior.Sell, CurrentAct);
            SafetySalvageLocation = ReturnMovementVector(TownRunBehavior.Salvage, CurrentAct);
            SafetyStashLocation = ReturnMovementVector(TownRunBehavior.Stash, CurrentAct);
            SafetyIdenifyLocation = ReturnMovementVector(TownRunBehavior.Idenify, CurrentAct);
            SafetyGambleLocation = ReturnMovementVector(TownRunBehavior.Gamble, CurrentAct);

            //Clear our item cache
            Backpack.CacheItemList.Clear();

            FunkyTownRunPlugin.DBLog.DebugFormat("Current Act: {0} VendorName: {1} Requires Repair: {2}", CurrentAct, VendorName, RequiresRepair);
            ActionsChecked = true;
            return RunStatus.Success;
        }
    private void Start()
    {
        mDataDoc.Load("SceneBreakdown.xml");
        if (mDataDoc.ChildNodes.Count != 1)
        {
            Debug.Log("Data file did not load.");
        }

        //loop acts and add to script
        XmlNodeList actsNodeList = mDataDoc.SelectNodes("script/act");
        Debug.Log("loading " + actsNodeList.Count + " acts...");
        foreach (XmlElement act in actsNodeList)
        {
            Act newAct = new Act();
            newAct.Number = Int32.Parse(act.Attributes.GetNamedItem("number").Value);
            //loop scenes and add to act
            XmlNodeList scenesNodeList = act.SelectNodes("scene");
            Debug.Log("loading " + scenesNodeList.Count + " scenes...");
            foreach (XmlElement scene in scenesNodeList)
            {
                Scene newScene = new Scene();
                newScene.Number = Int32.Parse(scene.Attributes.GetNamedItem("number").Value);
                //loop moments and add to scene
                XmlNodeList momentsNodeList = scene.SelectNodes("moment");
                Debug.Log("loading " + momentsNodeList.Count + " moments...");
                foreach (XmlElement moment in momentsNodeList)
                {
                    string title = moment.Attributes.GetNamedItem("title").Value;
                    string line = moment.Attributes.GetNamedItem("line").Value;

                    Moment newMoment = new Moment(title, line);
                    newScene.moments.Add(newMoment);
                }
                newAct.scenes.Add(newScene);
            }
            m_Script.acts.Add(newAct);
        }
    }
Exemple #22
0
 public WhileLoop(Act child, Act condition)
 {
     Name = "While : " + condition.Name;
     Condition = condition;
     Child = child;
 }
 public override void ClickMenuElement(Act act)
 {
     throw new NotImplementedException();
 }
Exemple #24
0
        public static List <AnalyzerItemBase> Analyze(BusinessFlow BusinessFlow, Activity parentActivity, Act a, ObservableList <DataSourceBase> DSList)
        {
            // Put all tests on Action here
            List <string>           ActivityUsedVariables           = new List <string>();
            List <string>           mUsedGlobalParameters           = new List <string>();
            List <string>           mMissingStoreToGlobalParameters = new List <string>();
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();
            ObservableList <GlobalAppModelParameter> mModelsGlobalParamsList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>();

            // Check if the action is obsolete and suggest conversion/upgrade/delete
            //if (a is IObsoleteAction)
            //{
            //    if (a.Active)
            //    {
            //        // TODO: get platform from activity in test
            //        Platform.eType ActivitySourcePlatform = Platform.eType.AndroidDevice;  //FIXME temp

            //        // if it is active then create conversion issue
            //        if (((IObsoleteAction)a).IsObsoleteForPlatform(ActivitySourcePlatform))
            //        {
            //            AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a);
            //            AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action"; ;
            //            AA.Details = a.Description + " Old Class=" + a.ActClass;
            //            AA.HowToFix = "Convert to new action"; // TODO: get name of new action
            //            AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes;
            //            AA.IssueType = eType.Warning;
            //            AA.Impact = "New action can have more capabilities and more stable, good to upgrade";
            //            AA.Severity = eSeverity.Medium;
            //            AA.FixItHandler = UpgradeAction;
            //            AA.ActivitySourcePlatform = ActivitySourcePlatform;
            //        }
            //    }
            //    else
            //    {
            //        // old action but not active so create issue of delete old unused action
            //        AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a);
            //        AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action which is not used"; ;
            //        AA.Details = a.Description + " Old Class=" + a.ActClass;
            //        AA.HowToFix = "Delete action";
            //        AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes;
            //        AA.IssueType = eType.Warning;
            //        AA.Impact = "slower execution, disk space";
            //        AA.Severity = eSeverity.Low;
            //        AA.FixItHandler = DeleteAction;
            //    }
            //}
            //Flow Control -> GoToAction , Check if Action u want to go to exist
            if (a.FlowControls.Count > 0)
            {
                foreach (GingerCore.FlowControlLib.FlowControl f in a.FlowControls)
                {
                    if (f.Active == true)
                    {
                        if (f.FlowControlAction == eFlowControlAction.GoToAction)
                        {
                            string GoToActionName = f.GetNameFromValue();
                            if (parentActivity.GetAct(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null)
                            {
                                AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                AA.Description = "Flow control is mapped to Action which does not exist";;
                                AA.Details     = "'" + GoToActionName + "' Action does not exist in '" + parentActivity.ActivityName + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity);
                                AA.HowToFix    = "Remap the Flow Control Action";

                                if (parentActivity.Acts.Where(x => x.Description == f.GetNameFromValue()).FirstOrDefault() != null)
                                {
                                    //can be auto fix
                                    AA.HowToFix        = "Remap Flow Control Action. Auto fix found other Action with the same name so it will fix the mapping to this Action.";
                                    AA.ErrorInfoObject = f;
                                    AA.CanAutoFix      = AnalyzerItemBase.eCanFix.Yes;
                                    AA.FixItHandler    = FixFlowControlWrongActionMapping;
                                }
                                else
                                {
                                    AA.CanAutoFix = AnalyzerItemBase.eCanFix.No;
                                }

                                AA.IssueType = eType.Error;
                                AA.Impact    = "Flow Control will fail on run time";
                                AA.Severity  = eSeverity.High;

                                IssuesList.Add(AA);
                            }
                        }
                        if (f.FlowControlAction == eFlowControlAction.GoToActivity)
                        {
                            string GoToActivity = f.GetNameFromValue();
                            //if (BusinessFlow.Activities.Where(x => (x.ActivityName == GoToActivity)).FirstOrDefault() == null)
                            if (BusinessFlow.GetActivity(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null)
                            {
                                AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";;
                                AA.Details     = "'" + GoToActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the '" + BusinessFlow.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                                AA.HowToFix    = "Remap the Flow Control Action";

                                if (BusinessFlow.Activities.Where(x => x.ActivityName == f.GetNameFromValue()).FirstOrDefault() != null)
                                {
                                    //can be auto fix
                                    AA.HowToFix        = "Remap Flow Control " + GingerDicser.GetTermResValue(eTermResKey.Activity) + ". Auto fix found other " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " with the same name so it will fix the mapping to this " + GingerDicser.GetTermResValue(eTermResKey.Activity) + ".";
                                    AA.ErrorInfoObject = f;
                                    AA.CanAutoFix      = AnalyzerItemBase.eCanFix.Yes;
                                    AA.FixItHandler    = FixFlowControlWrongActivityMapping;
                                }
                                else
                                {
                                    AA.CanAutoFix = AnalyzerItemBase.eCanFix.No;
                                }

                                AA.IssueType = eType.Error;
                                AA.Impact    = "Flow Control will fail on run time";
                                AA.Severity  = eSeverity.High;

                                IssuesList.Add(AA);
                            }
                        }
                        if (f.FlowControlAction == eFlowControlAction.GoToNextActivity)
                        {
                            if (BusinessFlow.Activities.IndexOf(parentActivity) == (BusinessFlow.Activities.Count() - 1))
                            {
                                AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";;
                                AA.Details     = "Flow Control is set to 'GoToNextActivity' but the parent " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " is last one in flow.";
                                AA.HowToFix    = "Remap the Flow Control Action";
                                AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                AA.IssueType   = eType.Error;
                                AA.Impact      = "Flow Control will fail on run time";
                                AA.Severity    = eSeverity.High;

                                IssuesList.Add(AA);
                            }
                        }
                        if (f.FlowControlAction == eFlowControlAction.SetVariableValue)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                string   SetVariableValue = f.GetNameFromValue();
                                string[] vals             = SetVariableValue.Split(new char[] { '=' });
                                if (!BusinessFlow.CheckIfVariableExists(vals[0].ToString().Trim(), parentActivity))
                                {
                                    AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                    AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";;
                                    AA.Details     = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items";
                                    AA.HowToFix    = "Remap the Flow Control Action";
                                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    AA.IssueType   = eType.Error;
                                    AA.Impact      = "Flow Control will fail on run time";
                                    AA.Severity    = eSeverity.High;

                                    IssuesList.Add(AA);
                                }
                            }
                        }
                        if (f.FlowControlAction == eFlowControlAction.RunSharedRepositoryActivity)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                //f.CalcualtedValue(BusinessFlow, App.ProjEnvironment, WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<DataSourceBase>());
                                string RunSharedRepositoryActivity   = f.GetNameFromValue();
                                ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
                                if (activities.Where(x => x.ActivityName == RunSharedRepositoryActivity).FirstOrDefault() == null)
                                {
                                    AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                    AA.Description = "Flow control mapped to Shared Repository " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";
                                    AA.Details     = "'" + RunSharedRepositoryActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in Shared Repository";
                                    AA.HowToFix    = "Remap the Flow Control Action";
                                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    AA.IssueType   = eType.Error;
                                    AA.Impact      = "Flow Control will fail on run time";
                                    AA.Severity    = eSeverity.High;

                                    IssuesList.Add(AA);
                                }
                            }
                        }
                        if (f.FlowControlAction == eFlowControlAction.GoToActivityByName)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                string activityToGoTo = f.GetNameFromValue();
                                if (BusinessFlow.Activities.Where(x => x.ActivityName == activityToGoTo).FirstOrDefault() == null)
                                {
                                    AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                                    AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";
                                    AA.Details     = "'" + activityToGoTo + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the parent " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                                    AA.HowToFix    = "Remap the Flow Control Action";
                                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    AA.IssueType   = eType.Error;
                                    AA.Impact      = "Flow Control will fail on run time";
                                    AA.Severity    = eSeverity.High;

                                    IssuesList.Add(AA);
                                }
                            }
                        }
                    }
                }
            }

            if (a.ActReturnValues.Count > 0)
            {
                foreach (ActReturnValue ARV in a.ActReturnValues)
                {
                    if (ARV.StoreTo != ActReturnValue.eStoreTo.None)
                    {
                        bool issueFound = false;
                        if (string.IsNullOrEmpty(ARV.StoreToValue))
                        {
                            issueFound = true;
                        }
                        else
                        {
                            switch (ARV.StoreTo)
                            {
                            case ActReturnValue.eStoreTo.Variable:
                                if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.SupportSetValue && x.Name == ARV.StoreToValue).FirstOrDefault() == null)
                                {
                                    issueFound = true;
                                }
                                break;

                            case ActReturnValue.eStoreTo.GlobalVariable:
                                if (WorkSpace.Instance.Solution.Variables.Where(x => x.SupportSetValue && x.Guid.ToString() == ARV.StoreToValue).FirstOrDefault() == null)
                                {
                                    issueFound = true;
                                }
                                break;

                            case ActReturnValue.eStoreTo.ApplicationModelParameter:
                                if (WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>().Where(x => x.Guid.ToString() == ARV.StoreToValue).FirstOrDefault() == null)
                                {
                                    issueFound = true;
                                }
                                break;

                            case ActReturnValue.eStoreTo.DataSource:
                                Regex           rxDSPattern = new Regex(@"{(\bDS Name=)\w+\b[^{}]*}", RegexOptions.Compiled);
                                MatchCollection matches     = rxDSPattern.Matches(ARV.StoreToValue);
                                foreach (Match match in matches)
                                {
                                    if (GingerCoreNET.GeneralLib.General.CheckDataSource(match.Value, DSList) != "")
                                    {
                                        issueFound = true;
                                    }
                                }
                                break;
                            }
                        }
                        if (issueFound)
                        {
                            AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                            AA.Description = string.Format("Output Value StoreTo has in-valid configuration");
                            AA.Details     = string.Format("The '{0}' Output Value configured StoreTo from type '{1}' and value '{2}' is not valid", ARV.Param, ARV.StoreTo, ARV.StoreToValue);
                            AA.HowToFix    = "Re-configure StoreTo for the Output Value";
                            AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                            AA.IssueType   = eType.Error;
                            AA.Impact      = "Execution might fail in run time";
                            AA.Severity    = eSeverity.High;
                            IssuesList.Add(AA);
                        }
                    }
                }
            }
            //Disabling the below because there are many actions which shows Locate By/Value but it is not needed for most operation types
            //if (a.ObjectLocatorConfigsNeeded == true && a.ActionDescription != "Script Action" && a.ActionDescription != "File Operations")
            //{
            //    if (a.LocateBy.ToString() == "NA")
            //    {
            //        AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a);
            //        AA.Description = "Action is missing LocateBy value";
            //        AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing LocateBy value";
            //        AA.HowToFix = " Add LocateBy value to '" + a.Description + "'";
            //        AA.CanAutoFix = AnalyzerItemBase.eCanFix.No;    // yes if we have one target app, or just set the first
            //        AA.IssueType = eType.Warning;
            //        AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail";
            //        AA.Severity = eSeverity.Medium;
            //    }
            //    if (a.LocateValue == null || a.LocateValue == "")
            //    {
            //        AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a);
            //        AA.Description = "Action is missing Locate Value ";
            //        AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing Locate value";
            //        AA.HowToFix = " Add Locate Value to '" + a.Description + "'";
            //        AA.CanAutoFix = AnalyzerItemBase.eCanFix.No;    // yes if we have one target app, or just set the first
            //        AA.IssueType = eType.Warning;
            //        AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail";
            //        AA.Severity = eSeverity.Medium;
            //    }

            //}
            VariableBase.GetListOfUsedVariables(a, ref ActivityUsedVariables);
            if (ActivityUsedVariables.Count > 0)
            {
                foreach (string Var in ActivityUsedVariables)
                {
                    if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.Name == Var).Select(x => x.Name).FirstOrDefault() == null)
                    {
                        AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                        AA.Description = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " '" + Var + "' is missing";
                        AA.Details     = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + ": '" + Var + "' Does not exist In " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' ";
                        AA.HowToFix    = " Create new " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " or Delete it from the action";
                        AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                        AA.IssueType   = eType.Error;
                        AA.Impact      = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable);
                        AA.Severity    = eSeverity.High;

                        AA.IssueCategory        = eIssueCategory.MissingVariable;
                        AA.IssueReferenceObject = Var;

                        IssuesList.Add(AA);
                    }
                }
            }



            GlobalAppModelParameter.GetListOfUsedGlobalParameters(a, ref mUsedGlobalParameters);
            if (mUsedGlobalParameters.Count > 0)
            {
                foreach (string Param in mUsedGlobalParameters)
                {
                    GlobalAppModelParameter globalParam = mModelsGlobalParamsList.Where(x => x.PlaceHolder == Param).FirstOrDefault();
                    if (globalParam == null)
                    {
                        AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                        AA.Description = "The Application Global Parameter " + Param + " is missing";
                        AA.Details     = "The Application Global Parameter: '" + Param + "' Does not exist in Models Global Parameters";
                        AA.HowToFix    = " Create new Application Global Parameter or Delete it from the action.";
                        AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                        AA.IssueType   = eType.Error;
                        AA.Impact      = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable);
                        AA.Severity    = eSeverity.High;
                        IssuesList.Add(AA);
                    }
                }
            }

            GetAllStoreToGlobalParameters(a, mModelsGlobalParamsList, ref mMissingStoreToGlobalParameters);
            if (mMissingStoreToGlobalParameters.Count > 0)
            {
                foreach (string Param in mMissingStoreToGlobalParameters)
                {
                    AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                    AA.Description = "The Output Value with Parameter '" + Param + "' is having store to Parameter which doesn't exist anymore";
                    AA.Details     = "The Output Value with Parameter: '" + Param + "' can be found at " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' ";
                    AA.HowToFix    = " Create new Parameter and change to it in the 'Store to' dropdown under the above path";
                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                    AA.IssueType   = eType.Error;
                    AA.Impact      = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing Parameter";
                    AA.Severity    = eSeverity.High;

                    IssuesList.Add(AA);
                }
            }
            // Put All Special Actions Analyze Here
            //actions combination
            if (a.GetType().ToString() == "ActLaunchJavaWSApplication")//forbidden combination: Launch & (platform\agent manipulation action)
            {
                List <IAct> driverActs = parentActivity.Acts.Where(x => ((x is ActWithoutDriver && x.GetType() != typeof(ActAgentManipulation)) == false) && x.Active == true).ToList();
                if (driverActs.Count > 0)
                {
                    string        list = string.Join(",", driverActs.Select(x => x.ActionDescription).ToList().ToArray());
                    AnalyzeAction AA   = CreateNewIssue(BusinessFlow, parentActivity, a);
                    AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has forbidden combinations";
                    AA.Details     = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has " + a.ActionDescription + " Action with the following platform actions: " + list + ".\nPlatform action inside this current " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " will try to activate the agent before the application is launch(will cause agent issue).";
                    AA.HowToFix    = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and put " + a.ActionDescription + " Action in a separate " + GingerDicser.GetTermResValue(eTermResKey.Activity);
                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;   // we can autofix by delete, but don't want to
                    AA.IssueType   = eType.Error;
                    AA.Impact      = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will be executed and will fail due to java agent connection";
                    AA.Severity    = eSeverity.High;

                    IssuesList.Add(AA);
                }
            }

            if (a.LocateBy == eLocateBy.POMElement || ((a is ActUIElement) && ((ActUIElement)a).ElementLocateBy == eLocateBy.POMElement))
            {
                try
                {
                    string[] pOMandElementGUIDs;
                    if (a is ActUIElement)
                    {
                        pOMandElementGUIDs = ((ActUIElement)a).ElementLocateValue.Split('_');
                    }
                    else
                    {
                        pOMandElementGUIDs = a.LocateValue.Split('_');
                    }
                    Guid selectedPOMGUID    = new Guid(pOMandElementGUIDs[0]);
                    ApplicationPOMModel POM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);

                    if (POM == null)
                    {
                        AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                        AA.Description = "Action's mapped Page Objects Model is missing";
                        AA.Details     = "Action " + a.ActionDescription + " has mapped Page Objects Model which is missing, reason can be that the Page Objects Model has been deleted after mapping it to this action.";
                        AA.HowToFix    = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element";
                        AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                        AA.IssueType   = eType.Error;
                        AA.Impact      = "Action will fail during execution";
                        AA.Severity    = eSeverity.High;

                        IssuesList.Add(AA);
                    }
                    else
                    {
                        Guid        selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]);
                        ElementInfo selectedPOMElement     = (ElementInfo)POM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault();
                        if (selectedPOMElement == null)
                        {
                            AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                            AA.Description = "Page Objects Model Element which mapped to this action is missing";
                            AA.Details     = "Action " + a.ActionDescription + " has mapped Page Objects Model Element which is missing, reason can be that the Element has been deleted after mapping it to this action.";
                            AA.HowToFix    = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Element";
                            AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                            AA.IssueType   = eType.Error;
                            AA.Impact      = "Action will fail during execution";
                            AA.Severity    = eSeverity.High;

                            IssuesList.Add(AA);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Analyzer" + ex.Message);
                    //TODO: try to find the failure outside exception
                    AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                    AA.Description = "Action's mapped Page Objects Model or Element is invalid";
                    AA.Details     = "Action " + a.ActionDescription + " has invalid mapped Page Objects Model or Element.";
                    AA.HowToFix    = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element";
                    AA.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                    AA.IssueType   = eType.Error;
                    AA.Impact      = "Action will fail during execution";
                    AA.Severity    = eSeverity.High;

                    IssuesList.Add(AA);
                }
            }

            //Check for duplicate ActInputValues
            if (a.InputValues.Count > 0)
            {
                foreach (ActInputValue AIV in a.InputValues.ToList())
                {
                    if (a.InputValues.Where(aiv => aiv.Param == AIV.Param).ToList().Count > 1)
                    {
                        AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a);
                        AA.Description     = "The Input Value Parameter " + AIV.Param + " is Duplicate";
                        AA.Details         = "The Input Value Parameter: '" + AIV.Param + "' is duplicate in the ActInputValues";
                        AA.HowToFix        = "Open action Edit page and save it.";
                        AA.CanAutoFix      = AnalyzerItemBase.eCanFix.Yes;
                        AA.IssueType       = eType.Warning;
                        AA.Impact          = "Duplicate input values will present in the report.";
                        AA.Severity        = eSeverity.Low;
                        AA.ErrorInfoObject = AIV;
                        AA.FixItHandler    = FixRemoveDuplicateActInputValues;
                        IssuesList.Add(AA);
                    }
                }
            }

            return(IssuesList);
        }
Exemple #25
0
        /// <summary>
        /// This method is used to remove the Legacy actions from the businessFlows
        /// </summary>
        /// <param name="lst"></param>
        public void RemoveLegacyActionsHandler(ObservableList <BusinessFlowToConvert> lst)
        {
            int cleanedBfsCounter        = 0;
            int cleanedActivitiesCounter = 0;
            int cleanedActionsCounter    = 0;

            try
            {
                Reporter.ToStatus(eStatusMsgKey.CleaningLegacyActions);

                Parallel.ForEach(lst, businessFlowToConvert =>
                {
                    cleanedBfsCounter++;
                    businessFlowToConvert.BusinessFlow.StartDirtyTracking();
                    for (int activityIndex = 0; activityIndex < businessFlowToConvert.BusinessFlow.Activities.Count; activityIndex++)
                    {
                        Activity activity = businessFlowToConvert.BusinessFlow.Activities[activityIndex];
                        ePlatformType activityPlatform = (from x in WorkSpace.Instance.Solution.ApplicationPlatforms where x.AppName == activity.TargetApplication select x.Platform).FirstOrDefault();

                        //if activity not active then check if all the actions are obsolete then remove the complete activity
                        if (!activity.Active)
                        {
                            var count = activity.Acts.Where(act => (act is IObsoleteAction) &&
                                                            (((IObsoleteAction)act).IsObsoleteForPlatform(activityPlatform))).Count();

                            //Checks if the activity have all the action as obsolete then removes activity directly
                            if (count == activity.Acts.Count)
                            {
                                businessFlowToConvert.BusinessFlow.Activities.RemoveAt(activityIndex);
                                activityIndex--;
                                cleanedActionsCounter = cleanedActionsCounter + count;
                                cleanedActivitiesCounter++;
                                continue;
                            }
                        }

                        //check the actions if it is obsolete then remove the action
                        for (int actIndex = 0; actIndex < activity.Acts.Count; actIndex++)
                        {
                            Act act = (Act)activity.Acts[actIndex];
                            if (((act.Active == false) && (act is IObsoleteAction) &&
                                 (((IObsoleteAction)act).IsObsoleteForPlatform(activityPlatform))))
                            {
                                activity.Acts.RemoveAt(actIndex);
                                cleanedActionsCounter++;
                                actIndex--;
                            }
                        }

                        ////check if all the actions removed from activity the remove the activity
                        //if (activity.Acts.Count <= 0 || activity.Acts.Where(x => x.Active == true).Count() <= 0)
                        //{
                        //    businessFlowToConvert.BusinessFlow.Activities.RemoveAt(activityIndex);
                        //    activityIndex--;
                        //}
                    }
                });
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occurred during Legacy Actions cleanup", ex);
            }
            finally
            {
                Reporter.HideStatusMessage();
                Reporter.ToUser(eUserMsgKey.LegacyActionsCleanup, cleanedBfsCounter, cleanedActivitiesCounter, cleanedActionsCounter);
            }
        }
Exemple #26
0
 private void Bind()
 {
     Js.Focus(this, nama);
     Act.ProjectList(project);
     LibMkt.ListTipeSales(tipe, project.SelectedValue);
 }
 public virtual void PrepActionStart(uint eventTime, Act action)
 {
 }
 public void WaitForFramesToCall(Act action, int frameCount)
 {
     coroutines.Add(action.Method.Name);
     StartCoroutine(CoroutineAction(action, WaitFor.Frames(frameCount)));
 }
Exemple #29
0
		public void InsertActToPool(Act _act, params object[] _params)
		{
			m_actPool.Insert(0, _act);
			foreach (var o in _params)
			{
				_act.AddParameter(o.GetType(), o);
			}
		}
Exemple #30
0
 public abstract object SetReportAction(Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false);
 public void WaitForNextFrameToCall(Act action)
 {
     coroutines.Add(action.Method.Name);
     StartCoroutine(CoroutineAction(action, WaitFor.NextFrame()));
 }
Exemple #32
0
 private void RunActionButton_Click(object sender, RoutedEventArgs e)
 {
     //TODO: if typeof
     Act act = (Act)this.Object;
 }
Exemple #33
0
        private void ResetAction(object sender, RoutedEventArgs e)
        {
            Act currentAction = (Act)grdActions.CurrentItem;

            currentAction.Reset();
        }
        /// <summary>
        /// Update the care plan given that a new act exists
        /// </summary>
        public void UpdateCarePlan(Act act)
        {
            try
            {
                List <Object> warehousePlan    = new List <object>();
                var           warehouseService = ApplicationContext.Current.GetService <IAdHocDatawarehouseService>();
                var           careplanService  = ApplicationContext.Current.GetService <ICarePlanService>();

                CarePlan carePlan = null;

                // First step, we delete all acts in the warehouse for the specified patient in the protocol
                var patientId = act.Participations.FirstOrDefault(o => o.ParticipationRoleKey == ActParticipationKey.RecordTarget)?.PlayerEntityKey;
                if (patientId == null)
                {
                    this.m_tracer.TraceWarning("Cannot update care plan for act as it seems to have no RecordTarget");
                    return;
                }

                var patient = ApplicationContext.Current.GetService <IDataPersistenceService <Patient> >().Get(patientId.Value);

                // Is there a protocol for this act?
                if (act.Protocols.Count() == 0)
                {
                    // Need to re-calculate the entire care plan
                    this.m_tracer.TraceWarning("Will need to calculate the entire care plan for patient {0}", patientId);

                    this.m_tracer.TraceVerbose("Calculating care plan for {0}", patient.Key);

                    // First, we clear the warehouse
                    warehouseService.Delete(this.m_dataMart.Id, new { patient_id = patient.Key.Value });

                    // Now calculate
                    carePlan = careplanService.CreateCarePlan(patient, false, this.m_parameters);

                    // Remove for all on this patient
                    lock (this.m_lock)
                        this.m_actCarePlanPromise.RemoveAll(i => i is Act && (i as Act).Participations.Any(p => p.PlayerEntityKey == patient.Key.Value || i is Patient && (i as Patient).Key == patient.Key.Value));
                }
                else
                {
                    warehouseService.Delete(this.m_dataMart.Id, new
                    {
                        patient_id  = patientId.Value,
                        protocol_id = act.Protocols.FirstOrDefault()?.ProtocolKey
                    });

                    carePlan = careplanService.CreateCarePlan(patient, false, this.m_parameters, act.Protocols.FirstOrDefault().ProtocolKey);

                    // Remove for all on this patient
                    lock (this.m_lock)
                        this.m_actCarePlanPromise.RemoveAll(i => i is Act && (i as Act).Participations.Any(p => p.PlayerEntityKey == patient.Key.Value || i is Patient && (i as Patient).Key == patient.Key.Value) && (i as Act).Protocols.FirstOrDefault()?.ProtocolKey == act.Protocols.FirstOrDefault()?.ProtocolKey);
                }

                /// Create a plan for the warehouse
                warehousePlan.AddRange(carePlan.Action.Select(o => new
                {
                    creation_date = DateTime.Now,
                    patient_id    = patient.Key.Value,
                    location_id   = patient.Relationships.FirstOrDefault(r => r.RelationshipTypeKey == EntityRelationshipTypeKeys.DedicatedServiceDeliveryLocation || r.RelationshipType?.Mnemonic == "DedicatedServiceDeliveryLocation")?.TargetEntityKey.Value,
                    act_id        = o.Key.Value,
                    protocol_id   = o.Protocols.FirstOrDefault().ProtocolKey,
                    class_id      = o.ClassConceptKey.Value,
                    type_id       = o.TypeConceptKey.Value,
                    min_date      = o.StartTime?.Date,
                    max_date      = o.StopTime?.Date,
                    act_date      = o.ActTime.Date,
                    product_id    = o.Participations?.FirstOrDefault(r => r.ParticipationRoleKey == ActParticipationKey.Product || r.ParticipationRole?.Mnemonic == "Product")?.PlayerEntityKey.Value,
                    sequence_id   = o.Protocols.FirstOrDefault()?.Sequence,
                    dose_seq      = (o as SubstanceAdministration)?.SequenceId
                }));


                // Insert plans
                warehouseService.Add(this.m_dataMart.Id, warehousePlan);
            }
            catch (Exception ex)
            {
                this.m_tracer.TraceError("Could not update care plan based on Act {0}: {1}", act, ex);
            }
        }
		public Assignment_bt_node_test_action_ut_3_node9()
		{
			opr = new Act();
			opr.Var_B_Loop = true;
			opr.Var_List_EnumTest = new List<EnumTest>();
			opr.Var_List_EnumTest.Capacity = 2;
			EnumTest opr_Var_List_EnumTest_item0 = EnumTest.EnumTest_OneAfterOne;
			opr.Var_List_EnumTest.Add(opr_Var_List_EnumTest_item0);
			EnumTest opr_Var_List_EnumTest_item1 = EnumTest.EnumTest_One;
			opr.Var_List_EnumTest.Add(opr_Var_List_EnumTest_item1);
		}
Exemple #36
0
 public static double GetKeyCount(Act act)
 {
     Update();
     switch (act)
     {
         case Act.A1: return KeyCounts[0];
         case Act.A2: return KeyCounts[1];
         case Act.A3: return KeyCounts[2];
         case Act.A4: return KeyCounts[3];
     }
     return 0;
 }
 public override bool IsWindowExist(Act act)
 {
     throw new NotImplementedException();
 }
Exemple #38
0
        public ExtractTypeSecondaryViewModel(ViewModelBase vmParent, Act act)
        {
            this.ViewModelParent = vmParent;

            this.ActSelected = act;
        }
 public virtual void ActionEnd(uint eventTime, Act action, bool offlineMode = false)
 {
 }
Exemple #40
0
        static AnalyzeAction CreateNewIssue(BusinessFlow BusinessFlow, Activity Activity, Act action)
        {
            AnalyzeAction AA = new AnalyzeAction();

            AA.Status        = AnalyzerItemBase.eStatus.NeedFix;
            AA.mActivity     = Activity;
            AA.ItemName      = action.Description;
            AA.ItemParent    = BusinessFlow.Name + " > " + Activity.ActivityName;
            AA.mAction       = action;
            AA.mBusinessFlow = BusinessFlow;
            AA.ItemClass     = "Action";
            return(AA);
        }
 public virtual void PrepActionEnd(uint eventTime, Act action)
 {
 }
Exemple #42
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Act.Pass();
            Act.NoCache();

            Act.CekInt("NoTTS");

            DataTable rs = Db.Rs("SELECT * FROM MS_TTS WHERE NoTTS = " + NoTTS + " AND Status = 'POST'");

            if (rs.Rows.Count == 0)
            {
                Response.Redirect("/CustomError/Deleted.html");
            }
            else
            {
                DataTable rsHeader = Db.Rs("SELECT "
                                           + " CONVERT(varchar, TglTTS, 106) AS [Tanggal]"
                                           + ",Tipe"
                                           + ",Ref AS [Ref.]"
                                           + ",Unit"
                                           + ",Customer"
                                           + ",CaraBayar AS [Cara Bayar]"
                                           + ",Ket AS [Keterangan]"
                                           + ",NoSlip AS [Slip Setoran]"
                                           + ",NoBG AS [No. BG]"
                                           + ",CONVERT(varchar, TglBG, 106) AS [Tanggal BG]"
                                           + ",Titip AS [Pengelola BG]"
                                           + ",Total"
                                           + " FROM MS_TTS WHERE NoTTS = " + NoTTS);

                string StatusLama = rs.Rows[0]["Status"].ToString();

                #region logfile
                string Tipe = Db.SingleString("SELECT Tipe FROM MS_TTS WHERE NoTTS = " + NoTTS);
                string Tb   = Sc.MktTb(Tipe);

                string strSql = "";
                if (Tipe != "TENANT")
                {
                    strSql = "SELECT "
                             + " CASE NoTagihan"
                             + "		WHEN 0 THEN 'UNALLOCATED    ' + CONVERT(varchar,NilaiPelunasan,1)"
                             + "		ELSE (SELECT NamaTagihan FROM "+ Tb + "..MS_TAGIHAN WHERE NoUrut = l.NoTagihan AND NoKontrak = l.NoKontrak)"
                             + "          + '    ' + CONVERT(varchar,NilaiPelunasan,1)"
                             + " END AS NamaTagihan"
                             + " FROM " + Tb + "..MS_PELUNASAN AS l "
                             + " WHERE NoTTS = " + NoTTS;
                }
                else
                {
                    strSql = "SELECT "
                             + " NamaTagihan + '    ' + CONVERT(varchar,NilaiTagihan,1) "
                             + " FROM " + Tb + "..MS_TAGIHAN AS l "
                             + " WHERE NoTTS = " + NoTTS;
                }
                #endregion
                DataTable rsDetil = Db.Rs(strSql);

                Db.Execute("EXEC spPostingTTSVoid " + NoTTS);
                Db.Execute("UPDATE MS_TTS SET ManualBKM = '' WHERE NoTTS = " + NoTTS);
                Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_PELUNASAN SET NoBKM2='' WHERE NoTTS = " + NoTTS);
                Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_PELUNASAN_KPA SET SudahCair=0 WHERE NoTTS=" + NoTTS);
                //Log
                string KetLog = Cf.LogCapture(rsHeader)
                                + Cf.LogList(rsDetil, "ALOKASI PELUNASAN")
                ;

                Db.Execute("EXEC spLogTTS"
                           + " 'POST'"
                           + ",'" + Act.UserID + "'"
                           + ",'" + Act.IP + "'"
                           + ",'***BATAL KWITANSI***<br>" + KetLog + "'"
                           + ",'" + NoTTS.ToString().PadLeft(7, '0') + "'"
                           );

                decimal LogID   = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_TTS_LOG ORDER BY LogID DESC");
                string  Project = Db.SingleString("SELECT Project FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = (SELECT Ref FROM MS_TTS WHERE NoTTS = '" + NoTTS + "')");
                Db.Execute("UPDATE MS_TTS_LOG SET Project = '" + Project + "' WHERE LogID  = " + LogID);

                Response.Redirect("TTSEdit.aspx?NoTTS=" + NoTTS + "&done=1");
            }
        }
Exemple #43
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Act.Pass();
            Act.NoCache();

            if (!Page.IsPostBack)
            {
                string persen = Request.QueryString["t1"];
                string ket    = Request.QueryString["t2"];

                if (persen != "" && ket != "")
                {
                    string[] p = persen.Split(' ');
                    string[] k = ket.Split(';');

                    try { persen1.Text = (Convert.ToDecimal(p[0]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen2.Text = (Convert.ToDecimal(p[1]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen3.Text = (Convert.ToDecimal(p[2]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen4.Text = (Convert.ToDecimal(p[3]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen5.Text = (Convert.ToDecimal(p[4]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen6.Text = (Convert.ToDecimal(p[5]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen7.Text = (Convert.ToDecimal(p[6]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen8.Text = (Convert.ToDecimal(p[7]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen9.Text = (Convert.ToDecimal(p[8]) * (decimal) - 1).ToString(); }
                    catch { }
                    try { persen10.Text = (Convert.ToDecimal(p[9]) * (decimal) - 1).ToString(); }
                    catch { }

                    try { ket1.Text = k[0]; } catch { }
                    try { ket2.Text = k[1]; } catch { }
                    try { ket3.Text = k[2]; } catch { }
                    try { ket4.Text = k[3]; } catch { }
                    try { ket5.Text = k[4]; } catch { }
                    try { ket6.Text = k[5]; } catch { }
                    try { ket7.Text = k[6]; } catch { }
                    try { ket8.Text = k[7]; } catch { }
                    try { ket9.Text = k[8]; } catch { }
                    try { ket10.Text = k[9]; } catch { }
                }

                persen1.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen1.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen1.Attributes["onblur"]   = "CalcBlur(this);";
                persen2.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen2.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen2.Attributes["onblur"]   = "CalcBlur(this);";
                persen3.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen3.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen3.Attributes["onblur"]   = "CalcBlur(this);";
                persen4.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen4.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen4.Attributes["onblur"]   = "CalcBlur(this);";
                persen5.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen5.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen5.Attributes["onblur"]   = "CalcBlur(this);";
                persen6.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen6.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen6.Attributes["onblur"]   = "CalcBlur(this);";
                persen7.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen7.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen7.Attributes["onblur"]   = "CalcBlur(this);";
                persen8.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen8.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen8.Attributes["onblur"]   = "CalcBlur(this);";
                persen9.Attributes["onfocus"]  = "tempnum=CalcFocus(this);";
                persen9.Attributes["onkeyup"]  = "CalcType(this,tempnum);";
                persen9.Attributes["onblur"]   = "CalcBlur(this);";
                persen10.Attributes["onfocus"] = "tempnum=CalcFocus(this);";
                persen10.Attributes["onkeyup"] = "CalcType(this,tempnum);";
                persen10.Attributes["onblur"]  = "CalcBlur(this);";
            }
        }
 public MainFightPlace(MainPlaceInfo m)
 {
     this.MainPlace_Info = m;
     act += nothing;
     InitializeComponent();
 }
Exemple #45
0
        /// <summary>
        /// This method is used to convert the selected actions from the activity
        /// </summary>
        /// <param name="addNewActivity"></param>
        /// <param name="actionsToBeConverted"></param>
        /// <param name="convertToPOMAction"></param>
        /// <param name="selectedPOMObjectName"></param>
        /// <param name="currentActivity"></param>
        private void ConvertSelectedActionsFromActivity(BusinessFlowToConvert businessFlowToConvert, ObservableList <ConvertableActionDetails> actionsToBeConverted, bool addNewActivity,
                                                        bool convertToPOMAction, ObservableList <Guid> selectedPOMObjectName, Activity currentActivity)
        {
            int actionIndex = 0;

            for (; actionIndex < currentActivity.Acts.Count(); actionIndex++)
            {
                Act act = (Act)currentActivity.Acts[actionIndex];
                if (!mStopConversion)
                {
                    try
                    {
                        ePlatformType activityPlatform = (from x in WorkSpace.Instance.Solution.ApplicationPlatforms where x.AppName == currentActivity.TargetApplication select x.Platform).FirstOrDefault();
                        if (act.Active && act is IObsoleteAction &&
                            (((IObsoleteAction)act).IsObsoleteForPlatform(activityPlatform)) &&
                            actionsToBeConverted.Where(a => a.SourceActionType == act.GetType() &&
                                                       a.Selected &&
                                                       a.TargetActionType == ((IObsoleteAction)act).TargetAction()).FirstOrDefault() != null)
                        {
                            // get the index of the action that is being converted
                            int selectedActIndex = currentActivity.Acts.IndexOf(act);

                            // convert the old action
                            Act newAct = ((IObsoleteAction)act).GetNewAction();
                            if (newAct != null)
                            {
                                newAct.Platform    = ((IObsoleteAction)act).GetTargetPlatform();
                                newAct.Description = newAct.Description;// string.Format("New - {0}", newAct.Description);
                                if (convertToPOMAction && newAct.GetType().Name == ActUIElementClassName)
                                {
                                    bool isFound = false;
                                    foreach (Guid pomOj in selectedPOMObjectName)
                                    {
                                        if (!isFound)
                                        {
                                            newAct = GetMappedElementFromPOMForAction(newAct, pomOj, ref isFound);
                                        }
                                        else if (isFound)
                                        {
                                            break;
                                        }
                                    }
                                }
                                currentActivity.Acts.Insert(selectedActIndex + 1, newAct);

                                // set obsolete action in the activity as inactive
                                act.Active = false;
                                if (addNewActivity)
                                {
                                    currentActivity.Acts.Remove(act);
                                }
                                businessFlowToConvert.ConvertedActionsCount++;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Error occurred while trying to convert action", ex);
                    }
                }
                else
                {
                    break;
                }
            }
        }
        private void LoadData()
        {
            string code     = Request["ApplicationCode"] + "";
            string caseCode = Request["CaseCode"] + "";

            string procedureCode = Request["ProcedureCode"] + "";
            string procedureName = Request["ProcedureName"] + "";
            string userCode      = Request["UserCode"] + "";
            string unitCode      = Request["UnitCodeCode"] + "";

            WorkCase workCase = Rms.WorkFlow.WorkCaseManager.GetWorkCase(caseCode);

            Procedure procedure = DefinitionManager.GetProcedureDifinition(workCase.ProcedureCode, true);

            if (procedure == null)
            {
                LogHelper.WriteLog("取不到对应流程");
                throw new Exception("流程配置有误,取不到对应流程");
            }


            Act currentAct = workCase.GetAct(Request["ActCode"] + "");

            if (currentAct == null)
            {
                LogHelper.WriteLog("取不到当前流程节点");
                throw new Exception("非法操作,取不到当前流程节点");
            }

            /*if(Request["ActCode"]+"" != "")
             * {
             *      Act act = workCase.GetAct(Request["ActCode"]+"");
             *      if(act.Copy == 0)
             *              this.ChkShow.Checked = (act.IsSleep == 1);
             *      else
             *              this.ChkShow.Visible = false;
             * }*/

            System.Collections.IDictionaryEnumerator ie = workCase.GetOpinionEnumerator();
            while (ie.MoveNext())
            {
                Opinion Flowopinion = (Opinion)ie.Value;
                if (Flowopinion.ApplicationCode == Request["ActCode"] + "")
                {
                    this.FlowOpinion.Value = Flowopinion.OpinionText;
                    switch (this.up_sPMName.ToLower())
                    {
                    case "shimaopm":
                        if (Flowopinion.OpinionText.Trim() == "")
                        {
                            Task firstTask = DefinitionManager.GetFirstTask(procedure);
                            if (firstTask == null)
                            {
                                LogHelper.WriteLog("流程取不到开始节点");
                                throw new Exception("流程配置有误,请检查开始节点的属性");
                            }
                            if (currentAct.ToTaskCode == firstTask.TaskCode)
                            {
                                this.FlowOpinion.Value = "";
                            }
                            else
                            {
                                this.FlowOpinion.Value = "同意";
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemple #47
0
        public bool Parse(string data)
        {
            if (data.StartsWith("!"))
            {
                Not = true;
                data = data.Remove(0, 1).Trim();
            }
            var arr = data.Split(' ');
            var m = 0;
            foreach (var a in arr)
            {
                switch (m)
                {
                    case 0:
                        if (a.StartsWith("$"))
                        {
                            mode = Mode.Variable;
                            Param = a.Substring(1);
                            m = 2;
                        }
                        else if (a.Equals("exists"))
                        {
                            mode = Mode.Exists;
                            m = 1;
                        }
                        break;
                    case 1:
                        if (!string.IsNullOrWhiteSpace(a))
                        {
                            Param = a;
                            m = 2;
                        }
                        break;
                    case 2:
                        switch (a)
                        {
                            case "stop":
                                act = Act.Stop;
                                m = 4;
                                break;
                            case "goto":
                                act = Act.Goto;
                                m = 3;
                                break;
                        }
                        break;
                    case 3:
                        if (!string.IsNullOrWhiteSpace(a))
                        {
                            Data = a;
                            m = 4;
                        }
                        break;
                }
            }

            if (m != 4)
            {
                Parent.Message("Error: if construction fails with {0} tags", m);
                return false;
            }
            return true;
        }
Exemple #48
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     Act.Pass();
     Act.NoCache();
 }
Exemple #49
0
 public CompoundAct(Act tree)
 {
     Name = Tree.Name;
     Tree = tree;
 }
Exemple #50
0
 public void Call(Act action)
 {
     action();
 }
 public override bool CloseWindow(Act act)
 {
     throw new NotImplementedException();
 }
Exemple #52
0
 public void Call <T>(Act <T> action, T arg)
 {
     action(arg);
 }
Exemple #53
0
        private static Vector3 ReturnMovementVector(Act act)
        {
            switch (act)
            {
                case Act.A1:
                    if (!FunkyGame.AdventureMode)
                        return new Vector3(2959.277f, 2811.887f, 24.04533f);
                    else
                        return new Vector3(386.6582f, 534.2561f, 24.04533f);
                case Act.A2:
                    return new Vector3(299.5841f, 250.1721f, 0.1000036f);
                case Act.A3:
                case Act.A4:
                    return new Vector3(403.7034f, 395.9311f, 0.5069602f);
                case Act.A5:
                    return new Vector3(532.3179f, 521.8536f, 2.662077f);
            }

            return Vector3.Zero;
        }
Exemple #54
0
 public static Act<A> andThen<A, B>(this Fn<A, B> f, Act<B> a) {
   return value => a(f(value));
 }
 public void WaitForSecondsToCall(Act action, float seconds)
 {
     coroutines.Add(action.Method.Name);
     StartCoroutine(CoroutineWaitForSeconds(action, seconds));
 }
Exemple #56
0
        /* Perform an action based on id */
        public void StartAct()
        {
            prevAct = act;
            act     = Act.WAIT;
            // find a pos to do something to
            switch (fabId)
            {
            case Map.ID.SHOT:
                if (map.things.ContainsKey(pos))
                {
                    var thing   = map.things[pos];
                    var posTeam = (thing.id & Map.TEAM_MASK);
                    // no friendly fire?
                    if (posTeam != team)
                    {
                        thing.Hit(this);
                        Death(thing);
                    }
                }
                act = MoveTo(pos + dir);
                break;

            case Map.ID.LOOT: break;

            case Map.ID.MON:
                // just spawned?
                if (roundCreated > 0 && roundCreated == map.roundCount)
                {
                    if (prevPos != pos)
                    {
                        travel = new Travel(transform, SpritePos(prevPos), SpritePos(pos), Easing.Linear);
                        travel.SetDelta(0);
                        act = Act.MOVE;
                        return;
                    }
                }
                Vector3Int target = new Vector3Int();
                switch ((Mon)countId)
                {
                case Mon.SPAWNER:
                    if ((map.roundCount - roundCreated) % 4 == 3)
                    {
                        var p = map.Wander(pos, true);
                        if (!map.things.ContainsKey(p))
                        {
                            var spawnId = Map.ID.MON | Map.ID.BAD;
                            spawnId |= (map.rng.NextDouble() < 0.5 ? (Map.ID)Mon.HUNTER : (Map.ID)Mon.FLEE);
                            Spawn(spawnId, p);
                            act = Act.WAIT;
                            return;
                        }
                    }
                    // wander harmlessly
                    target = map.Wander(pos, true);
                    act    = MoveTo(target);
                    break;

                case Mon.HUNTER:
                    // hunt player
                    target = map.Chase(this, true);
                    act    = MoveTo(target);
                    break;

                case Mon.FLEE:
                    // flee player
                    target = map.Flee(this, true);
                    act    = MoveTo(target);
                    break;
                }
                FaceDir();
                break;
            }
        }
 public ActBountiesCoroutine(Act act)
 {
     Act = act;
     _completeActBountiesCoroutine = new CompleteActBountiesCoroutine(act);
     _bountyCoroutines = BountyCoroutineFactory.GetActBounties(act);
 }
        private IEnumerator CoroutineAction(Act action, IEnumerator coroutine)
        {
            yield return(StartCoroutine(coroutine));

            action();
        }
Exemple #59
0
		public AskMessageNg(Act _act, EAskMessageType _type, params object[] _params) : base(_act, _params) { AskMessageType = _type; }
        private IEnumerator CoroutineWaitForSeconds(Act action, float seconds)
        {
            yield return(new WaitForSeconds(seconds));

            action();
        }