/// <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()); }
/// <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(); }