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();
 }
Beispiel #3
0
        public void AddToLibrary(ICustomLibrary customLibrary)
        {
            try
            {
                string           objectName = CommonDefine.Untitled;
                ISerializeWriter writer     = GetSerializeWriter(ref objectName);
                if (writer == null)
                {
                    return;
                }

                IDocumentService DocService = ServiceLocator.Current.GetInstance <IDocumentService>();
                ILibrary         library    = DocService.LibraryManager.GetLibrary(customLibrary.LibraryGID, customLibrary.FileName);
                if (library != null)
                {
                    ICustomObject newObject = library.AddCustomObject(writer, objectName, CreateIconImage(false), null);
                    if (newObject != null)
                    {
                        customLibrary.AddCustomObject(newObject.Guid);
                    }
                }
                else
                {
                    // If we cannot get the specific library, there is something wrong about this custom library.
                    // Refresh this custom library
                    customLibrary.Refresh();
                }
            }
            catch (Exception ex)
            {
                NLogger.Warn("Add to library failed. ex:{0}", ex.ToString());

                MessageBox.Show(GlobalData.FindResource("Error_Create_Library") + ex.Message);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Write a list of properties.
 /// </summary>
 /// <param name="accessObj">object whose properties must write</param>
 /// <param name="properties">list of property names</param>
 public void WriteProperties(ICustomObject accessObj, List <string> properties)
 {
     foreach (string item in properties)
     {
         WriteProperty(item, accessObj[item]);
     }
 }
 public LeadOpportunitySaveHandler(IRecordContext RecordContext, System.ComponentModel.CancelEventArgs e)
 {
     _recordContext         = RecordContext;
     _leadOpportunityRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
     cancelSaveOperation    = e;
     logger = OSCLogService.GetLog();
 }
Beispiel #6
0
 // 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();
 }
Beispiel #7
0
    public ActionExcute StartAction(ActionObject actObj, ICustomObject o)
    {
        ActionExcute ac = new ActionExcute();

        ac.StartAction(o, actObj);
        mListExcute.Add(ac);
        return(ac);
    }
Beispiel #8
0
 public IObjectContainer AddCustomObject(ICustomObject customObject, double x, double y)
 {
     if (_activeView == null)
     {
         return(null);
     }
     return(_activeView.AddCustomObject(customObject, x, y));
 }
Beispiel #9
0
 public void StartAction(ICustomObject obj, ActionObject _actionObj)
 {
     this.mOwner     = obj;
     this.mStartTime = Time.time;
     mActionObject   = _actionObj;
     mIsOver         = false;
     mCurrentIndex   = 0;
     Init();
 }
Beispiel #10
0
        public virtual bool IsSameObjectRef(IObjectIdentity objectIdentity)
        {
            ICustomObject cp = objectIdentity as ICustomObject;

            if (cp != null)
            {
                return(cp.WholeId == this.WholeId);
            }
            return(false);
        }
        public bool IsSameProperty(IPropertyPointer p)
        {
            ICustomObject cp = p as ICustomObject;

            if (cp != null)
            {
                return(cp.WholeId == this.WholeId);
            }
            return(false);
        }
        public bool IsSameObjectRef(ProgElements.IObjectIdentity objectIdentity)
        {
            ICustomObject cp = objectIdentity as ICustomObject;

            if (cp != null)
            {
                return(cp.WholeId == this.WholeId);
            }
            return(false);
        }
Beispiel #13
0
        /// <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);
        }
Beispiel #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="leadOpportunityObject"></param>
        /// <param name="fieldName"></param>
        /// <param name="value"></param>
        public void setFieldLeadOpportunity(ICustomObject leadOpportunityObject, String fieldName, object value)
        {
            IList <IGenericField> fields = leadOpportunityObject.GenericFields;

            if (null != fields)
            {
                foreach (IGenericField field in fields)
                {
                    if (field.Name.Equals(fieldName))
                    {
                        field.DataValue.Value = value;
                    }
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// WorkOrderAreaCombobox selection changed event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WorkOrderAreaComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ICustomObject record = this._recordContext.GetWorkspaceRecord(this._recordContext.WorkspaceTypeName) as ICustomObject;

            IList <IGenericField> fields = record.GenericFields;

            foreach (IGenericField field in fields)
            {
                if (field.Name == "WO_Area")
                {
                    field.DataValue.Value = (string)WorkOrderAreaComboBox.SelectedItem;
                }
                _recordContext.RefreshWorkspace();
            }
        }
Beispiel #16
0
        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);
        }
Beispiel #17
0
        /// <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);
        }
