Esempio n. 1
0
        // Save Activity to Siebel
        private void SaveActivityToSiebel(string sr_id)
        {
            string logMessage;

            // check SR status,
            if (checkSRStatus(sr_id) == false)
            {
                return;
            }

            SharedServices.Activity activity = new Activity();
            activity.SrID         = sr_id;
            activity.Comment      = this._activityControl.InputComment;
            activity.Description  = this._activityControl.InputDescription;
            activity.ActivityType = this._activityControl.InputType;
            activity.Due          = this._activityControl.InputDue;
            activity.Priority     = this._activityControl.InputPriority;
            activity.Status       = this._activityControl.InputStatus;

            bool activity_saved;

            try
            {
                // Create Interaction in Siebel
                logMessage = "Ready to propagate activity to Siebel.";
                _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage);

                activity_saved = activity.Create(_logIncidentId, 0);
            }
            catch (Exception ex)
            {
                logMessage = "Error in Propagating activity." + "SR ID = " + sr_id + "; Exception: " + ex.Message;
                _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage);

                activity_saved = false;

                string message = "There has been an error communicating with Siebel. Please check log for detail.";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (activity_saved == false)
            {
                logMessage = "Activity is not saved in Siebel.  SR ID = " + sr_id + "; Response Error Message: " + activity.ErrorMessage;
                _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage);

                MessageBox.Show("There has been an error communicating with Siebel. Please check log for detail.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                logMessage = "Activity is saved in Siebel. ID = " + activity.ID + "; SR ID = " + sr_id;
                _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get a string custom attribute
        /// </summary>
        /// <param name="incidentRecord"></param>
        /// <param name="attrName"></param>
        /// <returns></returns>
        public static String getSrmStringCustomAttr(IIncident incidentRecord, String attrName)
        {
            attrName = "Accelerator$" + attrName;
            IList <ICustomAttribute> customAttributes = incidentRecord.CustomAttributes;

            foreach (ICustomAttribute cusAttr in customAttributes)
            {
                if (cusAttr.PackageName == "Accelerator" && cusAttr.GenericField.Name == attrName)
                {
                    return(cusAttr.GenericField.DataValue.Value != null ? (String)cusAttr.GenericField.DataValue.Value : null);
                }
            }
            logWrap.DebugLog(logMessage: "Custom Attribute Accelerator$" + attrName + " not exist!!!!");
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Method which is invoked by the AddIn framework when the control is created.
        /// </summary>
        /// <param name="inDesignMode">Flag which indicates if the control is being drawn on the Workspace Designer. (Use this flag to determine if code should perform any logic on the workspace record)</param>
        /// <param name="RecordContext">The current workspace record context.</param>
        /// <returns>The control which implements the IWorkspaceComponent2 interface.</returns>
        public IWorkspaceComponent2 CreateControl(bool inDesignMode, IRecordContext RecordContext)
        {
            if (!ConfigurationSetting.configVerbPerfect)
            {
                if (!ConfigurationSetting.loginUserIsAdmin)
                {
                    MessageBox.Show("RepairOrderAddIn is not initialized properly. \nPlease contact your system administrator.\n You are now logged out.");
                    _gContext.Logout();
                }
                else // don't want to logout admin
                {
                    MessageBox.Show("RepairOrderAddIn is not loaded because of invalid configuration verb.");
                    return(new RepairOrderAddIn(inDesignMode, RecordContext, isEnabledEditing));
                }
            }

            _rContext = RecordContext;
            string logMessage, logNote;

            if (!inDesignMode && _rContext != null)
            {
                // Set config according to custom configuration verb
                ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext);

                _usr = ConfigurationSetting.username;
                _pwd = ConfigurationSetting.password;
                _log = ConfigurationSetting.logWrap;
                _ebsDefaultSrOwnerId        = ConfigurationSetting.ebsDefaultSrOwnerId;
                RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider;
                RepairOrder.CreateURL       = ConfigurationSetting.CreateRepair_WSDL;
                RepairOrder.UpdateURL       = ConfigurationSetting.UpdateRepair_WSDL;
                //RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL;
                //RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL;
                RepairOrder.ListURL              = ConfigurationSetting.RepairOrderList_WSDL;
                RepairOrder.ServiceUsername      = _usr;
                RepairOrder.ServicePassword      = _pwd;
                RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                RepairOrder.InitEBSProvider();
                logMessage = "Repair Order is initiated.";
                logNote    = "";
                _log.DebugLog(logMessage: logMessage, logNote: logNote);
            }

            /*
             * bool isEnabled = false;
             * if (isEnabledEditing == "true")
             * {
             *  isEnabled = true;
             * }*/
            _wsAddIn      = new RepairOrderAddIn(inDesignMode, _rContext, isEnabledEditing);
            _wsAddIn._log = _log;
            _wsAddIn._ebsDefaultSrOwnerId = _ebsDefaultSrOwnerId;
            if (_log != null)
            {
                logMessage = "Repair Order AddIn is setup.";
                logNote    = "";
                _log.DebugLog(logMessage: logMessage, logNote: logNote);
            }
            return(_wsAddIn);
        }
Esempio n. 4
0
        public override void InstallBindings()
        {
            Container.Bind <DataBindingInitializerSystem>().AsSingle().NonLazy();
            Container.Bind <DataProviderSystem>().AsSingle().NonLazy();
            Container.Bind <SceneSystem>().AsSingle().NonLazy();
            Container.Bind <DragSystem>().AsSingle().NonLazy();
            Container.Bind <PinchSystem>().AsSingle().NonLazy();
            Container.Bind <TapCommandSystem>().AsSingle().NonLazy();
            Container.Bind <CampSystem>().AsSingle().NonLazy();
            Container.Bind <TimedCommandSystem>().AsSingle().NonLazy();
            Container.Bind <MergeSystem>().AsSingle().NonLazy();
            Container.Bind <OrderListSystem>().AsSingle().NonLazy();

            var commandSystem = new CommandSystem();

            Container.BindInstance(commandSystem);
            Container.QueueForInject(commandSystem);

            // start -- command addition
            Container.Bind <SpawnCommand>().AsSingle().NonLazy();

            commandSystem.AddCommand(Constants.COMMAND_SPAWN_OBJ, Container.Resolve <SpawnCommand>());
            // -- end

            LogWrapper.DebugLog("[{0}] installation of sample bindings successfull", GetType());
        }
Esempio n. 5
0
        public void ForceComplete()
        {
            LogWrapper.DebugLog("[{0}] {1} force complete at index {2}", GetType(), id, currentStep.index);

            foreach (var step in steps)
            {
                ExitStep(step, false);
            }
        }
Esempio n. 6
0
        protected virtual void StartStep(T step)
        {
            LogWrapper.DebugLog("[{0}] {1} start tutorial step with index {2}", GetType(), id, currentStep.index);

            foreach (var handler in TutorialService <T> .actionHandlers)
            {
                handler.HandleAwakeActions(step.startActions);
            }
        }
Esempio n. 7
0
        private void AddVersion(string version)
        {
            var v = new VersionData();

            v.version = version;
            v.date    = DateTime.UtcNow;
            appVersions.Add(v);
            LogWrapper.DebugLog("[{0}] added new version {1}", GetType(), version);
        }
Esempio n. 8
0
        public TILED_Map GetMap(string path)
        {
            if (!mapCache.ContainsKey(path))
            {
                var map = Utils.ReadJsonFromResources <TILED_Map>(path);
                mapCache.Add(path, map);

                LogWrapper.DebugLog("[{0}] Loaded and cached map from resources {1}", GetType(), path);
            }

            return(mapCache[path]);
        }
Esempio n. 9
0
        public TILED_Tileset GetTileset(string path)
        {
            if (!tilesetCache.ContainsKey(path))
            {
                var tileset = Utils.ReadJsonFromResources <TILED_Tileset>(path);
                tilesetCache.Add(path, tileset);

                LogWrapper.DebugLog("[{0}] Loaded and cached tileset from resources {1}", GetType(), path);
            }

            return(tilesetCache[path]);
        }
Esempio n. 10
0
        /// <summary>
        /// Setup game's bindings
        /// </summary>

        public override void InstallBindings()
        {
            Container.Bind <TILED_DataProvider>().AsSingle().NonLazy();
            Container.Bind <TILED_MapReader>().AsSingle().NonLazy();
            Container.Bind <FactoryEntity>().AsSingle().NonLazy();
            Container.Bind <FactoryGUI>().AsSingle().NonLazy();
            Container.Bind <GridService>().AsSingle().NonLazy();
            Container.Bind <HUD_Service>().AsSingle().NonLazy();
            Container.Bind <CameraService>().AsSingle().NonLazy();
            Container.Bind <TutorialService <TutorialStep> >().AsSingle().NonLazy();

            LogWrapper.DebugLog("[{0}] installation of game bindings successfull", GetType());
        }
Esempio n. 11
0
        /// <summary>
        /// Method which is invoked by the AddIn framework when the control is created.
        /// </summary>
        /// <param name="inDesignMode">Flag which indicates if the control is being drawn on the Workspace Designer. (Use this flag to determine if code should perform any logic on the workspace record)</param>
        /// <param name="RecordContext">The current workspace record context.</param>
        /// <returns>The control which implements the IWorkspaceComponent2 interface.</returns>
        public IWorkspaceComponent2 CreateControl(bool inDesignMode, IRecordContext RecordContext)
        {
            if (!ConfigurationSetting.configVerbPerfect)
            {
                if (!ConfigurationSetting.loginUserIsAdmin)
                {
                    MessageBox.Show("Activity Add-In is not initialized properly. \nPlease contact your system administrator.\n You are now logged out.");
                    _gContext.Logout();
                }
                else // don't want to logout admin
                {
                    MessageBox.Show("Activity Add-In is not loaded because of invalid configuration verb.");
                    return(new ActivityAddIn(inDesignMode, RecordContext));
                }
            }

            _rContext = RecordContext;
            if (!inDesignMode && _rContext != null)
            {
                ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext);

                _usr = ConfigurationSetting.username;
                _pwd = ConfigurationSetting.password;
                //_client = ConfigurationSetting.client;
                _rnSrv = ConfigurationSetting.rnSrv;
                _log   = ConfigurationSetting.logWrap;
                _siebelServiceUserId    = ConfigurationSetting.siebelServiceUserId;
                _siebelDefaultSrOwnerId = ConfigurationSetting.siebelDefaultSrOwnerId;

                Activity.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                Activity.LookupURL            = ConfigurationSetting.CreateSR_WSDL;
                Activity.ServiceUsername      = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Activity.ServicePassword      = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Activity.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Activity.InitSiebelProvider();
            }
            _wsAddIn = new ActivityAddIn(inDesignMode, _rContext);

            _wsAddIn._rnSrv = _rnSrv;
            _wsAddIn._log   = _log;
            _wsAddIn._siebelServiceUserId = _siebelServiceUserId;


            if (_log != null)
            {
                string logMessage = "Activity AddIn is setup.";
                _log.DebugLog(logMessage: logMessage);
            }

            return(_wsAddIn);
        }
