Esempio n. 1
0
        /// <summary>
        /// Method which is called when any Workspace Rule Action is invoked.
        /// </summary>
        /// <param name="ActionName">The name of the Workspace Rule Action that was invoked.</param>
        public void RuleActionInvoked(string ActionName)
        {
            if (_recordContext != null)
            {
                _incidentRecord = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident;
                if (form.IsDisposed == true)
                {
                    form = new ProgressForm();
                }
                switch (ActionName)
                {
                case "singleWarrantyCheck":
                    form.Show();

                    SingleWarrantyModel singleWarranty = new SingleWarrantyModel();
                    singleWarranty.WarrantyCheck(_incidentRecord);
                    form.Hide();
                    _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
                    break;

                case "massWarrantyCheck":

                    form.Show();
                    MultiVinWarrantyModel massWarranty = new MultiVinWarrantyModel();
                    massWarranty.MultiVinWarrantyCheck(_incidentRecord);
                    form.Hide();
                    _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
                    break;

                case "selectVIN":
                    //If existing record
                    if (_incidentRecord != null && _incidentRecord.ID > 0)
                    {
                        selectSR_VIN();
                        //System.Threading.Thread selectSrVinThread = new System.Threading.Thread(selectSR_VIN);
                        //selectSrVinThread.Start();
                    }
                    //If new then first create the incident and then call function to show SR/VIN form
                    else
                    {
                        _showSRFormAfterSave = true;
                        _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
                    }

                    break;

                case "orderParts":
                    form.Show();
                    PartsOrderModel partsOrder = new PartsOrderModel();
                    partsOrder.OrderParts(_incidentRecord);
                    form.Hide();
                    _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
                    break;

                case "populateExpirationDate":
                    ExpirationDate expdate = new ExpirationDate(_recordContext);
                    expdate.SetExpirationDate();
                    break;

                case "supplierWarrantyCheck":
                    // This functionality is taken care in CPM

                    /*form.Show();
                    *  SupplierWarrantyCheckModel supplierWarranty = new SupplierWarrantyCheckModel();
                    *  supplierWarranty.GetDetails(_incidentRecord,_recordContext);
                    *  form.Hide();*/
                    //_recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
                    break;

                default:
                    break;
                }
            }
        }