Beispiel #18
0
        public object getFieldFromWorOrderRecord(ICustomObject workOrderRecord, String fieldName)
        {
            object woType = null;
            IList <IGenericField> fields = workOrderRecord.GenericFields;

            if (null != fields)
            {
                foreach (IGenericField field in fields)
                {
                    if (field.Name.Equals(fieldName))
                    {
                        woType = field.DataValue.Value;
                        return(woType);
                    }
                }
            }
            return(woType);
        }
Beispiel #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="leadOpportunityObject"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public object getFieldFromLeadOpportunity(ICustomObject leadOpportunityObject, String fieldName)
        {
            object woType = null;
            IList <IGenericField> fields = leadOpportunityObject.GenericFields;

            if (null != fields)
            {
                foreach (IGenericField field in fields)
                {
                    if (field.Name.Equals(fieldName))
                    {
                        woType = field.DataValue.Value;
                        return(woType);
                    }
                }
            }
            return(woType);
        }
Beispiel #20
0
        /// <summary>
        /// Update the Workspace Record fields
        /// </summary>
        /// <param name="timeSlot">TimeSlot</param>
        /// <param name="date">DateTime</param>
        private void updateRecordFields(string timeSlot, DateTime date)
        {
            //_log.Info("Inside updateRecordFields");
            ICustomObject         record = this._recordContext.GetWorkspaceRecord(this._recordContext.WorkspaceTypeName) as ICustomObject;
            IList <IGenericField> fields = record.GenericFields;

            foreach (IGenericField field in fields)
            {
                if (field.Name == "WO_Date")
                {
                    field.DataValue.Value = date;
                }
                else if (field.Name == "WO_Time_Slot")
                {
                    field.DataValue.Value = timeSlot;
                }
                _recordContext.RefreshWorkspace();
            }
        }
Beispiel #21
0
        /// <summary>
        /// Initialize the Scheduler
        /// </summary>
        /// <param name="isManagerOverride"></param>
        /// <returns>True if the scheduler is properly initialized</returns>
        public bool InitializeScheduler(bool isManagerOverride)
        {
            //_log.Info("Inside InitializeScheduler");
            string bucket        = null;
            string workOrderType = null;
            string postalCode    = null;

            ICustomObject record = _recordContext.GetWorkspaceRecord(this._recordContext.WorkspaceTypeName) as ICustomObject;

            IList <IGenericField> fields = record.GenericFields;

            foreach (IGenericField field in fields)
            {
                if (field.Name == "WO_Area")
                {
                    bucket = (string)field.DataValue.Value;
                }
                else if (field.Name == "WO_Type")
                {
                    int      workorderTypeId = (Int32)field.DataValue.Value;
                    string[] workordertype   = RightNowConnectService.GetService().GetWorkOrderTypeFromID(workorderTypeId);
                    workOrderType = workordertype[0];
                }
                else if (field.Name == "Contact_Postal_Code")
                {
                    postalCode = field.DataValue.Value.ToString();
                }
            }

            var monthlyViewSchedulerViewModel = new MonthlyViewSchedulerViewModel();

            monthlyViewSchedulerViewModel.CalendarFirstDayOfWeek = (int)MonthlyViewCalendar.FirstDayOfWeek;
            monthlyViewSchedulerViewModel.Bucket            = bucket;
            monthlyViewSchedulerViewModel.PostalCode        = postalCode;
            monthlyViewSchedulerViewModel.WorkOrderType     = workOrderType;
            monthlyViewSchedulerViewModel.RedQuotaCutoff    = float.Parse(RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.RedQuotaCutoff));
            monthlyViewSchedulerViewModel.GreenQuotaCutoff  = float.Parse(RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.GreenQuotaCutoff));
            monthlyViewSchedulerViewModel.IsManagerOverride = isManagerOverride;
            DataContext = monthlyViewSchedulerViewModel;

            //_log.Info("Bucket: " + bucket + " WorkOrderType: " + workOrderType + " Postal Code: " + postalCode + " IsManagerOverride: " + isManagerOverride);
            return(monthlyViewSchedulerViewModel.InitializeCalendar());
        }
Beispiel #22
0
        /// <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;
        }
