void _recordContext_DataLoaded(object sender, System.EventArgs e) { string recordTypeName = _recordContext.WorkspaceTypeName; if (recordTypeName == "Incident") { IIncident i = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; IContact c = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; this.EnableControl(incident: i, contact: c); return; } if (recordTypeName == "Contact") { IContact c = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; this.EnableControl(contact: c); return; } if (recordTypeName == "Chat") { IChat chat = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Chat) as IChat; this.EnableControl(chat: chat); if (this._enableAutoSearchInChat == true) { _ebsContactSearchControl.autoSearchParameterInvoke(); } return; } }
/// <summary> /// Method called by data load event. It does the following: /// 1> Get Onload FSAR value /// 2> Get all affected VIN mapped to currently opened reported Incident /// 3> If _showSRFormAfterSave is set then show SR/VIN form /// </summary> private void _recordContext_DataLoaded(object sender, EventArgs e) { //Making onload async to reduce time of record load var backgroundService = new BackgroundServiceUtil(); backgroundService.RunAsync(() => { //Get all affected VIN's of reported incident _affectedBusIds = new List <string>(); _incidentRecord = (IIncident)_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident); if (_incidentRecord != null) { string[] response = RightNowConnectService.GetService().GetAffectedBus(_incidentRecord.ID); if (response != null) { _affectedBusIds = response.ToList(); } } //Get FSAR value on Load _onLoadFSARVal = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "FSAR", _incidentRecord); string[] internalIncident = RightNowConnectService.GetService().GetAllInternalIncident(_incidentRecord.ID); if (internalIncident != null) { RightNowConnectService.GetService().setIncidentField("CO", "no_of_sr", internalIncident.Length.ToString(), _incidentRecord); } }); }
public void PopulateLeadDetails() { IContact contactRecord = _recordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; IIncident incidentRecord = _recordContext.GetWorkspaceRecord(WorkspaceRecordType.Incident) as IIncident; string leadType = populateLeadType(); IList <IGenericField> fields = _leadRecord.GenericFields; foreach (IGenericField field in fields) { switch (field.Name) { case "lead_name": if (contactRecord != null && incidentRecord != null) { string contactName = contactRecord.NameFirst + " " + contactRecord.NameLast; if (leadType.Equals(OSCOpportunitiesCommon.OpportunityRecordType)) { field.DataValue.Value = String.Format(OSCOpportunitiesCommon.OpportunityName, contactName, incidentRecord.RefNo); } else if (leadType.Equals(OSCOpportunitiesCommon.SalesLeadRecordType)) { field.DataValue.Value = String.Format(OSCOpportunitiesCommon.SalesLeadName, contactName, incidentRecord.RefNo); } } break; } } }
public virtual void ResolveIncidentOfTypeFailedJob() { // given Deploy("resources/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn"); IProcessInstance processInstance = runtimeService.StartProcessInstanceByKey("failingProcess"); // when IList <IJob> jobs = engineRule.ManagementService.CreateJobQuery().ToList() /*.WithRetriesLeft().List()*/; foreach (IJob job in jobs) { engineRule.ManagementService.SetJobRetries(job.Id, 1); try { engineRule.ManagementService.ExecuteJob(job.Id); } catch (System.Exception ex) { } } // then IIncident incident = runtimeService.CreateIncidentQuery(c => c.ProcessDefinitionId == processInstance.Id).FirstOrDefault(); try { runtimeService.ResolveIncident(incident.Id); Assert.Fail("Exception expected"); } catch (BadUserRequestException e) { Assert.That(e.Message, Does.Contain("Cannot resolve an incident of type failedJob")); } }
/// <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) { try { switch (ActionName) { case "RPSM": _incidentRecord = (IIncident)_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident); _contactRecord = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; string RPSM = _rnConnectService.GetOrgTerritory(_contactRecord.OrgID.ToString(), ActionName); if (!string.IsNullOrEmpty(RPSM)) { _incidentRecord.Assigned.AcctID = Int32.Parse(RPSM); } break; case "RegDirector": _incidentRecord = (IIncident)_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident); _contactRecord = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; string region = _rnConnectService.GetOrgTerritory(_contactRecord.OrgID.ToString(), ActionName); string RegDir = _rnConnectService.GetRegion(region); if (!string.IsNullOrEmpty(RegDir)) { _incidentRecord.Assigned.AcctID = Int32.Parse(RegDir); } break; } } catch (Exception e) { MessageBox.Show("error" + e); } }
/// <summary> /// Get required details to build WebRequest /// </summary> /// <param name="partNumber"></param> /// <param name="partQty"></param> /// <param name="incidentRecord"></param> /// <param name="partsOrderID"></param> public void GetDetails(List <OELINEREC> lineRecords, IIncident incidentRecord, int numOfVIN, POEHEADERREC partsHeaderRecord, int shipToSiteID, int partOdrInstrID) { _incidentRecord = incidentRecord; _lineRecords = lineRecords; _partsHeaderRecord = partsHeaderRecord; //If all required info is valid then form jSon request parameter var content = GetReqParam(); var jsonContent = WebServiceRequest.JsonSerialize(content); jsonContent = jsonContent.Replace("xmlns", "@xmlns"); //Call webservice string jsonResponse = WebServiceRequest.Get(_curlURL, jsonContent, "POST"); if (jsonResponse == "") { //Destroy the partsorder objects _rnConnectService.DestroyPartsOrder(_lineRecords); ReportCommandAddIn.form.Hide(); MessageBox.Show("Server didn't return any info"); } else { ExtractResponse(jsonResponse, numOfVIN, shipToSiteID, partOdrInstrID); } }
public void GenerateAttachmentsFromFile(IIncident incident) { var files = new List <BinaryFile>(); if (incident != null && incident.AttachmentList.Any()) { foreach (var attachment in incident.AttachmentList) { var fileList = GetAttachments(attachment.File); if (fileList.Any()) { files.AddRange(fileList); } } } foreach (var file in files) { var attachment = InterfaceActivator.Create <IAttachment>(); attachment.File = file; attachment.CreationDate = DateTime.Now; attachment.CreationAuthor = UserManager.Instance.GetCurrentUser(); attachment.Save(); incident.MailAttachments.Add(attachment); } incident.Save(); }
public virtual void testQueryWithReadPermissionOnProcessInstance() { // given startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY); startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY); string ProcessInstanceId = startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY).Id; startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY); startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY); startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY); startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY); createGrantAuthorization(Resources.ProcessInstance, ProcessInstanceId, userId, Permissions.Read); // when IQueryable <IIncident> query = runtimeService.CreateIncidentQuery(); // then //verifyQueryResults(query, 1); IIncident incident = query.First(); Assert.NotNull(incident); Assert.AreEqual(ProcessInstanceId, incident.ProcessInstanceId); }
/// <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; string[] lResults; string[] oResults; decimal totallabor = 0; decimal totalpartsCost = 0; decimal totalpartsPrice = 0; decimal totalother = 0; decimal net = 0; decimal approvalamt = 0; try { _incidentRecord = (IIncident)_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident); pResults = _rnConnectService.GetParts(_incidentRecord.ID.ToString()); lResults = _rnConnectService.GetLabor(_incidentRecord.ID.ToString()); totallabor = Labor(lResults); oResults = _rnConnectService.GetOther(_incidentRecord.ID.ToString()); totalother = OtherCharges(oResults); totalpartsPrice = PartsPrice(pResults); totalpartsCost = PartsCost(pResults); // MessageBox.Show("action" + ActionName); /// MessageBox.Show("totalpartsCost" + totallabor); switch (ActionName) { case "NetReg": net = totalpartsPrice + totallabor + totalother; approvalamt = net; break; case "NetWCD": approvalamt = totalpartsCost + totallabor + totalother; net = totalpartsPrice + totallabor + totalother; break; default: break; } SetIncidentField("c", "Net Amount", Math.Round(net, 0).ToString()); SetIncidentField("CO", "net_amount_text", Math.Round(net, 2).ToString()); SetIncidentField("c", "Approval_Amount", Math.Round(approvalamt, 0).ToString()); } catch (Exception e) { MessageBox.Show("error in net calculation"); } }
public object Execute(CommandContext commandContext) { IIncident incident = commandContext.IncidentManager.FindIncidentById(_incidentId); EnsureUtil.EnsureNotNull(typeof(NotFoundException), "Cannot find an incident with id '" + _incidentId + "'", "incident", incident); if (incident.IncidentType.Equals("failedJob") || incident.IncidentType.Equals("failedExternalTask")) { throw new BadUserRequestException("Cannot resolve an incident of type " + incident.IncidentType); } EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "", "executionId", incident.ExecutionId); var execution = commandContext.ExecutionManager.FindExecutionById(incident.ExecutionId); EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Cannot find an execution for an incident with id '" + _incidentId + "'", "execution", execution); foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.CheckUpdateProcessInstance(execution); } execution.ResolveIncident(_incidentId); return(null); }
public void ShowIncident(IIncident incident) { IIncidentsGridViewRowPresenter rowPresenter = rowPresenterFactory.Create(incident); rowPresenters.Add(incident, rowPresenter); rowPresenter.Show(); }
/* For showing the Siebel Contact Details. * It can also be run in Report Explorer by creating a required filter on PERSON_PARTY_ID */ public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary <string, string> dictDetail = null; if (_context == null) { return(reportRows); } IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (incidentRecord == null) { return(reportRows); } string serialNum = null; // get the serialNum custom attribute on the incident workspace serialNum = getIncidentWSCustomAttr(incidentRecord, "siebel_serial_number"); if (serialNum == "" || serialNum == null) { return(reportRows); } string logMessage = "Calling LookupAsset for Asset." + "serialNum: " + serialNum; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); string orgId = null; IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (contactRecord != null) { orgId = getContactOrgIdCustomAttr(contactRecord); } if (orgId == "" || orgId == null) { return(reportRows); } // call Siebel Asset.LookupAsset, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Asset.LookupAsset(columns, serialNum, orgId, 0, incidentRecord.ID); if (dictDetail == null) { return(reportRows); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
void getrecords() { var responseValue = string.Empty; try { _OracleBaseUrl = "https://coeinterview-1.custhelp.com/services/rest/connect/v1.3/analyticsReportResults"; _incident = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; var incidentID = _incident.ID; var ReportID = 100005; var payload = "{\"id\":" + ReportID + ",\"filters\":{\"name\":\"RefNumber\",\"values\":\"" + incidentID + "\"}}"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_OracleBaseUrl); request.Method = "POST"; request.Timeout = 30000; request.ContentType = "application/json"; request.ContentLength = payload.Length; request.Headers.Add("Authorization", "Basic Y29lX2d1cnByZWV0OlNyaXNodGlAMjAxOQ=="); using (Stream webStream = request.GetRequestStream()) using (StreamWriter requestWriter = new StreamWriter(webStream, System.Text.Encoding.ASCII)) { requestWriter.Write(payload); } try { WebResponse webResponse = request.GetResponse(); using (Stream webStream = webResponse.GetResponseStream() ?? Stream.Null) using (StreamReader responseReader = new StreamReader(webStream)) { responseValue = responseReader.ReadToEnd(); Console.Out.WriteLine(responseValue); var count = (JObject.Parse(responseValue)).First; if (Convert.ToInt32(count.ToString().Split(':')[1]) > 0) { string message = "Do you want to Close the parent Incident,If Clicked Yes Child Incidents will get close with this incident, Please refer to Related Incident Tab for Open Child Incidents"; string title = "Incident Alert"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning); if (result == DialogResult.No) { IsCanceled = true; } } } } catch (Exception ex) { Console.Out.WriteLine("-----------------"); Console.Out.WriteLine(ex.Message); } } catch (Exception ex) { Console.Out.WriteLine("-----------------"); Console.Out.WriteLine(ex.Message); } }
/// <summary> /// Get required details to build WebRequest /// </summary> public void GetDetails(IIncident incidentRecord, IRecordContext recordContext) { _incidentRecord = incidentRecord; //Get the VIN Number string[] vinDetails = RightNowConnectService.GetService().getBusInfo(_incidentRecord.ID); if (vinDetails != null) { _vin = vinDetails[0].Split('~')[0]; } //Get OOTB ORG ID _supplierID = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "supplier_from_webservice", _incidentRecord); if (_supplierID == String.Empty) { WorkspaceAddIn.InfoLog("Supplier ID is blank"); return; } else { //Get EBS ORG ID _supplierID = RightNowConnectService.GetService().GetEbsOrgID(Convert.ToInt32(_supplierID)); } _causalPartNumber = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "causal_part_nmbr", _incidentRecord); if (_causalPartNumber == String.Empty) { WorkspaceAddIn.InfoLog("Causal Part Number is blank"); return; } _odometerReading = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "odometer_reading", _incidentRecord); if (_odometerReading == String.Empty) { WorkspaceAddIn.InfoLog("Odometer Reading is blank"); return; } _failedDate = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "failure_date", _incidentRecord); if (_failedDate == String.Empty) { WorkspaceAddIn.InfoLog("Failed Date is blank"); return; } //If all required info is valid then form jSon request parameter var content = GetReqParam(); var jsonContent = WebServiceRequest.JsonSerialize(content); jsonContent = jsonContent.Replace("xmlns", "@xmlns"); //Call webservice string jsonResponse = WebServiceRequest.Get(_curlURL, jsonContent, "POST"); if (jsonResponse == "") { WorkspaceAddIn.InfoLog("Server didn't return any info"); } else { ExtractResponse(jsonResponse); } return; }
/// <summary> /// Проверяет наличие запущенных процессов с данным инцидентом /// </summary> /// <param name="incident"></param> /// <returns></returns> public bool CheckStartedProcesses(IIncident incident) { var transformationProvider = Locator.GetServiceNotNull <ITransformationProvider>(); using (var reader = transformationProvider.ExecuteQuery(string.Format(@"select * from P_UvedomlenieObIncidente where incident = {0}", incident.Id))) { return(reader.Read()); } }
/// <summary> /// /// </summary> public void Execute(IList <IReportRow> rows) { _selectedRows = rows; _recordContext = _globalContext.AutomationContext.CurrentWorkspace; _incidentRecord = (IIncident)_recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident); System.Threading.Thread th = new System.Threading.Thread(ProcessSelectedRowInfo); th.Start(); form.Show(); }
// get the ebs_order_id custom attribute on Incident Workspace protected int getEbsOrderIdCustomAttr(IIncident incidentRecord) { IList<ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; foreach (ICustomAttribute cusAttr in customAttributes) { if (cusAttr.PackageName == "Accelerator" && cusAttr.GenericField.Name == "Accelerator$ebs_order_id") return cusAttr.GenericField.DataValue.Value != null ? (int)cusAttr.GenericField.DataValue.Value : 0; } return 0; }
protected override void SetUp() { listener = NewMock <IIncidentsListener>(); incidentFactory = NewMock <IIncidentFactory>(); incidents = new IncidentsCollection(listener, incidentFactory); incident1 = NewMock <IIncident>(); incident2 = NewMock <IIncident>(); }
/* For showing the Siebel Activity Details. * It can also be run in Report Explorer by creating a required filter on PERSON_PARTY_ID */ public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary <string, string> dictDetail = null; if (_context == null) { return(reportRows); } String actvtyId = ""; string filterValue = null; // filter is ActivityId if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode actvtyIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ActivityId", this.Parent.Name, this.Name)); if (actvtyIDFilterNode != null) { actvtyId = actvtyIDFilterNode.ReportFilter.Value; } } IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; string siebelSrId = null; if (incidentRecord != null) { siebelSrId = getIncidentWSCustomAttr(incidentRecord, "siebel_sr_id"); } if (siebelSrId == "" || siebelSrId == null) { return(reportRows); } string logMessage = "Calling LookupActivityDetail for a Siebel SR." + "siebelSrId: " + siebelSrId + ", actvtyId: " + actvtyId; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); // call Siebel Activity.LookupActivityDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Activity.LookupActivityDetail(columns, siebelSrId, actvtyId, incidentRecord.ID, 0); if (dictDetail == null) { return(reportRows); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
public void Execute(IList <IReportRow> rows) { _selectedRows = rows; _recordContext = _globalContext.AutomationContext.CurrentWorkspace; _incidentRecord = _recordContext.GetWorkspaceRecord(WorkspaceRecordType.Incident) as IIncident; _incidentExtra = _recordContext.GetWorkspaceRecord("CO$Incident_Extra") as IGenericObject; System.Threading.Thread th = new System.Threading.Thread(ProcessSelectedRowInfo); th.Start(); form.Show(); }
/// <summary> /// Method to perform warranty check for creating "WARRANTY" type work order using old BOM query. /// </summary> public void WarrantyCheck(IIncident incidentRecord) { _rnConnectService = RightNowConnectService.GetService(); _rnConnectService._incidentVINObjects.Clear();//Clear the _incidentVINObjects variable that holds all incident_vin record to be updated with response _incidentRecord = incidentRecord; //Get basic field that need to be pass in webservce call, //Null validation of these fields are handle by workspace rules _odometer = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "odometer_reading", _incidentRecord); _causalPart = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "causal_part_nmbr", _incidentRecord); string failureDateInSTring = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "failure_date", _incidentRecord); _failureDate = Convert.ToDateTime(failureDateInSTring).ToString("dd-MMM-yyyy"); string[] busInfo = _rnConnectService.getBusInfo(_incidentRecord.ID); if (busInfo != null && busInfo.Length > 0) { if (busInfo.Length > 1) { WorkspaceAddIn.InfoLog("It seems multi VIN are mapped with Reporting Incident, warrant type work order" + " works only for individual VIN"); return; } else { _vin = busInfo[0].Split('~')[0]; _srNum = busInfo[0].Split('~')[1]; _incVinID = Convert.ToInt32(busInfo[0].Split('~')[2]); //If all required info is valid then form jSon request parameter var content = GetWarrantyReqParam(); var jsonContent = WebServiceRequest.JsonSerialize(content); jsonContent = jsonContent.Replace("xmlns", "@xmlns"); //Call webservice string jsonResponse = WebServiceRequest.Get(_curlURL, jsonContent, "POST"); if (jsonResponse == "") { WorkspaceAddIn.InfoLog("Server didn't returned any info"); return; } else { ExtractResponse(jsonResponse); _rnConnectService.updateIncidentVinRecords(); } } } else { WorkspaceAddIn.InfoLog("No Bus info found, please map a bus to reporting Incident and then click check warranty button"); return; } return; }
// get the siebel_serial_number custom attribute on Incident Workspace protected string getIncidentWSCustomAttr(IIncident incidentRecord, string cutstomAttrName) { cutstomAttrName = "Accelerator$" + cutstomAttrName; IList<ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; foreach (ICustomAttribute cusAttr in customAttributes) { if (cusAttr.PackageName == "Accelerator" && cusAttr.GenericField.Name == cutstomAttrName) return cusAttr.GenericField.DataValue.Value != null ? (string)cusAttr.GenericField.DataValue.Value : null; } return null; }
[Test] public virtual void testPropagateTenantIdToFailedStartTimerIncident() { DeploymentForTenant(TENANT_ID, ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess(PROCESS_DEFINITION_KEY).StartEvent().TimerWithDuration("PT1M").ServiceTask().CamundaExpression("${failing}").EndEvent().Done()); ExecuteAvailableJobs(); IIncident incident = runtimeService.CreateIncidentQuery().First(); Assert.That(incident, Is.Not.EqualTo(null)); // inherit the tenant id from job Assert.That(incident.TenantId, Is.EqualTo(TENANT_ID)); }
void IIncidentChangeListener.OnIncidentChanged(IIncident changedIncident) { if (displayedIncidents.ContainsKey(changedIncident)) { // >>> TODO - Filter incidents presenter.OnIncidentChanged(changedIncident); } else { ((IIncidentsListener)this).OnIncidentAdded(changedIncident); } }
void IIncidentChangeListener.OnIncidentChanged(IIncident changedIncident) { if (displayedIncidents.ContainsKey(changedIncident)) { // >>> TODO - Filter incidents presenter.OnIncidentChanged(changedIncident); } else { ((IIncidentsListener) this).OnIncidentAdded(changedIncident); } }
/// <summary> /// This function does basic validation like if unordered parts beed added to reported Incident, if so then /// Call EBS parts order web-service to pass parts related info and store NF_SALES_ORDER no to each parts record /// </summary> /// <returns>string content that need to send to web-service</returns> public void OrderParts(IIncident incidentRecord) { //Get reported Incident Info int orderTypeId = Convert.ToInt32(RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "order_type", incidentRecord)); int billToId = Convert.ToInt32(RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "Bill_to_site", incidentRecord)); int shipToId = Convert.ToInt32(RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "Ship_to_site", incidentRecord)); string claimNum = incidentRecord.RefNo; string projectNum = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "project_number", incidentRecord); string retrofitNum = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "retrofit_number", incidentRecord); //Get EBS ID from OSvC OOTB ID string billToEbsID = _rnConnectService.GetEbsID(billToId); string shipToEbsID = _rnConnectService.GetEbsID(shipToId); string orgEbsID = _rnConnectService.GetBusOwnerEbsID(Convert.ToInt32(incidentRecord.OrgID)); string odrTypName = _rnConnectService.GetOrderTypeName(orderTypeId); //Get unordered Parts mapped to reported incident _partsInfo = _rnConnectService.GetPartsInfo(incidentRecord.ID); if (_partsInfo == null || _partsInfo.Length <= 0) { WorkspaceAddIn.InfoLog("No parts have beed added to order"); return; } else { //Frame parts order request param structure var content = GetPartsOdrReqParam(odrTypName, orgEbsID, shipToEbsID, billToEbsID, claimNum, projectNum, retrofitNum); if (content == null) { return; } else { //Convert object to jSon string var jsonContent = WebServiceRequest.JsonSerialize(content); jsonContent = jsonContent.Replace("xmlns", "@xmlns"); //Call web-service string jsonResponse = WebServiceRequest.Get(_curlURL, jsonContent, "POST"); if (jsonResponse == "") { WorkspaceAddIn.InfoLog("Server didn't returned any info"); return; } else { ExtractResponse(jsonResponse); _rnConnectService.updateIncidentVinRecords(); } } } }
/// <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 "Send_SupplierCredit": _incidentRecord = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; _sClaimRecord = (IGenericObject)_recordContext.GetWorkspaceRecord("CO$sClaim"); _form.Show(); //start progress form SendSupplierCredit(); break; } }
// get the ebs_order_id custom attribute on Incident Workspace protected int getEbsOrderIdCustomAttr(IIncident incidentRecord) { IList <ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; foreach (ICustomAttribute cusAttr in customAttributes) { if (cusAttr.PackageName == "Accelerator" && cusAttr.GenericField.Name == "Accelerator$ebs_order_id") { return(cusAttr.GenericField.DataValue.Value != null ? (int)cusAttr.GenericField.DataValue.Value : 0); } } return(0); }
/// <summary> /// Reload the workspace and load the incident and contact records /// </summary> public void LoadWorkspaceRecords() { try { recordContext.RefreshWorkspace(); incidentWorkspaceRecord = (IIncident)recordContext.GetWorkspaceRecord(WorkspaceRecordType.Incident); contactWorkspaceRecord = (IContact)recordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact); } catch (Exception ex) { throw new Exception("Failed to load workspace records", ex); } }
protected internal virtual HistoryEvent CreateHistoricIncidentEvt(IIncident incident, HistoryEventTypes eventType) { // create event Event.HistoricIncidentEntity evt = LoadIncidentEvent(incident); // initialize InitHistoricIncidentEvent(evt, incident, eventType); if (HistoryEventTypes.IncidentCreate != eventType) { evt.EndTime = ClockUtil.CurrentTime; } return(evt); }
void _recordContext_DataLoaded(object sender, System.EventArgs e) { try { IIncident i = _recordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; this.EnableControl(i); } catch (Exception ex) { string logMessage = "Error in loading Repair Order. Cancel Async Thread. Error: " + ex.Message; string logNote = ""; _log.ErrorLog(incidentId: _logIncidentId, logMessage: logMessage, logNote: logNote); } }
// get the siebel_serial_number custom attribute on Incident Workspace protected string getIncidentWSCustomAttr(IIncident incidentRecord, string cutstomAttrName) { cutstomAttrName = "Accelerator$" + cutstomAttrName; IList <ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; foreach (ICustomAttribute cusAttr in customAttributes) { if (cusAttr.PackageName == "Accelerator" && cusAttr.GenericField.Name == cutstomAttrName) { return(cusAttr.GenericField.DataValue.Value != null ? (string)cusAttr.GenericField.DataValue.Value : null); } } return(null); }
/// <summary> /// get custom attribute on Incident Workspace /// </summary> /// <param name="incidentRecord"></param> /// <param name="attrName"></param> /// <returns></returns> public static int getSrmCustomAttr(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 ? (int)cusAttr.GenericField.DataValue.Value : 0); } } return(0); }
internal void EnableControl(IIncident incident) { this.Incident = incident; /// Set reference incident in log this._logIncidentId = incident.ID; this.currentContactID = 0; foreach (IInc2Contact c in incident.Contact) { if (c.Prmry == true) { this.currentContactID = (int)c.Cid; } } //this.currentContactID = (Contact == null)?0:incident.ID; this.Controls.Clear(); _serviceRequestControl.Name = "ServiceRequestInfo"; _serviceRequestControl.incident = incident; _serviceRequestControl._gc = GlobalContext; _serviceRequestControl._rc = _recordContext; _serviceRequestControl._log = _log; _serviceRequestControl._logIncidentId = _logIncidentId; _serviceRequestControl.LoadInfo(); }
internal void EnableControl(IIncident incident) { this.Incident = incident; /// Set reference incident in log this._logIncidentId = incident.ID; this.Controls.Clear(); _activityControl.Name = "Activity"; _activityControl.incident = incident; _activityControl._gc = GlobalContext; _activityControl._rc = _recordContext; _activityControl._log = _log; _activityControl._logIncidentId = _logIncidentId; }
public IncidentsGridViewRowPresenter(IIncident incident, IIncidentsGridView view) { this.incident = incident; this.view = view; }
internal void EnableControl(IIncident incident = null, IContact contact = null, IChat chat = null) { this.Controls.Clear(); _siebelContactSearchControl.contactRecord = contact; _siebelContactSearchControl.incidentRecord = incident; _siebelContactSearchControl.chatRecord = chat; this._logIncidentId = 0; this._logContactId = 0; if (incident != null) this._logIncidentId = incident.ID; else if (contact != null) this._logContactId = contact.ID; _siebelContactSearchControl._logIncidentId = _logIncidentId; _siebelContactSearchControl._logContactId = _logContactId; }
void IIncidentsListener.OnIncidentAdded(IIncident newIncident) { // >>> TODO - Filter incidents displayedIncidents.Add(newIncident, newIncident); presenter.ShowIncident(newIncident); }
void IIncidentsListener.OnIncidentRemoved(IIncident removedIncident) { // >>> TODO }
public void OnIncidentChanged(IIncident incident) { rowPresenters[incident].OnChanged(); }
protected override void SetUp() { listener = NewMock<IIncidentsListener>(); incidentFactory = NewMock<IIncidentFactory>(); incidents = new IncidentsCollection(listener, incidentFactory); incident1 = NewMock<IIncident>(); incident2 = NewMock<IIncident>(); }
public IIncidentsGridViewRowPresenter Create(IIncident incident) { return new IncidentsGridViewRowPresenter(incident, view); }
internal void EnableControl(IIncident incident) { //get current incident record and its contact this.Incident = incident; /// Set reference incident in log this._logIncidentId = incident.ID; this.creatingRO = false; this.Controls.Clear(); //Set repair order control and load it _repairOrderControl.Name = "RepairOrderInfo"; _repairOrderControl.incident = incident; _repairOrderControl._gc = GlobalContext; _repairOrderControl._rc = _recordContext; _repairOrderControl._log = _log; _repairOrderControl._logIncidentId = _logIncidentId; _repairOrderControl.LoadInfo(); }