Esempio n. 12
0
        public void RemoveSubNode(Node node)
        {
            for (int n = 0; n < subNodes.Count; n++)
            {
                if (subNodes[n].branch.Equals(node.branch))
                {
                    subNodes[n].parent = null;
                    subNodes.RemoveAt(n);
                    return;
                }
            }

            LogWrapper.DebugLog("[{0}] node: {1} is not part of branch: {2}", GetType(), Id, branch);
        }
Esempio n. 13
0
        public void ChangeState(string stateId, bool force = false)
        {
            LogWrapper.DebugLog("[{0}] receive command to change state to: {1}", GetType(), stateId);

            if (!IsValidState(stateId))
            {
                LogWrapper.Error("[{0}] State is note valid \"{1}\", nothing will happen", GetType(), stateId);
                return;
            }

            if (currentState == null)
            {
                currentState = GetState(stateId);
                // Reassign active Panels
                stateActivePanels = currentState.GetAllPanels(this);
                ShowStatePanels();
            }
            else if (!currentState.state.Equals(stateId) || force)
            {
                var newState = GetState(stateId);

                // Refresh panels that will remain active
                var refreshPanels = newState.GetFilteredPanels(this, stateActivePanels);
                foreach (var panel in refreshPanels)
                {
                    GetPanelView(panel).OnRefresh();
                }

                // Close panels that will not remain active
                foreach (var panel in stateActivePanels)
                {
                    if (!refreshPanels.Contains(panel))
                    {
                        GetPanelView(panel).OnDisappear();
                    }
                }

                LogWrapper.DebugLog("[{0}] Switching state from: {1} to {2}", GetType(), currentState.state, newState.state);
                currentState = newState;

                // Reassign active Panels
                stateActivePanels = currentState.GetAllPanels(this);
                ShowStatePanels();
            }

            if (currentState == null)
            {
                LogWrapper.DebugLog("[{0}] Current state is null: \"{1}\", are you passing the right state ? is the state configured ?", GetType(), stateId);
            }
        }
