/// <summary> /// Functional Designer. Use this one. /// </summary> /// <param name="designMode">if true we're on a workspace designer</param> /// <param name="globalContext">info about the session</param> /// <param name="recordContext">info about the workspace/record</param> public CopyDetailsButton(bool designMode, IGlobalContext globalContext, IRecordContext recordContext) { try { if (!designMode) { recordContext.Saved += new EventHandler(recordContext_Saved); } //create a logic controller logic = new CopyDetailsLogic(designMode, globalContext, recordContext); this.globalContext = globalContext; this.recordContext = recordContext; //set up the UI InitializeComponent(); //load the button text from the server settings button_copy.Text = ServerSettings.Instance.ButtonLabel; } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); globalContext.LogMessage("Incident Copy Addin - Exception: " + ex.ToString()); this.Enabled = false; } }
/// <summary> /// create the component /// </summary> /// <param name="inDesignMode">store the inDesignMode flag</param> public Component(bool inDesignMode, IRecordContext context, IGlobalContext gc) { this.inDesignMode = inDesignMode; //create the UI control and stoactionre it control = new OAuthUC(inDesignMode, context, gc); }
public IOTControl(bool inDesignMode, IRecordContext RecordContext) { var viewModel = new IOTAreaViewModel(inDesignMode, RecordContext); DataContext = viewModel; InitializeComponent(); }
public EBSContactSearchControl(IRecordContext recordContext, IGlobalContext globalContext) { // Set up Add-In UI InitializeComponent(); ebsContactSearchListView.FullRowSelect = true; rnContactSearchListView.FullRowSelect = true; // Set necessary values _rContext = recordContext; _gContext = globalContext; bw_ebsContactSearch.WorkerSupportsCancellation = true; bw_ebsContactSearch.DoWork += new DoWorkEventHandler(bw_SearchEBSContact); bw_ebsContactSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunSearchEBSContactCompleted); bw_rnContactSearch.WorkerSupportsCancellation = true; bw_rnContactSearch.DoWork += new DoWorkEventHandler(bw_SearchRnContact); bw_rnContactSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunSearchRnContactCompleted); if (!assemChecked) { Assembly[] arAssem = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assem in arAssem) { if (assem.FullName.Contains("Oracle.RightNow.Cti")) { useCTI = true; break; } } assemChecked = true; } }
public LeadOpportunitySaveHandler(IRecordContext RecordContext,System.ComponentModel.CancelEventArgs e) { _recordContext = RecordContext; _leadOpportunityRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject; cancelSaveOperation = e; logger = OSCLogService.GetLog(); }
/// <summary> /// Parses the given values assuming that they are in the same order as the column definitions. /// </summary> /// <param name="context">The metadata for the current record being processed.</param> /// <param name="values">The values to parse.</param> /// <returns>The parsed objects.</returns> protected object[] ParseValuesBase(IRecordContext context, string[] values) { object[] parsedValues = new object[ColumnDefinitions.PhysicalCount]; for (int columnIndex = 0, sourceIndex = 0, destinationIndex = 0; columnIndex != ColumnDefinitions.Count; ++columnIndex) { var definition = ColumnDefinitions[columnIndex]; if (definition is IMetadataColumn) { var columnContext = GetColumnContext(context, columnIndex, destinationIndex); var metadata = Parse(columnContext, definition, destinationIndex, null); parsedValues[destinationIndex] = metadata; ++destinationIndex; } else if (!definition.IsIgnored) { var isContextDisabled = context.ExecutionContext.Options.IsColumnContextDisabled; var columnContext = isContextDisabled ? null : GetColumnContext(context, columnIndex, destinationIndex); var rawValue = values[sourceIndex]; var parsedValue = Parse(columnContext, definition, destinationIndex, rawValue); parsedValues[destinationIndex] = parsedValue; ++sourceIndex; ++destinationIndex; } else { ++sourceIndex; } } return(parsedValues); }
public LeadOpportunitySaveHandler(IRecordContext RecordContext, System.ComponentModel.CancelEventArgs e) { _recordContext = RecordContext; _leadOpportunityRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject; cancelSaveOperation = e; logger = OSCLogService.GetLog(); }
// TODO : Remove below line //public WorkOrderSaveHandler() public WorkOrderSaveHandler(IRecordContext RecordContext, System.ComponentModel.CancelEventArgs e) { _recordContext = RecordContext; _cancelEventArgs = e; _workOrderRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject; _log = ToaLogService.GetLog(); }
/// <summary> /// Formats the given values assuming that they are in the same order as the column definitions. /// </summary> /// <param name="context">The metadata for the record currently being processed.</param> /// <param name="values">The values to format.</param> /// <returns>The formatted values.</returns> protected string[] FormatValuesBase(IRecordContext context, object[] values) { string[] formattedValues = new string[ColumnDefinitions.Count]; for (int columnIndex = 0, valueIndex = 0; columnIndex != ColumnDefinitions.Count; ++columnIndex) { IColumnDefinition definition = ColumnDefinitions[columnIndex]; if (definition is IMetadataColumn) { var columnContext = GetColumnContext(context, columnIndex, valueIndex); var formattedValue = Format(columnContext, definition, valueIndex, null); formattedValues[columnIndex] = formattedValue; ++valueIndex; } else if (!definition.IsIgnored) { var isContextDisabled = context.ExecutionContext.Options.IsColumnContextDisabled; var columnContext = isContextDisabled ? null : GetColumnContext(context, columnIndex, valueIndex); var value = values[valueIndex]; string formattedValue = Format(columnContext, definition, valueIndex, value); formattedValues[columnIndex] = formattedValue; ++valueIndex; } } return(formattedValues); }
/* 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>(); if (((SiebelVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary <string, string> dictDetail = null; String partyID = ""; // for running standalone report (from Report Explorer) if (_context == null) { // filter is PERSON_PARTY_ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode partyIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.PERSON_PARTY_ID", this.Parent.Name, this.Name)); if (partyIDFilterNode != null) { partyID = partyIDFilterNode.ReportFilter.Value; System.Diagnostics.Debug.WriteLine(partyIDFilterNode.ReportFilter.OperatorType.ToString()); } } if (partyID == "" || partyID == null) { return(reportRows); } dictDetail = ContactModel.LookupDetail(columns, partyID); } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; string contactPartyID = ""; contactPartyID = getContactPartyIdCustomAttr(contactRecord); if (contactPartyID == "") { return(reportRows); } string logMessage = "Calling LookupDetail for Contact." + "contactPartyID: " + contactPartyID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage); // call Siebel Contact.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = ContactModel.LookupDetail(columns, contactPartyID, 0, contactRecord.ID); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
/// <summary> /// Default constructor. /// </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> public WorkspaceAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext GlobalContext) { _recordContext = RecordContext; _globalContext = GlobalContext; // _recordContext.Saved += _recordContext_Saved; _rnConnectService = RightNowConnectService.GetService(_globalContext); }
public Pcr GetSummaryPcr(IRecordContext record) { record.StdfFile.GetRecordsEnumerable().Any(); return((from p in _Pcrs where p.HeadNumber == 255 select p).FirstOrDefault()); }
private decimal getContactID(IReportFilterNode filterNode, out int rntContactId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; string logMessage; string logNote; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if ((workspaceType == WorkspaceRecordType.Incident) || (workspaceType == WorkspaceRecordType.Contact)) { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (null != contactRecord) { IList <ICustomAttribute> customAttributes = contactRecord.CustomAttributes; rntContactId = contactRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_contact_party_id" }, 0, rntContactId) ["Accelerator$ebs_contact_party_id"]; if (null == val) { logMessage = "Provide an EBS Contact ID to search for Repair Orders. No search performed."; logNote = null; ConfigurationSetting.logWrap.DebugLog(0, rntContactId, logMessage, logNote); return(-1); } else if (Convert.ToDecimal(val) <= 0) { logMessage = "Provide a valid EBS Contact ID to search for Repair Orders. No search performed for ebs_contact_party_id " + val; logNote = null; ConfigurationSetting.logWrap.DebugLog(0, rntContactId, logMessage, logNote); return(-1); } else { return(Convert.ToDecimal(val)); } } } } rntContactId = 0; decimal contact_id = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenContactID", true); if (null != filter_value) { contact_id = Convert.ToDecimal(filter_value); } if (contact_id > 0) { return(contact_id); } logMessage = "Provide a valid EBS Contact ID to search for Repair Orders. Ignoring ebs_contact_party_id " + contact_id; logNote = null; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return(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); }
/* 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); }
/// <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> /// Super fast GetPcrs :) /// </summary> public IEnumerable <Pcr> GetPcrs(IRecordContext context, byte headNumber, byte siteNumber) { context.StdfFile.GetRecordsEnumerable().Any(); return(from p in _Pcrs where p.HeadNumber == headNumber && p.SiteNumber == siteNumber select p); }
/// <summary> /// Creates a new add-in control /// </summary> /// <param name="designMode">if true we're in a workspace designer</param> /// <param name="globalContext">information about the session</param> /// <param name="recordContext">information about the workspace</param> public AddinControlLauncher(bool designMode, IGlobalContext globalContext, IRecordContext recordContext) { userControl = new CopyDetailsButton(designMode, globalContext, recordContext); this.designMode = designMode; this.globalContext = globalContext; this.recordContext = recordContext; }
public CaseCreationViewModel(IRecordContext <CaseType> caseTypeService) { _confirmCommandProxy = new ProxyRelayCommand(Confirm, CanConfirm); _updateCaseTypeCommandProxy = new ProxyRelayCommand(UpdateCasetType); _skipCommandProxy = new ProxyRelayCommand(Skip); SelectDirectoryCommand = new RelayCommand(SelectDirectory); _caseTypeService = caseTypeService; }
public UnitSettingsViewModel(IRecordContext <WorkUnit> dbService) { _dbService = dbService; _addProxyCommand = new ProxyRelayCommand(Add, () => Number != String.Empty && UnitName != String.Empty); _removeProxyCommand = new ProxyRelayCommand(Remove, () => SelctedItem != null); WorkUnit[] cts = dbService.Records.ToArray(); WorkUnits = new ObservableCollection <WorkUnit>(cts); }
public CaseTypeSettingsViewModel(IRecordContext <CaseType> dbService) { _dbService = dbService; _addProxyCommand = new ProxyRelayCommand(Add, () => CaseTypeName != String.Empty); _removeProxyCommand = new ProxyRelayCommand(Remove, () => SelctedItem != null); CaseType[] cts = dbService.Records.ToArray(); CaseTypes = new ObservableCollection <CaseType>(cts); }
public WorkspaceAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext global) { if (!inDesignMode) { _recordContext = RecordContext; gContext = global; } }
/// <summary> /// Default constructor. /// </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> public BulkImportAddin(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _gContext = globalContext; _recordContext = recordContext; bulkImportControl = new BulkImportControl(new Proxy(this)); _Model = bulkImportControl._Model; _Model.InDesignMode = inDesignMode; var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = bulkImportControl, }; Controls.Add(elementHost); if (inDesignMode) { return; } //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; Accelerator.EBS.SharedServices.Contact.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.Contact.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL; Accelerator.EBS.SharedServices.Contact.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Accelerator.EBS.SharedServices.Contact.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Accelerator.EBS.SharedServices.Contact.InitEBSProvider(); Accelerator.EBS.SharedServices.RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ServiceUsername = ConfigurationSetting.username; Accelerator.EBS.SharedServices.RepairOrder.ServicePassword = ConfigurationSetting.password; Accelerator.EBS.SharedServices.RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; Accelerator.EBS.SharedServices.RepairOrder.InitEBSProvider(); _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; _recordContext.DataLoaded += _rContext_DataLoaded; _recordContext.Closing += _recordContext_Closing; _recordContext.Saving += _recordContext_Saving; _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged; } }
/// <summary> /// Default constructor. /// </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> public BulkImportAddin(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _gContext = globalContext; _recordContext = recordContext; bulkImportControl = new BulkImportControl(new Proxy(this)); _Model = bulkImportControl._Model; _Model.InDesignMode = inDesignMode; var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = bulkImportControl, }; Controls.Add(elementHost); if (inDesignMode) { return; } //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; Accelerator.EBS.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL; Accelerator.EBS.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Accelerator.EBS.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Accelerator.EBS.SharedServices.ContactModel.InitEBSProvider(); Accelerator.EBS.SharedServices.RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ServiceUsername = ConfigurationSetting.username; Accelerator.EBS.SharedServices.RepairOrder.ServicePassword = ConfigurationSetting.password; Accelerator.EBS.SharedServices.RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; Accelerator.EBS.SharedServices.RepairOrder.InitEBSProvider(); _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; _recordContext.DataLoaded += _rContext_DataLoaded; _recordContext.Closing += _recordContext_Closing; _recordContext.Saving += _recordContext_Saving; _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged; } }
public IOTAreaViewModel(bool inDesignMode, IRecordContext RecordContext) { _logger = LogService.GetLog(); _recordContext = RecordContext; if (!inDesignMode) { _recordContext.DataLoaded += new EventHandler(GetDeviceProperties); } }
/// <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 context) { _clickToDialComponent = new ClickToDialAddin(); (_clickToDialComponent as ClickToDialAddin).InDesignMode = inDesignMode; (_clickToDialComponent as ClickToDialAddin).RecordContext = context; return(_clickToDialComponent); }
private ColumnContext GetColumnContext(IRecordContext context, int physicalIndex, int logicalIndex) { return(new ColumnContext() { RecordContext = context, PhysicalIndex = physicalIndex, LogicalIndex = logicalIndex }); }
public WorkspaceRibbonAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext globalContext) { if (!inDesignMode) { GlobalContext = globalContext; InDesignMode = inDesignMode; this.RecordContext = RecordContext; RecordContext.Saving += new CancelEventHandler(RecordContext_Saving); } }
/// <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(); }
/// <summary> /// Default constructor. /// </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> public DateOfBirthAddIn(bool inDesignMode, IRecordContext recordContext) { _recordContext = recordContext; _dateOfBirthControl = new DateOfBirthControl(); Dock = DockStyle.Fill; Controls.Add(_dateOfBirthControl); _dateOfBirthControl.CustonOnLeave += DateOfBirthControlCustonOnLeave; _dateOfBirthControl.DateOfBirth = GetDateOfBirthFromContact(); }
public FormPhoneNo(int x, int y, IRecordContext context) : this() { this.desiredStartLocationX = x; this.desiredStartLocationY = y; Load += new EventHandler(FormPhoneNo_Load); _recordContext = context; GetSelectedContact(context); _click2DialFormTooltip = new ToolTip(); }
public BasicSettingsViewModel(IRecordContext <Basic> dbService) { _dbService = dbService; Languages = new String[] { SystemContext.LanguageManager[Languagekeys.ViewLanguage_Management_Settings_Chinese], SystemContext.LanguageManager[Languagekeys.ViewLanguage_Management_Settings_English], }; SelectPathCommand = new RelayCommand(SelectPath); }
public void Initialize(IRecordContext <Models.Entities.Inspection> setting) { if (IsInitialized) { return; } ConfigDataFilter.Initialize(); ConfigDataFilter.Setting = setting; IsInitialized = true; }
/* 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); }
/// /// <summary> /// Default constructor. /// </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> public RepairOrderAddIn(bool inDesignMode, IRecordContext RecordContext) { _recordContext = RecordContext; if (_recordContext != null) { _recordContext.DataLoaded += _recordContext_DataLoaded; //Add saving/saved events _recordContext.Saving += _recordContext_Saving; _recordContext.Saved += _recordContext_Saved; } _repairOrderControl = new RepairOrderInformationControl(); }
/// <summary> /// Default constructor. /// </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> public OracleRightnowToaWorkOrderAreaAddIn(bool inDesignMode, IRecordContext RecordContext) { _recordContext = RecordContext; workOrderAreaControl = new WorkOrderAreaControl(_recordContext); var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = workOrderAreaControl, }; Controls.Add(elementHost); }
/// <summary> /// Default constructor. /// </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> public SalesCloudLeadOpportunityAddIn(bool inDesignMode, IRecordContext RecordContext) { if (!inDesignMode) { _recordContext = RecordContext; _recordContext.Saving += _recordContext_Saving; } else { InitializeComponent(); } }
/// <summary> /// Default constructor. /// </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> public OracleRightNowToaWorkOrderAddIn(bool inDesignMode, IRecordContext RecordContext) { if (!inDesignMode) { _recordContext = RecordContext; //_recordContext.Saved += WorkOrder_Saved; _recordContext.Saving += _recordContext_Saving; } else { InitializeComponent(); } }
/// <summary> /// Default constructor. /// </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> public WorkspaceAddIn(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext, string version) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _gContext = globalContext; _recordContext = recordContext; bulkImportControl = new OrderManagementControl(new Proxy(this)); _Model = bulkImportControl._Model; _Model.InDesignMode = inDesignMode; _Model.Version = version; var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = bulkImportControl, }; Controls.Add(elementHost); if (inDesignMode) { return; } //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; Accelerator.EBS.SharedServices.Order.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.Order.GetOrderURL = ConfigurationSetting.GetOrder_WSDL; Accelerator.EBS.SharedServices.Order.OrderInboundURL = ConfigurationSetting.OrderInboundURL_WSDL; Accelerator.EBS.SharedServices.Order.InitEBSProvider(); _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; _recordContext.DataLoaded += _rContext_DataLoaded; _recordContext.Closing += _recordContext_Closing; _recordContext.Saving += _recordContext_Saving; _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged; } }
/// <summary> /// Default constructor. /// </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> /// <param name="managerOverride">Scheduler Override Allowed flag</param> public OracleRightnowToaMonthlyViewSchedulerAddIn(bool inDesignMode, IRecordContext RecordContext, bool managerOverride) { _recordContext = RecordContext; IsManagerOverride = managerOverride; if (inDesignMode) { var monthlyViewScheduler = new MonthlyViewScheduler(_recordContext); var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = monthlyViewScheduler, }; Controls.Add(elementHost); } }
/// <summary> /// Default constructor. /// </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> public ActivityAddIn(bool inDesignMode, IRecordContext RecordContext) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _recordContext = RecordContext; if (_recordContext != null) { _recordContext.DataLoaded += _recordContext_DataLoaded; _recordContext.Saving += _recordContext_Saving; _recordContext.Saved += _recordContext_Saved; } _activityControl = new ActivityInformationControl(); } }
/// <summary> /// Default constructor. /// </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> public ContactWorkspaceAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext GlobalContext) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _recordContext = RecordContext; _globalContext = GlobalContext; _inDesingMode = inDesignMode; if (_recordContext != null) { _recordContext.DataLoaded += _recordContext_DataLoaded; } // Instantiate the custom control and add it to the panel controls _siebelContactSearchControl = new SiebelContactSearchControl(_recordContext, _globalContext); } }
/// /// <summary> /// Default constructor. /// </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> public RepairOrderAddIn(bool inDesignMode, IRecordContext RecordContext, bool isEnabledEditing) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _recordContext = RecordContext; this.isEnabledEditing = isEnabledEditing; if (_recordContext != null) { _recordContext.DataLoaded += _recordContext_DataLoaded; //Add saving/saved events _recordContext.Saving += _recordContext_Saving; _recordContext.Saved += _recordContext_Saved; } _repairOrderControl = new RepairOrderInformationControl(inDesignMode, isEnabledEditing); } }
/// <summary> /// Fetch Work Order Areas for a given zipcode /// </summary> /// <param name="_rcontext"></param> public void GetWorkOrderAreas(IRecordContext _rcontext) { ICustomObject record = _rcontext.GetWorkspaceRecord(_rcontext.WorkspaceTypeName) as ICustomObject; IList<IGenericField> fields = record.GenericFields; string postalCode = null; foreach (IGenericField field in fields) { if (field.Name == "Contact_Postal_Code") { postalCode = field.DataValue.Value.ToString(); break; } } var WorkOrderAreaViewModel = new WorkOrderAreaViewModel(); WorkOrderAreaViewModel.getWorkOrderArea(postalCode); DataContext = WorkOrderAreaViewModel; }
/// <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) { ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); if (!ConfigurationSetting.configVerbPerfect) { if (!ConfigurationSetting.loginUserIsAdmin) { System.Windows.Forms.MessageBox.Show("BulkImportAddin is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _gContext.Logout(); } else // don't want to logout admin { System.Windows.Forms.MessageBox.Show("BulkImportAddin is not loaded because of invalid configuration verb."); return new BulkImportAddin(inDesignMode, RecordContext, _gContext); } } return new BulkImportAddin(inDesignMode, RecordContext, _gContext); }
public PopulateManualDuration(IRecordContext RecordContext) { _recordContext = RecordContext; _workOrderRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject; _log = ToaLogService.GetLog(); }
/// <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) { return new DateOfBirthAddIn(inDesignMode, RecordContext); }
/// <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) { return new AddressValidationAddIn(inDesignMode, RecordContext); }
/// <summary> /// Method to fetch Opportunity and return respective models. /// </summary> /// <param name="context"></param> /// <returns>List of Opportunity Models</returns> private List<OpportunityModel> getOpportunitesList(IRecordContext context) { var opportunitiesList = new List<OpportunityModel>(); if (context != null) { var tokenSource = new CancellationTokenSource(); CancellationToken token = tokenSource.Token; Boolean timeout = false; string timeoutValue = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.SalesTimeout); var orgRecord = context.GetWorkspaceRecord(WorkspaceRecordType.Organization) as IOrganization; if (orgRecord != null) { string ext_ref = RightNowConnectService.GetService().GetContactOrgExternalReference(orgRecord.ID, false, OracleRightNowOSCAddInNames.OpportunityReportTableAddIn); //If the contact is a non sales contact if (String.IsNullOrEmpty(ext_ref)) { _logger.Debug("External reference is empty or null for the org. Returning empty opportunity list."); return opportunitiesList; } if (!String.IsNullOrEmpty(timeoutValue)) { var task = Task.Factory.StartNew(() => OpportunityService.GetService().FindOpenOpportunities(OSCOpportunitiesTableMetadata.OrgFilterColumn, ext_ref), token); if (!task.Wait(Convert.ToInt32(timeoutValue))) { timeout = true; tokenSource.Cancel(); } else { opportunitiesList = task.Result; task.Dispose(); } } else { _logger.Debug("Sales Timesout value is either empty or null"); opportunitiesList = OpportunityService.GetService().FindOpenOpportunities(OSCOpportunitiesTableMetadata.OrgFilterColumn, ext_ref); } _logger.Debug("No. of opportunities fetched for Org #" + ext_ref + " : " + ((opportunitiesList != null) ? opportunitiesList.Count.ToString() : "null")); } else { var contactRecord = context.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; if (contactRecord != null) { string ext_ref = RightNowConnectService.GetService().GetContactOrgExternalReference(contactRecord.ID, true, OracleRightNowOSCAddInNames.OpportunityReportTableAddIn); //If the contact is a non sales contact if (String.IsNullOrEmpty(ext_ref)) { _logger.Debug("External reference is empty or null for contact. Returning empty opportunity list."); return opportunitiesList; } if (!String.IsNullOrEmpty(timeoutValue)) { var task = Task.Factory.StartNew(() => OpportunityService.GetService().FindOpenOpportunities(OSCOpportunitiesTableMetadata.ContactFilterColumn, ext_ref), token); if (!task.Wait(Convert.ToInt32(timeoutValue))) { timeout = true; tokenSource.Cancel(); } else { opportunitiesList = task.Result; task.Dispose(); } } else { _logger.Debug("Sales Timesout value is either empty or null"); opportunitiesList = OpportunityService.GetService().FindOpenOpportunities(OSCOpportunitiesTableMetadata.ContactFilterColumn, ext_ref); } _logger.Debug("No. of opportunities fetched for Contact #" + ext_ref + " : " + ((opportunitiesList != null) ? opportunitiesList.Count.ToString() : "null")); } } if (timeout) { _logger.Debug("FindOpportunity request timed out!"); MessageBox.Show(OSCExceptionMessages.FindOppTimedOut, OSCOpportunitiesCommon.FindOppTimedOutTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } return opportunitiesList; }
private bool validateLeadOpportunityType(IRecordContext recordContext) { ICustomObject leadOpportunityRecord = recordContext.GetWorkspaceRecord(recordContext.WorkspaceTypeName) as ICustomObject; String leadOpportunityType = (String)getFieldFromLeadOpportunity(leadOpportunityRecord, OSCOpportunitiesCommon.LeadTypeFieldName); logger.Debug("Lead/Opportunity Type "+leadOpportunityType); if(String.IsNullOrWhiteSpace(leadOpportunityType) || (!leadOpportunityType.Equals(OSCOpportunitiesCommon.OpportunityRecordType) && !leadOpportunityType.Equals(OSCOpportunitiesCommon.SalesLeadRecordType))) { //Show appropriate message MessageBox.Show(OSCExceptionMessages.MisConfiguredLeadOpportunityTypeMessage, OSCExceptionMessages.LeadNotCreatedTitle, MessageBoxButton.OK, MessageBoxImage.Error); return false; } logger.Debug("Correct type specified"); return true; }
/// <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; }
/// <summary> /// Default constructor. /// </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> public AddressValidationAddIn(bool inDesignMode, IRecordContext RecordContext) { _recordContext = RecordContext; }
//private IToaLog _log; public MonthlyViewScheduler(IRecordContext _rcontext) { InitializeComponent(); _recordContext = _rcontext; //_log = ToaLogService.GetLog(); }
/// <summary> /// /// </summary> /// <param name="recordContext"></param> /// <param name="orgExternalRef"></param> /// <param name="contactExternalRef"></param> /// <param name="orgID"></param> /// <returns></returns> private bool validateExternalReference(IRecordContext recordContext, long? orgExternalRef, long? contactExternalRef, int? orgID) { //B2C Case: If Contact is there but if no external reference is associated it needs to be first synced to create lead. logger.Debug("Validate B2C case, contact is specified and there is no Org"); if (-1 == contactExternalRef && (null == orgID)) { IContact contactRecord = recordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; MessageBox.Show(String.Format(OSCExceptionMessages.ContactDoesNotExistMessage, contactRecord.NameFirst, contactRecord.NameLast), OSCExceptionMessages.LeadNotCreatedTitle, MessageBoxButton.OK, MessageBoxImage.Error); return false; } //B2B Case logger.Debug("Validate B2B Case"); if (null != orgID) { //B2B Case 1: Contact is synced but org is still not synced. if (-1 == orgExternalRef && contactExternalRef > 0) { IOrganization organizationRecord = recordContext.GetWorkspaceRecord(WorkspaceRecordType.Organization) as IOrganization; MessageBox.Show(String.Format(OSCExceptionMessages.OrganizationDoesNotExistMessage, organizationRecord.Name), OSCExceptionMessages.LeadNotCreatedTitle, MessageBoxButton.OK, MessageBoxImage.Error); logger.Debug("Contact is synced but Organization is not synced"); return false; } //B2B Case 2: Contact is not synced but org is synced. if (orgExternalRef > 0 && contactExternalRef == -1) { IContact contactRecord = recordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; MessageBox.Show(String.Format(OSCExceptionMessages.ContactDoesNotExistMessage, contactRecord.NameFirst, contactRecord.NameLast), OSCExceptionMessages.LeadNotCreatedTitle, MessageBoxButton.OK, MessageBoxImage.Error); logger.Debug("Contact is not synced but Organization is synced"); return false; } //B2B Case 3: Both Contact and Org not synced. if (-1 == orgExternalRef && -1 == contactExternalRef) { IContact contactRecord = recordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; IOrganization organizationRecord = recordContext.GetWorkspaceRecord(WorkspaceRecordType.Organization) as IOrganization; MessageBox.Show(String.Format(OSCExceptionMessages.OrganizationContactDoesNotExistMessage,organizationRecord.Name,contactRecord.NameFirst,contactRecord.NameLast), OSCExceptionMessages.LeadNotCreatedTitle, MessageBoxButton.OK, MessageBoxImage.Error); logger.Debug("Contact and Organization not synced"); return false; } } //B2C or B2B Cases all valid. logger.Debug("B2B/B2C cases valid ExtRef"); return true; }
/// <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("Contact Search Add-In is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _globalContext.Logout(); } else // don't want to logout admin { MessageBox.Show("Contact Search Add-In is not loaded because of invalid configuration verb."); return new ContactWorkspaceAddIn(inDesignMode, RecordContext, _globalContext); } } _rContext = RecordContext; if (!inDesignMode && RecordContext != null) { //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(_globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; _log = ConfigurationSetting.logWrap; Accelerator.Siebel.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.SiebelProvider; Accelerator.Siebel.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL; Accelerator.Siebel.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Accelerator.Siebel.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Accelerator.Siebel.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout; Accelerator.Siebel.SharedServices.ContactModel.InitSiebelProvider(); Contact_Search_Report_ID = ConfigurationSetting.contactSearchReportID; } _wsAddIn = new ContactWorkspaceAddIn(inDesignMode, RecordContext, _globalContext); _wsAddIn._contactSearchReportId = Contact_Search_Report_ID; _wsAddIn._rnSrv = _rnSrv; _wsAddIn._log = _log; return _wsAddIn; }
/// <summary> /// /// </summary> /// <param name="recordContext"></param> /// <param name="orgExternalRef"></param> /// <param name="contactExternalRef"></param> /// <param name="contactID"></param> /// <param name="orgID"></param> /// <param name="e"></param> /// <returns></returns> public bool validateRequest(IRecordContext recordContext, long? orgExternalRef, long? contactExternalRef, int? contactID, int? orgID ,System.ComponentModel.CancelEventArgs e) { logger.Debug("ValidateRequest Start"); bool isSuccess = true; logger.Debug("Validate Create or Update"); //Validate Record Status isSuccess = validateCreateOrUpdate(recordContext); logger.Debug("Validate Create or Update done. Validation status="+isSuccess); if (!isSuccess) { //validation failed, cancel save operation e.Cancel = true; return isSuccess; } logger.Debug("Validate opportunity type"); //Validate lead_oppty_type isSuccess = validateLeadOpportunityType(recordContext); logger.Debug("validate opportunity type done. validation status="+isSuccess); if (!isSuccess) { //Set submit_status to failed //ICustomObject leadOpportunityObject = recordContext.GetWorkspaceRecord(recordContext.WorkspaceTypeName) as ICustomObject; //setFieldLeadOpportunity(leadOpportunityObject, OSCOpportunitiesCommon.LeadOpportunityStatusFieldName, (object)OSCOpportunitiesCommon.LeadOpportunityFailedStatus); //validation failed, cancel save operation e.Cancel = true; return isSuccess; } logger.Debug("Validate contact is mandatory or not"); //Validate Contact mandatory isSuccess = validateMandatoryContact(contactID); logger.Debug("Validation mandatory contact is done. Validation status="+isSuccess); if (!isSuccess) { //validation failed, cancel save operation e.Cancel = true; return isSuccess; } logger.Debug("Validate external reference"); //Validate External Reference isSuccess = validateExternalReference(recordContext, orgExternalRef, contactExternalRef, orgID); if (!isSuccess) { //Set submit_status to failed ICustomObject leadOpportunityObject = recordContext.GetWorkspaceRecord(recordContext.WorkspaceTypeName) as ICustomObject; setFieldLeadOpportunity(leadOpportunityObject, OSCOpportunitiesCommon.LeadOpportunityStatusFieldName, (object)OSCOpportunitiesCommon.LeadOpportunityFailedStatus); } logger.Debug("Validate external reference done. validation status="+isSuccess); return isSuccess; }
/// <summary> /// /// </summary> /// <param name="recordContext"></param> /// <returns></returns> private bool validateCreateOrUpdate(IRecordContext recordContext) { ICustomObject leadOpportunityRecord = recordContext.GetWorkspaceRecord(recordContext.WorkspaceTypeName) as ICustomObject; String leadOpportunityExtRef = (String)getFieldFromLeadOpportunity(leadOpportunityRecord, OSCOpportunitiesCommon.LeadOpportunityExtRef); logger.Debug("Lead/Opportunity ExtRef is "+leadOpportunityExtRef); if (!String.IsNullOrWhiteSpace(leadOpportunityExtRef) && !leadOpportunityExtRef.Equals(OSCOpportunitiesCommon.DefaultOpportunitySalesLeadID.ToString(),StringComparison.CurrentCultureIgnoreCase)) { //This is update MessageBox.Show(OSCExceptionMessages.LeadOpportunityUpdateNotSupportedMessage, OSCExceptionMessages.LeadOpportunityUpdateNotSupportedTitle, MessageBoxButton.OK, MessageBoxImage.Information); return false; } //This is create logger.Debug("This is create Opportunity or Lead"); return true; }
public WorkOrderModel GetWorkOrderModel(IRecordContext RecordContext) { ICustomObject workOrder = RecordContext.GetWorkspaceRecord(RecordContext.WorkspaceTypeName) as ICustomObject; IContact contact = RecordContext.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; WorkOrderModel workOrderModel = new WorkOrderModel(); _log.Notice("Processing WorkOrder:" + workOrder.Id.ToString()); if (workOrder != null) { IList<IGenericField> fields = workOrder.GenericFields; workOrderModel.AppointmentNumber = workOrder.Id.ToString(); InventoryModel primaryAssetInventoryModel = null; int workorderTypeId = (Int32)getFieldFromWorOrderRecord(workOrder, "WO_Type"); string[] workordertype = RightNowConnectService.GetService().GetWorkOrderTypeFromID(workorderTypeId); _log.Notice("WorkOrder Type ID:" + workordertype[0]); foreach (IGenericField field in fields) { if (field.DataValue.Value != null) { switch (field.Name) { case "Asset" : //cannot use record context here as Asset WorkspaceType is not exposed through RightNow.AddIns.Common. //TODO Un-Comment below lines when RN Connect Services are available if (null != field.DataValue.Value) { primaryAssetInventoryModel = new InventoryModel(); int assetid = (int)field.DataValue.Value; _log.Notice("WorkOrder Primary Asset ID:" + assetid); string[] details = RightNowConnectService.GetService().GetAssetDetailsFromAssetID(assetid.ToString()); string[] productDetails = RightNowConnectService.GetService().GetProductDetailsFromProductID(details[0]);//Type = Product's ID (i.e. SalesProduct.PartNumber) if (null != productDetails && productDetails.Length > 0) { primaryAssetInventoryModel.Type = productDetails[0]; } else { _log.Warning("invtype_label is not valid for primary asset."); } if (details.Length > 1) { primaryAssetInventoryModel.SerialNumber = details[1]; //model = Serial Number } } break; case "Case_Note": workOrderModel.SetPropertyValue("XA_CASE_NOTES", field.DataValue.Value.ToString()); break; case "Cancel_Reason": workOrderModel.CancelReason = field.DataValue.Value.ToString(); break; case "Contact": if (contact != null) { workOrderModel.CustomerNumber = contact.ID.ToString(); _log.Notice("WorkOrder Contact ID:" + contact.ID.ToString()); workOrderModel.Name = contact.NameFirst + " " + contact.NameLast; } break; case "Contact_City": workOrderModel.City = field.DataValue.Value.ToString(); break; case "Contact_Email": workOrderModel.EmailAddress = field.DataValue.Value.ToString(); break; case "Contact_Mobile_Phone": workOrderModel.MobileNumber = field.DataValue.Value.ToString(); break; case "Contact_Phone": workOrderModel.PhoneNumber = field.DataValue.Value.ToString(); break; case "Contact_Postal_Code": workOrderModel.ZipCode = field.DataValue.Value.ToString(); break; case "Contact_Province_State": int province_id = (Int32)field.DataValue.Value; string name = RightNowConnectService.GetService().GetProvinceName(province_id); if (name != null) { workOrderModel.State = name; } break; case "Contact_Street": workOrderModel.Address = field.DataValue.Value.ToString(); break; case "Duration": if(null == field.DataValue.Value) { if (workordertype[1].Equals("1")) { workOrderModel.Duration = workordertype[2]; } _log.Notice("WorkOrder Duration :" + workOrderModel.Duration); }else { workOrderModel.Duration = field.DataValue.Value.ToString(); _log.Notice("WorkOrder Duration :" + workOrderModel.Duration); } break; case "Reminder_Time": if (null != field.DataValue.Value) { int id = Convert.ToInt32(field.DataValue.Value); string[] remindertime1 = RightNowConnectService.GetService().GetReminder_TimeFromID(id); workOrderModel.ReminderTime = Convert.ToInt32(remindertime1[0]); } break; case "Requested_Service_End": workOrderModel.ServiceWindowEnd = field.DataValue.Value.ToString(); break; case "Requested_Service_Start": workOrderModel.ServiceWindowStart = field.DataValue.Value.ToString(); break; case "Resolution_Due": workOrderModel.SlaWindowEnd = Convert.ToDateTime(field.DataValue.Value); break; case "WO_Area": workOrderModel.ExternalId = field.DataValue.Value.ToString(); break; case "WO_Date": workOrderModel.AssignedDate = ((DateTime)field.DataValue.Value).ToString("yyyy-MM-dd"); break; case "WO_Status": //Set it for each handler and not in generic code. break; case "WO_Time_Slot": workOrderModel.TimeSlot = field.DataValue.Value.ToString(); break; case "WO_Type": workOrderModel.WorkType = workordertype[0]; break; } } } //Set Duration if (workOrderModel.Duration == null) { if (workordertype[1].Equals("1")) { workOrderModel.Duration = workordertype[2]; } _log.Notice("WorkOrder Duration :" + workOrderModel.Duration); } // Set Cancel Activity if (workOrderModel.CancelReason != null && !workOrderModel.CancelReason.Trim().Equals("")) { workOrderModel.CommandType = Client.Common.ActivityCommandType.Cancel; } else // Set Update Activity { workOrderModel.Status = Client.Common.ActivityStatus.Pending; workOrderModel.CommandType = Client.Common.ActivityCommandType.Update; } _log.Notice("WorOrder Command Type is set as " + ToaStringsUtil.GetString(workOrderModel.CommandType)); workOrderModel.SetActionIfCompleted = Client.Common.ActionIfCompleted.CreateIfAssignOrReschedule; //TODO UnComment below code SetInventoryModel(workOrderModel, workOrder.Id, primaryAssetInventoryModel, workorderTypeId); } return workOrderModel; }
/// <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; }