///<summary>Helper method to convert from json string to ODGraphBaseSettingsAbs. Most importantly, provides filter settings for a given DashboardCell.</summary> public static ODGraphSettingsBase Deserialize(string json) { ODGraphSettingsBase ret = JsonConvert.DeserializeObject <ODGraphSettingsBase>(json); Cache.DashboardFilter filter = GetDatesFromQuickRange(ret.QuickRangePref, ret.DateFrom, ret.DateTo); ret.DateFrom = filter.DateFrom; ret.DateTo = filter.DateTo; return(ret); }
public void DeserializeFromJson(string json) { try { QuantityOverTimeGraphSettings settings = ODGraphSettingsBase.Deserialize <QuantityOverTimeGraphSettings>(json); this.QtyType = settings.QtyType; this.SeriesType = settings.SeriesType; this.GroupByType = settings.GroupByType; this.LegendDock = settings.LegendDock; this.BreakdownPref = settings.BreakdownPref; this.BreakdownVal = settings.BreakdownVal; this.GraphTitle = settings.Title; this.ChartSubTitle = settings.SubTitle; //Important that quick range is set last to prevent FilterData from firing multiple times. this.QuickRangePref = settings.QuickRangePref; //we should always recreate the dates so that they are current. Cache.DashboardFilter filter = ODGraphSettingsBase.GetDatesFromQuickRange(settings.QuickRangePref, settings.DateFrom, settings.DateTo); this.DateFrom = filter.DateFrom; this.DateTo = filter.DateTo; } catch (Exception e) { MessageBox.Show(e.Message); } }
public void DeserializeFromJson(string json) { try { if (string.IsNullOrEmpty(json)) { return; } switch (CellType) { case DashboardCellType.HQMoMessage: case DashboardCellType.HQSignups: case DashboardCellType.HQBillingInboundOutbound: return; } GraphQuantityOverTimeFilterSettings settings = ODGraphSettingsBase.Deserialize <GraphQuantityOverTimeFilterSettings>(json); switch (CellType) { case DashboardCellType.ProductionGraph: _productionOptionsCtrl.IncludeAdjustments = settings.IncludeAdjustements; _productionOptionsCtrl.IncludeCompletedProcs = settings.IncludeCompleteProcs; _productionOptionsCtrl.IncludeWriteoffs = settings.IncludeWriteoffs; this.CurGrouping = settings.CurGrouping; break; case DashboardCellType.IncomeGraph: _incomeOptionsCtrl.IncludePaySplits = settings.IncludePaySplits; _incomeOptionsCtrl.IncludeInsuranceClaimPayments = settings.IncludeInsuranceClaims; this.CurGrouping = settings.CurGrouping; break; case DashboardCellType.BrokenApptGraph: this.CurGrouping = settings.CurGrouping; _brokenApptsCtrl.CurRunFor = settings.CurRunFor; _brokenApptsCtrl.AdjTypeDefNumCur = settings.AdjTypeDefNum; _brokenApptsCtrl.BrokenApptCodeCur = settings.BrokenApptProcCode; break; case DashboardCellType.NewPatientsGraph: this.CurGrouping = settings.CurGrouping; break; case DashboardCellType.AccountsReceivableGraph: break; case DashboardCellType.HQMtMessage: _hqMsgRealTimeCtrl.CurHQGroup = settings.HQGrouping; return; case DashboardCellType.HQBillingUsageAccess: case DashboardCellType.HQPhone: case DashboardCellType.HQConfirmation: this.HQConfirmationGraphType = settings.HQConfirmationGraphType; break; case DashboardCellType.HQMoMessage: case DashboardCellType.HQSignups: case DashboardCellType.HQBillingInboundOutbound: return; default: throw new Exception("Unsupported CellType: " + CellType.ToString()); } } catch (Exception e) { #if DEBUG MessageBox.Show(e.Message); #else e.DoNothing(); #endif } }
///<summary>Serializes GetGraphSettings() abstract method returned value. Won't normally need to override this.</summary> private string SerializeToJson() { return(ODGraphSettingsBase.Serialize(GetGraphSettings())); }
///<summary>Will add the pre-defined default clinics tab. ///Only one default clinics tab can exist at a time, but the user may rename it to add multiple. ///This method does NOT save the tab to the database. The user will still have to save changes and will have the option of discarding this tab.</summary> public void AddDefaultsTabByGrouping(bool hasPrompt, GroupingOptionsCtrl.Grouping grouping) { string strGrouping = char.ToUpper(grouping.ToString()[0]) + grouping.ToString().Substring(1); if (!ValidateTabName(strGrouping + " Defaults")) { return; } //get current layouts List <DashboardLayout> layoutsCur; GetDashboardLayout(out layoutsCur); //create layout DashboardLayout layout = new DashboardLayout() { DashboardColumns = 3, DashboardRows = 2, DashboardGroupName = "Default", DashboardTabName = strGrouping + " Defaults", //assigned default layout to first tab. DashboardTabOrder = layoutsCur.Count, UserGroupNum = 0, UserNum = 0, IsNew = true, }; int i = 0; for (int row = 0; row < layout.DashboardRows; row++) { for (int col = 0; col < layout.DashboardColumns; col++) { DashboardCell cell = new DashboardCell() { CellRow = row, CellColumn = col, }; switch (i++) { default: case 0: cell.CellType = DashboardCellType.ProductionGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping, IncludeCompleteProcs = true, IncludeAdjustements = true, IncludeWriteoffs = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Production - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; case 1: cell.CellType = DashboardCellType.IncomeGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping, IncludePaySplits = true, IncludeInsuranceClaims = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Income - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; case 2: cell.CellType = DashboardCellType.BrokenApptGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping, CurRunFor = BrokenApptGraphOptionsCtrl.RunFor.appointment, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Broken Appointments - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.count, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; case 3: cell.CellType = DashboardCellType.ProductionGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping, IncludeCompleteProcs = true, IncludeAdjustements = true, IncludeWriteoffs = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Production - Last 30 Days", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Days, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last30Days, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; case 4: cell.CellType = DashboardCellType.IncomeGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping, IncludePaySplits = true, IncludeInsuranceClaims = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Income - Last 30 Days", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Days, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last30Days, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; case 5: cell.CellType = DashboardCellType.NewPatientsGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurGrouping = grouping }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "New Patients - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.count, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.Bottom, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.items, BreakdownVal = 10, }) }); break; } layout.Cells.Add(cell); } } layoutsCur.Add(layout); //set dashboard tab control layouts SetDashboardLayout(layoutsCur, true); _hasUnsavedChanges = _hasUnsavedChanges || hasPrompt; }
///<summary>Will add the pre-defined default practice tab. ///Only one default practice tab can exist at a time, but the user may rename it to add multiple. ///This method does NOT save the tab to the database. The user will still have to save changes and will have the option of discarding this tab.</summary> public void AddDefaultsTabPractice(bool hasPrompt) { if (!ValidateTabName("Practice Defaults")) { return; } //get current layouts List <DashboardLayout> layoutsCur; GetDashboardLayout(out layoutsCur); //create layout DashboardLayout layout = new DashboardLayout() { DashboardColumns = 3, DashboardRows = 2, DashboardGroupName = "Default", DashboardTabName = "Practice Defaults", //assigned default layout to first tab. DashboardTabOrder = layoutsCur.Count, UserGroupNum = 0, UserNum = 0, IsNew = true, }; int i = 0; //define cell settings. anything not set here will be the defaults defined in GraphQuantityOverTimeFilter for (int row = 0; row < layout.DashboardRows; row++) { for (int col = 0; col < layout.DashboardColumns; col++) { DashboardCell cell = new DashboardCell() { CellRow = row, CellColumn = col, }; switch (i++) { case 0: cell.CellType = DashboardCellType.ProductionGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { IncludeCompleteProcs = true, IncludeAdjustements = true, IncludeWriteoffs = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Production - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; case 1: cell.CellType = DashboardCellType.IncomeGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { IncludePaySplits = true, IncludeInsuranceClaims = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Income - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; case 2: cell.CellType = DashboardCellType.BrokenApptGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { CurRunFor = BrokenApptGraphOptionsCtrl.RunFor.appointment }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Broken Appointments - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.count, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Weeks, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; case 3: cell.CellType = DashboardCellType.AccountsReceivableGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = "", GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Accounts Receivable - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; case 4: cell.CellType = DashboardCellType.NewPatientsGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = "", GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "New Patients - Last 12 Months", QtyType = OpenDentalGraph.Enumerations.QuantityType.count, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Months, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last12Months, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; case 5: default: cell.CellType = DashboardCellType.ProductionGraph; cell.CellSettings = ODGraphJson.Serialize(new ODGraphJson() { FilterJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTimeFilter.GraphQuantityOverTimeFilterSettings() { IncludeCompleteProcs = true, IncludeAdjustements = true, IncludeWriteoffs = true, }), GraphJson = ODGraphSettingsBase.Serialize(new GraphQuantityOverTime.QuantityOverTimeGraphSettings() { Title = "Production - Last 30 Days", QtyType = OpenDentalGraph.Enumerations.QuantityType.money, SeriesType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line, GroupByType = System.Windows.Forms.DataVisualization.Charting.IntervalType.Days, LegendDock = OpenDentalGraph.Enumerations.LegendDockType.None, QuickRangePref = OpenDentalGraph.Enumerations.QuickRange.last30Days, BreakdownPref = OpenDentalGraph.Enumerations.BreakdownType.none, }) }); break; } layout.Cells.Add(cell); } } layoutsCur.Add(layout); //set dashboard tab control layouts SetDashboardLayout(layoutsCur, false); _hasUnsavedChanges = _hasUnsavedChanges || hasPrompt; }
public static string Serialize(ODGraphSettingsBase obj) { return(JsonConvert.SerializeObject(obj)); }