Esempio n. 14
0
        public static void Notify(string trigger)
        {
            #if (!UNITY_EDITOR || EDITOR_TUT) && !NO_TUT
            LogWrapper.DebugLog("[{0}] received trigger {1}", instance.GetType(), trigger);

            if (activeTut != null)
            {
                activeTut.Notify(trigger);
            }
            else
            {
                TryLoadTutorial(trigger);
            }
            #endif
        }
Esempio n. 15
0
        public static void logAssemblyVersion(Assembly assembly, LogWrapper aLog)
        {
            // Log the build version of this assembly
            LogWrapper    log          = (null == aLog) ? ConfigurationSetting.logWrap : aLog;
            AssemblyName  assemblyName = assembly.GetName();
            StringBuilder sb           = new StringBuilder(256);

            sb.Append(assemblyName.Name)
            .Append(" ")
            .Append(assemblyName.Version.ToString());
            string logMessage = sb.ToString();
            string logNote    = null;

            log.DebugLog(logMessage: logMessage, logNote: logNote);
        }
Esempio n. 16
0
        private void ReadAssetManifest()
        {
            var appConfig     = dataBase.Get <ApplicationConfig>(Constants.DB_KEY_APP_CONFIG);
            var assetManifest = Utils.ReadJsonFromResources <AssetManifest>(appConfig.assetManifestPath);

            foreach (var asset in assetManifest.root)
            {
                dataBase.AddReadonly(asset.id, asset.path, false);

                #if LOG_ASSET_MANIFET
                LogWrapper.DebugLog("[{0}] add asset to the database with key: {1}, path: {2}", GetType(), asset.id, asset.path);
                #endif
            }

            LogWrapper.Log("[{0}] assets loaded successfully and all paths added to the database", GetType());
        }
