/// <summary>
 /// Refresh Workspace on form close
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void IncidentVinFormClosed(object sender, FormClosedEventArgs e)
 {
     if (_buildCount != 0)
     {
         _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
     }
 }
 private void SalesReleaseVINSelection_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (_buildCount != 0)
     {
         MessageBox.Show("In order to see newly added or removed SRs make sure to refresh workspace report by selecting the SR qty link. ");
         _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
     }
 }
예제 #3
0
        /// <summary>
        /// Method which is called when Workspace Rule Action "Send_SupplierCredit" is invoked.
        /// </summary>
        public void SendSupplierCredit()
        {
            SupplierCreditModel scModel = new SupplierCreditModel();

            scModel.GetSupplierCreditInfo(this);
            _form.Hide();
            _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);//save to refresh report
        }
예제 #4
0
        private void _recordContext_DataLoaded(object sender, EventArgs e)
        {
            if (_recordContext != null)
            {
                //string CompanyID = string.Empty;
                var workspace = (_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact);
                if (workspace.CustomField != null && workspace.CustomField.Any(z => z.CfId == _CompanyID_CustomField_ID) && !String.IsNullOrEmpty(workspace.CustomField.First(z => z.CfId == _CompanyID_CustomField_ID).ValStr))
                {
                    CompanyID = workspace.CustomField.First(z => z.CfId == _CompanyID_CustomField_ID).ValStr;
                }
                if (!string.IsNullOrWhiteSpace(CompanyID))
                {
                    if (_attemptedSaveAndClose)
                    {
                        bool _error = false;
                        switch (UpdateStatusHandler.Instance.GetUpdateStatus(CompanyID).updateCustomerStatus)
                        {
                        case UpdateStatuses.UpdateStatus.Called:
                            _error = true;
                            break;

                        case UpdateStatuses.UpdateStatus.Failure:
                            _error = true;
                            break;
                        }
                        switch (UpdateStatusHandler.Instance.GetUpdateStatus(CompanyID).updateOrgStatus)
                        {
                        case UpdateStatuses.UpdateStatus.Called:
                            _error = true;
                            break;

                        case UpdateStatuses.UpdateStatus.Failure:
                            _error = true;
                            break;
                        }
                        switch (UpdateStatusHandler.Instance.GetUpdateStatus(CompanyID).updateSalesStatus)
                        {
                        case UpdateStatuses.UpdateStatus.Called:
                            _error = true;
                            break;

                        case UpdateStatuses.UpdateStatus.Failure:
                            _error = true;
                            break;
                        }
                        if (!_error)
                        {
                            _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Close);
                        }
                    }
                }
            }
        }
예제 #5
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)
        {
            string[] pResults;
            Decimal  calc = 0;
            Decimal  dAmt = 0;
            string   amt  = "";

            try
            {
                _sClaimRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
                string sClaim = _sClaimRecord.Id.ToString();

                pResults = _rnConnectService.getCredits(sClaim);


                List <string> creds = new List <string>();


                switch (ActionName)
                {
                case "Recovered":


                    if (pResults != null && pResults.Length > 0)
                    {
                        creds = pResults.ToList();

                        foreach (string c in creds)
                        {
                            amt  = c.Split('~')[0];
                            dAmt = Convert.ToDecimal(amt);

                            calc = calc + dAmt;
                        }
                        calc = Math.Round(calc, 2);
                    }
                    break;

                default:
                    break;
                }


                SetFieldValue("recovered_amount", calc.ToString());
                _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
            }
            catch (Exception e)
            { MessageBox.Show("error in recovered calculation"); }
        }
 internal void LoadData()
 {
     try
     {
         long   ParyId     = 0;
         string RFC        = "";
         string RFCCompare = "";
         Incident = (IIncident)recordContext.GetWorkspaceRecord(WorkspaceRecordType.Incident);
         IList <ICfVal> customAttributes = Incident.CustomField;
         foreach (ICfVal custom in customAttributes)
         {
             if (custom.CfId == 57)
             {
                 ParyId = Convert.ToInt64(custom.ValStr);
             }
             if (custom.CfId == 59)
             {
                 RFC = String.IsNullOrEmpty(custom.ValStr) ? "" : custom.ValStr;
             }
         }
         if (ParyId != 0)
         {
             getCustomerData(ParyId);
             RFCCompare = GetRFC(ParyId);
         }
         if (!String.IsNullOrEmpty(RFCCompare))
         {
             if (RFCCompare != ".")
             {
                 if (RFCCompare.Trim() != RFC.Trim())
                 {
                     foreach (ICfVal custom1 in customAttributes)
                     {
                         if (custom1.CfId == 59)
                         {
                             custom1.ValStr = RFCCompare;
                             recordContext.ExecuteEditorCommand(EditorCommand.Save);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.StackTrace);
     }
 }
예제 #7
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)
        {
            switch (ActionName)
            {
            case "PopulateContactDetails":
                _recordContext.ExecuteEditorCommand(global::RightNow.AddIns.Common.EditorCommand.Save);
                PopulateContactDetailsHandler populatecontact = new PopulateContactDetailsHandler(_recordContext);
                populatecontact.PopulateContactDetails();
                break;

            case "WOTypeDuration":
                PopulateManualDuration populateDuration = new PopulateManualDuration(_recordContext);
                populateDuration.Handler();
                break;

            default:
                break;
            }
        }
예제 #8
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;
                }
            }
        }