Beispiel #23
0
        public IObjectContainer AddCustomObject(ICustomObject customObject, double x = 0, double y = 0)
        {
            IObjectContainer container = ParentPage.AddCustomObject(customObject);

            foreach (Widget widget in container.WidgetList)
            {
                // Set the created view as the current view because this is the first time when the widget
                // is added in the current document.
                widget.CreatedViewGuid = _viewGuid;

                // Set this flag to false. PlaceWidgetInternal method will set this flag base on checking
                // if this is base view.
                widget.HasBeenPlacedInBaseView = false;

                // Get widget style in this view.
                IWidgetStyle widgetViewStyle = widget.GetWidgetStyle(_viewGuid);

                // Widgets in library should have same relative location, so make them have the same delta.
                widgetViewStyle.X += x;
                widgetViewStyle.Y += y;

                if (widget is IHamburgerMenu)
                {
                    IHamburgerMenu       menu   = widget as IHamburgerMenu;
                    IHamburgerMenuButton button = menu.MenuButton;

                    IWidgetStyle buttonViewStyle = button.GetWidgetStyle(_viewGuid);
                    buttonViewStyle.X += x;
                    buttonViewStyle.Y += y;
                }

                PlaceWidgetInternal(widget, true);
            }

            // Custom object doesn't contain masters, so we don't handle container.MasterList.

            return(container);
        }
        /// <summary>
        /// Gets the Chat Consult Update data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <param name="callDuration"></param>
        /// <param name="chatContent"></param>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public SFDCData GetConsultUpdateData(IMessage message, SFDCCallType callType, string callDuration, string chatContent, string eventName)
        {
            SFDCData sfdcData = new SFDCData();

            try
            {
                logger.Info("GetConsultUpdateData : Getting lead Consult update data");
                if (this.PopupPages != null)
                {
                    foreach (string key in this.PopupPages)
                    {
                        switch (key)
                        {
                        case "lead":
                            if (this.leadOptions != null && this.leadOptions.ConsultUpdateEvent != null && this.leadOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading lead popup data");
                                sfdcData.LeadData = SFDCLead.GetInstance().GetLeadChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "contact":
                            if (this.contactOptions != null && this.contactOptions.ConsultUpdateEvent != null && this.contactOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading contact popup data");
                                sfdcData.ContactData = SFDCContact.GetInstance().GetContactChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "account":
                            if (this.accountOptions != null && this.accountOptions.ConsultUpdateEvent != null && this.accountOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading account popup data");
                                sfdcData.AccountData = SFDCAccount.GetInstance().GetAccountChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "case":
                            if (this.caseOptions != null && this.caseOptions.ConsultUpdateEvent != null && this.caseOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading case popup data");
                                sfdcData.CaseData = SFDCCase.GetInstance().GetCaseChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "opportunity":
                            if (this.opportunityOptions != null && this.opportunityOptions.ConsultUpdateEvent != null && this.opportunityOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading opportunity popup data");
                                sfdcData.OpportunityData = SFDCOpportunity.GetInstance().GetOpportunityChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "useractivity":
                            if (this.userActivityOptions != null && this.userActivityOptions.ConsultUpdateEvent != null &&
                                this.userActivityOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading useractivity popup data");
                                sfdcData.UserActivityData = SFDCUserActivity.GetInstance().GetChatUpdateUserAcitivityData(message, callType, callDuration, chatContent);
                            }
                            break;

                        default:
                            if (this.customObjectOptions.ContainsKey(key))
                            {
                                if (this.customObjectOptions[key] != null && this.customObjectOptions[key].ConsultUpdateEvent != null &&
                                    this.customObjectOptions[key].ConsultUpdateEvent.Contains(eventName))
                                {
                                    ICustomObject cstobject = SFDCCustomObject.GetInstance().GetCustomObjectChatUpdateData(message, callType, callDuration, chatContent, key);
                                    if (cstobject != null)
                                    {
                                        logger.Info("GetConsultUpdateData : Reading customObject popup data");
                                        this.tempCustomObject.Add(cstobject);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    if (this.tempCustomObject.Count > 0)
                    {
                        ICustomObject[] temp = this.tempCustomObject.ToArray();
                        sfdcData.CustomObjectData = temp;
                        this.tempCustomObject.Clear();
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("GetConsultUpdateData : Error Occurred while collecting Consult Update data : " + generalException.ToString());
            }
            return(sfdcData);
        }
Beispiel #25
0
        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>
 /// 
 /// </summary>
 /// <param name="leadOpportunityObject"></param>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public object getFieldFromLeadOpportunity(ICustomObject leadOpportunityObject, String fieldName)
 {
     object woType = null;
     IList<IGenericField> fields = leadOpportunityObject.GenericFields;
     if (null != fields)
     {
         foreach (IGenericField field in fields)
         {
             if (field.Name.Equals(fieldName))
             {
                 woType = field.DataValue.Value;
                 return woType;
             }
         }
     }
     return woType;
 }
 public PopulateLeadOpportunityDetailsHandler(IRecordContext RecordContext)
 {
     _recordContext = RecordContext;
     _leadRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
 }
Beispiel #28
0
 /// <summary>
 /// Write a list of properties. The specific properties to write are proposed by the <see cref="ICustomObject"/> itself
 /// </summary>
 /// <param name="accessObj">object whose properties must write</param>
 public void WriteProperties(ICustomObject accessObj)
 {
     WriteProperties(accessObj, accessObj.Properties);
 }
Beispiel #29
0
 public PopulateLeadOpportunityDetailsHandler(IRecordContext RecordContext)
 {
     _recordContext = RecordContext;
     _leadRecord    = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="leadOpportunityObject"></param>
 /// <param name="fieldName"></param>
 /// <param name="value"></param>
 public void setFieldLeadOpportunity(ICustomObject leadOpportunityObject, String fieldName, object value)
 {
     IList<IGenericField> fields = leadOpportunityObject.GenericFields;
     if (null != fields)
     {
         foreach (IGenericField field in fields)
         {
             if (field.Name.Equals(fieldName))
             {
                 field.DataValue.Value = value;
             }
         }
     }
 }        
 public PopulateManualDuration(IRecordContext RecordContext)
 {
     _recordContext = RecordContext;
     _workOrderRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
     _log = ToaLogService.GetLog();
 }
 public object getFieldFromWorOrderRecord(ICustomObject workOrderRecord, String fieldName)
 {
     object woType = null;
     IList<IGenericField> fields = workOrderRecord.GenericFields;
     if (null != fields)
     {
         foreach (IGenericField field in fields)
         {
             if(field.Name.Equals(fieldName))
             {
                 woType = field.DataValue.Value;
                 return woType;
             }
         }
     }
     return woType;
 }
Beispiel #33
0
 public PopulateManualDuration(IRecordContext RecordContext)
 {
     _recordContext   = RecordContext;
     _workOrderRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
     _log             = ToaLogService.GetLog();
 }
Beispiel #34
0
        /// <summary>
        /// Check it current data contains IPageEmbeddedWidget
        /// </summary>
        private bool CheckPageEmbeddedWidget(IDataObject data)
        {
            if (data.GetDataPresent("DESIGNER_ITEM"))
            {
                string xamlString = data.GetData("DESIGNER_ITEM") as string;
                if (String.IsNullOrEmpty(xamlString))
                {
                    return(true);
                }

                if (_isForbidDrawerMenu && xamlString == "lbw.hamburgermenu")
                {
                    ForbidHamburgerAlert();
                    return(true);
                }
                else if (_isForbidSwipeviews && xamlString == "lbw.swipeviews")
                {
                    ForbidFlickingAlert();
                    return(true);
                }
                else if (_isForbidToast && xamlString == "lbw.toastnotification")
                {
                    ForbidToastAlert();
                    return(true);
                }
            }
            else if (data.GetDataPresent("CUSTOM_ITEM"))
            {
                ICustomObject customObject = GetCustomObjectFromData(data.GetData("CUSTOM_ITEM"));
                if (customObject != null)
                {
                    customObject.Open();

                    foreach (var item in customObject.Widgets)
                    {
                        if (_isForbidDrawerMenu && item is IHamburgerMenu)
                        {
                            ForbidHamburgerAlert();
                            customObject.Close();
                            return(true);
                        }
                        else if (_isForbidToast && item is IToast)
                        {
                            ForbidToastAlert();
                            customObject.Close();
                            return(true);
                        }
                        else if (_isForbidSwipeviews && item is IDynamicPanel)
                        {
                            ForbidFlickingAlert();
                            customObject.Close();
                            return(true);
                        }
                    }
                    customObject.Close();
                }
            }
            else if (_isForbidMaster && data.GetDataPresent("MASTER_ITEM"))
            {
                ForbidMasterAlert();
                return(true);
            }

            return(false);
        }
Beispiel #35
0
 public void NotifyUser(object reciever, string message, ICustomObject linkedRequest)
 {
     throw new NotImplementedException();
 }
Beispiel #36
0
 public PopulateContactDetailsHandler(IRecordContext RecordContext)
 {
     _recordContext   = RecordContext;
     _workOrderRecord = _recordContext.GetWorkspaceRecord(_recordContext.WorkspaceTypeName) as ICustomObject;
 }
Beispiel #37
0
 public void Remove(ICustomObject obj)
 {
     throw new System.NotImplementedException();
 }