Esempio n. 17
0
        public void AddSubNode(Node node)
        {
            foreach (var n in subNodes)
            {
                if (n.branch.Equals(node.branch))
                {
                    LogWrapper.DebugLog("[{0}] node: {1} is already a sub node of branch: {2}", GetType(), Id, branch);
                    return;
                }
            }

            node.parent = this;
            subNodes.Add(node);

            LogWrapper.DebugLog("[{0}] Adding node {1} to {2}", GetType(), node.branch, branch);
        }
Esempio n. 18
0
 public virtual void Notify(string trigger)
 {
     if (current.Equals(TutorialState.Idle) && !hasComplete)
     {
         if (currentStep.successTrigger.Equals(trigger))
         {
             LogWrapper.DebugLog("[{0}] {1} Match step index {2} succ condition {3}", GetType(), id, currentStep.index, currentStep.successTrigger);
             elapseTime = currentStep.exitAnimationLength;
             current    = TutorialState.ExitStep;
             AnimateOutTutorialUI();
             Update();
         }
     }
     else
     {
         LogWrapper.DebugLog("[{0}] {1} received event when not in state {2}, will ignore the event", GetType(), id, current.ToString());
     }
 }
Esempio n. 19
0
        public static void CompleteTutorial(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                if (activeTut != null && activeTut.id.Equals(id))
                {
                    if (!activeTut.hasComplete)
                    {
                        activeTut.ForceComplete();
                    }

                    activeTut = null;
                }

                instance.database.Set("complete_" + id, true, true, true);

                LogWrapper.DebugLog("[{0}] Mark tutorial {1} as completed", instance.GetType(), id);
            }
        }
Esempio n. 20
0
        private void CreateEmptyNode(string parentBranch, string branch, string[] splittedBranch, int treeDepth)
        {
            var node = new Node();

            node.branch    = branch;
            node.Id        = splittedBranch[treeDepth];
            node.treeDepth = treeDepth;

            // We are adding it as a root
            if (treeDepth == 0)
            {
                LogWrapper.DebugLog("[{0}] Adding an empty node {1} as root", GetType(), splittedBranch[treeDepth]);
                dataRoots.Add(node);
            }
            else
            {
                var parent = ExtractNode(parentBranch);
                LogWrapper.DebugLog("[{0}] Adding an empty node {1} with parent {2}", GetType(), splittedBranch[treeDepth], parent.branch);
                parent.AddSubNode(node);
            }
        }