예제 #9
0
        void SaveRepairOrderToServer(decimal sr_id)
        {
            string logMessage = "Create/Update RO.";
            string logNote    = "";

            _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

            string      ro_saved_num;
            RepairOrder ro = null;

            ro = new RepairOrder();

            ro.ServiceRequestID = sr_id;
            if (_repairOrderControl.isAddingRO == true)
            {
                //Create Additional RO
                ro.Quantity             = Convert.ToDecimal(_repairOrderControl.InputQuantity);
                ro.UnitOfMeasure        = _repairOrderControl.SelectedUnit;
                ro.InventoryItemID      = this.currentInventoryItemID;
                ro.SerialNumber         = this.current_serial_num;
                ro.ApprovalRequired     = _repairOrderControl.SelectedApprovalRequired;
                ro.Currency             = "USD";
                ro.ResourceID           = _ebsDefaultSrOwnerId;
                ro.ProblemDescription   = _repairOrderControl.InputProblem;
                ro.HasValidSerialNumber = "Y";
            }
            else if (_repairOrderControl.isChangingRO == true)
            {
                //Edit RO
                ro.RepairNumber         = _repairOrderControl.changingRONum;
                ro.RepairStatus         = selected_status;
                ro.RepairStatusID       = selected_status_id;
                ro.StoredRepairStatus   = stored_status;
                ro.StoredRepairStatusID = stored_status_id;
            }


            try
            {
                if (_repairOrderControl.isChangingRO == true)
                {
                    logMessage = "Ready to update Repair Order. SR ID = " + sr_id + "; RO Number = " + ro.RepairLineID;
                    logNote    = "";
                    _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);
                    ro_saved_num = ro.Update(_logIncidentId, 0);
                }
                else
                {
                    logMessage = "Ready to update Repair Order. RO Number = " + ro.RepairLineID;
                    logNote    = "";
                    _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

                    ro_saved_num = ro.Create(_logIncidentId, 0);
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "Error in creating/updating Repair Order.Error Message: " + ex.Message;
                logNote    = "";
                _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

                return;
            }

            if (ro_saved_num == "-1")
            {
                //Cannot change status between statuses
                string message = ro.ErrorMessage;
                MessageBox.Show(message, "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);

                logMessage = "Error in creating/updating RepairOrder. " + message;
                _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage);
                return;
            }
            else if (String.IsNullOrEmpty(ro_saved_num))
            {
                string message = "There has been an error communicating with EBS. Please check log for detail.";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "Error in creating/updating RepairOrder. Response's error message: " + ro.ErrorMessage;
                logNote    = "";
                _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);
                return;
            }
            else
            {
                // Save successfully
                logMessage = "Creating/updating Repair Order successfully. RO Num = " + ro.RepairLineID;
                logNote    = "";
                _log.DebugLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote);

                _repairOrderControl.previousRONum = ro_saved_num;

                if (!isEnabledEditing)
                {
                    string       message = "Repair Order has been created in EBS. Do you want to refresh current Repair Order List?";
                    DialogResult result  = MessageBox.Show(message, "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result == DialogResult.Yes)
                    {
                        _recordContext.TriggerNamedEvent("CancelCreatingRO");
                        _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Refresh);
                    }
                }
            }
        }
        /// <summary>
        /// To get Parts details and Call Webservice
        /// </summary>
        public void ProcessSelectedRowInfo()
        {
            POEHEADERREC           partsHeaderRecord = new POEHEADERREC();
            RightNowConnectService _rnConnectService = RightNowConnectService.GetService();
            /*Get Work Order Info*/

            //Get ship set from Current Reported Incident
            string shipSet = _rnConnectService.GetCOFieldValue("ship_set", _workOrder);

            //Get Num of VIN for which this order will be placed
            int numOfVIN = 1;//will always be one

            string orderTypeId = _rnConnectService.GetCOFieldValue("Order_Type", _workOrderExtra);

            if (orderTypeId == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Order Type is empty");
                return;
            }
            partsHeaderRecord.ORDER_TYPE = _rnConnectService.GetOrderTypeName(Convert.ToInt32(orderTypeId));

            string shipToId = _rnConnectService.GetCOFieldValue("Ship_To_Site", _workOrder);

            if (shipToId == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Ship to Site is empty");
                return;
            }
            partsHeaderRecord.SHIP_TO_ORG_ID = Convert.ToInt32(_rnConnectService.GetEbsID(Convert.ToInt32(shipToId)));

            string shipDate = _rnConnectService.GetCOFieldValue("requested_ship_date", _workOrder);

            if (shipDate == String.Empty)
            {
                shipDate = DateTime.Today.ToString();//set to today's date
            }
            partsHeaderRecord.SHIP_DATE = Convert.ToDateTime(shipDate).ToString("dd-MMM-yyyy");

            string dcID = _rnConnectService.GetCOFieldValue("Distribution_center", _workOrderExtra);

            if (dcID == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Distribution Center is empty");
                return;
            }
            partsHeaderRecord.WAREHOUSE_ORG = _rnConnectService.GetDistributionCenterIDName(Convert.ToInt32(dcID));

            string Organization = _rnConnectService.GetCOFieldValue("Organization", _workOrder);

            partsHeaderRecord.CUSTOMER_ID = Convert.ToInt32(_rnConnectService.GetCustomerEbsID(Convert.ToInt32(Organization)));

            string incVinID = _rnConnectService.GetCOFieldValue("Incident_VIN_ID", _workOrder);

            partsHeaderRecord.CLAIM_NUMBER = _rnConnectService.GetRefNum(Convert.ToInt32(incVinID));

            partsHeaderRecord.PROJECT_NUMBER = _rnConnectService.GetCOFieldValue("Project_Number", _workOrder);
            // partsHeaderRecord.RETROFIT_NUMBER = _rnConnectService.GetCOFieldValue("retrofit_number", _workOrder);
            partsHeaderRecord.CUST_PO_NUMBER        = _rnConnectService.GetCOFieldValue("PO_Number", _workOrder);//
            partsHeaderRecord.SHIPPING_INSTRUCTIONS = _rnConnectService.GetCOFieldValue("Shipping_Instruction", _workOrder);

            List <OELINEREC> lineRecords = new List <OELINEREC>();

            //Loop over each selected parts that user wants to order
            //Get required info needed for EBS web-service
            foreach (IReportRow row in _selectedRows)
            {
                OELINEREC           lineRecord = new OELINEREC();
                IList <IReportCell> cells      = row.Cells;

                foreach (IReportCell cell in cells)
                {
                    if (cell.Name == "Part ID")
                    {
                        //Create PartsOrder record first as EBS web-service need PartsOrder ID
                        lineRecord.ORDERED_ID = _rnConnectService.CreatePartsOrder(Convert.ToInt32(cell.Value));//Pass parts Order ID
                    }
                    if (cell.Name == "Part #")
                    {
                        lineRecord.ORDERED_ITEM = cell.Value;
                    }
                    if (cell.Name == "Qty")
                    {
                        lineRecord.ORDERED_QUANTITY = Convert.ToDouble(Math.Round(Convert.ToDecimal(cell.Value), 2).ToString()) * numOfVIN;//get total qyantity
                    }
                    if (cell.Name == "Source Type")
                    {
                        lineRecord.SOURCE_TYPE = cell.Value;
                    }
                }
                lineRecord.SHIP_SET = shipSet;
                lineRecords.Add(lineRecord);
            }
            //Call PartsRequired Model to send parts info to EBS
            PartsRequiredModel partsRequired = new PartsRequiredModel(_recordContext);

            partsRequired.GetDetails(lineRecords, _workOrder, partsHeaderRecord, Convert.ToInt32(shipToId));
            form.Hide();
            _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
        }