Esempio n. 21
0
        public void Init(T[] steps, GUIService guiService, DataBindingService databinding)
        {
            this.steps       = steps;
            this.guiService  = guiService;
            this.databinding = databinding;

            stepIndex = 0;
            LogWrapper.DebugLog("[{0}] {1} init with step count {2}", GetType(), id, steps.Length);

            // setup the awake function
            current    = TutorialState.AwakeStep;
            elapseTime = 0f;

            panelView = guiService.GetPanelView(Constants.PANEL_VIEW_ID_TUTORIAL);
            if (panelView == null)
            {
                throw new System.NullReferenceException("Could not find tutorial panel, please condif a panle in the gui config file with id: " + Constants.PANEL_VIEW_ID_TUTORIAL);
            }

            EventDispatcherService <ActiveTutorial <T> > .Dispatch(Constants.EVENT_TUT_INIT, this);
        }
Esempio n. 22
0
        protected virtual void AwakeStep(T step)
        {
            LogWrapper.DebugLog("[{0}] {1} awake tutorial step with index {2}", GetType(), id, currentStep.index);

            current    = TutorialState.EnterStep;
            elapseTime = currentStep.entryAnimLength;

            foreach (var handler in TutorialService <T> .actionHandlers)
            {
                handler.HandleAwakeActions(step.awakeActions);
            }

            if (currentStep.pause)
            {
                UnityEngine.Time.timeScale = 0f;
            }

            EnableTutorialUI();
            guiService.OpenPanelView(Constants.PANEL_VIEW_ID_TUTORIAL, true);
            AnimateInTutorialUI();
        }
Esempio n. 23
0
        protected virtual void ExitStep(T step, bool moveNext = true)
        {
            LogWrapper.DebugLog("[{0}] {1} exit tutorial step with index {2}", GetType(), id, currentStep.index);

            foreach (var handler in TutorialService <T> .actionHandlers)
            {
                handler.HandleAwakeActions(step.exitActions);
            }

            if (currentStep.pause)
            {
                UnityEngine.Time.timeScale = 1f;
            }

            DisableTutorialUI();
            guiService.ClosePanelView(Constants.PANEL_VIEW_ID_TUTORIAL);

            if (moveNext)
            {
                MoveToNextStep();
            }
        }
Esempio n. 24
0
        // Initiate Log based on configuration
        public void initLog()
        {
            Type t = Type.GetType(logClass);

            try
            {
                Log log = Activator.CreateInstance(t, scLogProductExtSignature, scLogProductExtName, scLogBusinessFunction) as Log;

                logWrap = new LogWrapper(log);

                if (logWrap != null)
                {
                    string logMessage = "Log is set up.";
                    string logNote    = "Log information " + logWrap.ToString();
                    logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
                }
            }
            catch (Exception)
            {
                String message = "Error in setting up log. Please contact the administrator.";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
Esempio n. 25
0
        void _recordContext_Saved(object sender, EventArgs e)
        {
            if (!isEnabledEditing && this.creatingRO == false)
            {
                return;
            }
            string logMessage, logNote;
            //get current sr id
            var sr_id = "";
            IList <ICustomAttribute> incCustomAttributes = Incident.CustomAttributes;

            string[] incCustomAttrs = { "Accelerator$ebs_sr_id" };
            Dictionary <String, Object> incCustomAttrsResults = CustomAttrHelper.fetchCustomAttrValue(incCustomAttributes, incCustomAttrs, this._logIncidentId, 0);

            sr_id = incCustomAttrsResults["Accelerator$ebs_sr_id"] != null ? incCustomAttrsResults["Accelerator$ebs_sr_id"].ToString() : "";

            //Check whether need to send request to server
            if (!String.IsNullOrWhiteSpace(sr_id) && _repairOrderControl.isAddingRO == true)
            {
                //Add new RO to server
                logMessage = "Need to add a Repair Order for SR. SR ID = " + sr_id;
                logNote    = "";
                _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

                SaveRepairOrderToServer(Convert.ToDecimal(sr_id));
                _repairOrderControl.isAddingRO = false;
            }
            else if (!String.IsNullOrWhiteSpace(_repairOrderControl.changingRONum) && _repairOrderControl.isChangingRO == true)
            {
                //Update RO to server
                logMessage = "Need to edit Repair Order. Repair Order id = " + _repairOrderControl.changingRONum;
                logNote    = "";
                _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

                SaveRepairOrderToServer(Convert.ToDecimal(sr_id));
                _repairOrderControl.isChangingRO = false;
            }
        }