예제 #11
0
        /// <summary>
        /// To get Parts details and Call Webservice
        /// </summary>
        public void ProcessSelectedRowInfo()
        {
            POEHEADERREC           partsHeaderRecord = new POEHEADERREC();
            RightNowConnectService _rnConnectService = RightNowConnectService.GetService();
            /*Get Reported Incident Info*/

            //Get Incident Type
            string incType = _rnConnectService.getIncidentField("c", "Incident Type", _incidentRecord);

            //Get ship set from Current Reported Incident
            string shipSet = _rnConnectService.getIncidentField("CO", "ship_set", _incidentRecord);

            //Get Num of VIN for which this order will be placed
            string numOfVINInString = _rnConnectService.getIncidentField("CO", "no_of_vins", _incidentRecord);

            if (numOfVINInString == String.Empty)
            {
                if (incType == "30")        //case of claim type
                {
                    numOfVINInString = "1"; //set it to 1
                }
                else
                {
                    form.Hide();
                    MessageBox.Show("Number Of VIN is empty");
                    return;
                }
            }
            int numOfVIN = Convert.ToInt32(numOfVINInString);

            string orderTypeId = _rnConnectService.getIncidentField("CO", "order_type", _incidentRecord);

            if (orderTypeId == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Order Type is empty");
                return;
            }
            partsHeaderRecord.ORDER_TYPE = _rnConnectService.GetOrderTypeName(Convert.ToInt32(orderTypeId));

            string shipToId = _rnConnectService.getIncidentField("CO", "Ship_to_site", _incidentRecord);

            if (shipToId == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Ship to Site is empty");
                return;
            }
            partsHeaderRecord.SHIP_TO_ORG_ID = Convert.ToInt32(_rnConnectService.GetEbsID(Convert.ToInt32(shipToId)));

            string shipDate = _rnConnectService.getIncidentField("CO", "requested_ship_date", _incidentRecord);

            if (shipDate == String.Empty)
            {
                if (incType == "30")                      //case of claim
                {
                    shipDate = DateTime.Today.ToString(); //set to today's date
                }
                else
                {
                    form.Hide();
                    MessageBox.Show("Requested Ship Date is empty");
                    return;
                }
            }
            partsHeaderRecord.SHIP_DATE = Convert.ToDateTime(shipDate).ToString("dd-MMM-yyyy");

            string dcID = _rnConnectService.GetIncidentExtraFieldValue("Distribution_center", _incidentExtra);

            if (dcID == String.Empty)
            {
                form.Hide();
                MessageBox.Show("Distribution Center is empty");
                return;
            }
            partsHeaderRecord.WAREHOUSE_ORG = _rnConnectService.GetDistributionCenterIDName(Convert.ToInt32(dcID));

            partsHeaderRecord.CUSTOMER_ID           = Convert.ToInt32(_rnConnectService.GetCustomerEbsID((int)_incidentRecord.OrgID));
            partsHeaderRecord.CLAIM_NUMBER          = _incidentRecord.RefNo;
            partsHeaderRecord.PROJECT_NUMBER        = _rnConnectService.getIncidentField("CO", "project_number", _incidentRecord);
            partsHeaderRecord.RETROFIT_NUMBER       = _rnConnectService.getIncidentField("CO", "retrofit_number", _incidentRecord);
            partsHeaderRecord.CUST_PO_NUMBER        = _rnConnectService.getIncidentField("CO", "PO_Number", _incidentRecord);
            partsHeaderRecord.SHIPPING_INSTRUCTIONS = _rnConnectService.getIncidentField("CO", "shipping_instructions", _incidentRecord);

            string partOdrInstrIDString = _rnConnectService.getIncidentField("CO", "PartOrderInstruction_ID", _incidentRecord);
            int    partOdrInstrID       = 0;//default case where we won't have partsorderinstruction

            if (partOdrInstrIDString != String.Empty)
            {
                partOdrInstrID = Convert.ToInt32(partOdrInstrIDString);
            }

            //List<int> partsIDOrdered = new List<int>();
            List <OELINEREC> lineRecords = new List <OELINEREC>();

            //Loop over each selected parts that user wants to order
            //Get required info needed for EBS web-service
            double oq = 0.00;

            foreach (IReportRow row in _selectedRows)
            {
                OELINEREC           lineRecord = new OELINEREC();
                IList <IReportCell> cells      = row.Cells;

                foreach (IReportCell cell in cells)
                {
                    if (cell.Name == "Part ID")
                    {
                        //Create PartsOrder record first as EBS web-service need PartsOrder ID
                        lineRecord.ORDERED_ID = _rnConnectService.CreatePartsOrder(Convert.ToInt32(cell.Value));//Pass parts Order ID
                    }
                    if (cell.Name == "Part #")
                    {
                        lineRecord.ORDERED_ITEM = cell.Value;
                    }
                    if (cell.Name == "Qty")
                    {
                        oq = Convert.ToDouble(Math.Round(Convert.ToDecimal(cell.Value), 2).ToString()) * numOfVIN;
                        lineRecord.ORDERED_QUANTITY = Math.Round(oq, 2);//get total qyantity
                    }
                    if (cell.Name == "Source Type")
                    {
                        lineRecord.SOURCE_TYPE = cell.Value;
                    }
                }
                lineRecord.SHIP_SET = shipSet;

                lineRecords.Add(lineRecord);
            }
            //Call PartsRequired Model to send parts info to EBS
            PartsRequiredModel partsRequired = new PartsRequiredModel(_recordContext);

            partsRequired.GetDetails(lineRecords, _incidentRecord, numOfVIN, partsHeaderRecord, Convert.ToInt32(shipToId), partOdrInstrID);
            form.Hide();
            _recordContext.ExecuteEditorCommand(RightNow.AddIns.Common.EditorCommand.Save);
        }