public static Dashboard_Widget_DTO Dashboard_Widget_DTO_Convert_Table_To_DTO(tblDashboard_Widget dashboard_widget_tbl) { Dashboard_Widget_DTO dashboard_widget_dto = new Dashboard_Widget_DTO(); try { dashboard_widget_dto.Id = dashboard_widget_tbl.Id; dashboard_widget_dto.Chart_Type = (ChartType)Enums.TryParse(typeof(ChartType), dashboard_widget_tbl.Chart_Type.ToString()); dashboard_widget_dto.Dashboard_Id = dashboard_widget_tbl.Dashboard_Id; dashboard_widget_dto.Widget_Title = dashboard_widget_tbl.Widget_Title; dashboard_widget_dto.Is_Deleted = dashboard_widget_tbl.Is_Deleted; dashboard_widget_dto.widget_height = dashboard_widget_tbl.widget_height; dashboard_widget_dto.widget_width = dashboard_widget_tbl.widget_width; dashboard_widget_dto.widget_x = dashboard_widget_tbl.widget_x; dashboard_widget_dto.widget_y = dashboard_widget_tbl.widget_y; //Every widget has only entry in the tblHomePage_Widget, thats why we get only first and default dashboard_widget_dto.homepage_widgets = HomePage_WidgetDTO_Converter.Convert(dashboard_widget_tbl.tblHomePage_Widget.FirstOrDefault()); if (dashboard_widget_tbl.tblChart_Gauge.Any()) { dashboard_widget_dto.GaugeDTO = ChartGaugeDTO_Convert.ChartGaugeDTO_Convert_Table_To_DTO(dashboard_widget_tbl.tblChart_Gauge); } else if (dashboard_widget_tbl.tblChart_TreeMap.Any()) { dashboard_widget_dto.TreeMapDTO = ChartTreeMapDTO_Convert.ChartTreeMapDTO_Convert_Table_To_DTO(dashboard_widget_tbl.tblChart_TreeMap); } else if (dashboard_widget_tbl.tblChart_Bar.Any()) { dashboard_widget_dto.BarDTO = ChartBarDTO_Convert.ChartBarDTO_Convert_Table_To_DTO(dashboard_widget_tbl.tblChart_Bar); } else if (dashboard_widget_tbl.tblChart_Pie.Any()) { dashboard_widget_dto.PieDTO = ChartPieDTO_Convert.ChartPieDTO_Convert_Table_DTO(dashboard_widget_tbl.tblChart_Pie); } else if (dashboard_widget_tbl.tblChart_Donut.Any()) { dashboard_widget_dto.DonutDTO = ChartDonutDTO_Convert.ChartDonutDTO_Convert_Table_DTO(dashboard_widget_tbl.tblChart_Donut); } else if (dashboard_widget_tbl.tblChart_Stacked.Any()) { dashboard_widget_dto.StackedDTO = ChartStackedDTO_Convert.ChartStackedDTO_Convert_Table_DTO(dashboard_widget_tbl.tblChart_Stacked); } else if (dashboard_widget_tbl.tblChart_Line.Any()) { dashboard_widget_dto.LineDTO = ChartLineDTO_Convert.ChartLineDTO_Convert_Table_DTO(dashboard_widget_tbl.tblChart_Line); } else if (dashboard_widget_tbl.tblChart_Heatmap.Any()) { dashboard_widget_dto.HeapMapDTO = ChartHeatMapDTO_Convert.ChartHeatMapDTO_Convert_Table_To_DTO(dashboard_widget_tbl.tblChart_Heatmap); } else if (dashboard_widget_tbl.tblChart_Counter.Any()) { dashboard_widget_dto.CounterDTO = ChartCounter_Converter.Convert_Table_To_DTO(dashboard_widget_tbl.tblChart_Counter); } } catch (Exception ex) { throw ex; } return(dashboard_widget_dto); }
public static tblDashboard_Widget Dashboard_Widget_DTO_Convert_DTO_To_Table(Dashboard_Widget_DTO dashboard_widget_dto) { tblDashboard_Widget tbl_dashboard_widget = new tblDashboard_Widget(); try { tbl_dashboard_widget.Id = dashboard_widget_dto.Id; tbl_dashboard_widget.Chart_Type = dashboard_widget_dto.Chart_Type.ToString(); tbl_dashboard_widget.Dashboard_Id = dashboard_widget_dto.Dashboard_Id; tbl_dashboard_widget.Widget_Title = dashboard_widget_dto.Widget_Title; tbl_dashboard_widget.Is_Deleted = dashboard_widget_dto.Is_Deleted; tbl_dashboard_widget.widget_height = dashboard_widget_dto.widget_height; tbl_dashboard_widget.widget_width = dashboard_widget_dto.widget_width; tbl_dashboard_widget.widget_x = dashboard_widget_dto.widget_x; tbl_dashboard_widget.widget_y = dashboard_widget_dto.widget_y; if (dashboard_widget_dto.GaugeDTO != null) { tbl_dashboard_widget.tblChart_Gauge = ChartGaugeDTO_Convert.ChartGaugeDTO_Convert_DTO_To_Table(dashboard_widget_dto.GaugeDTO); } else if (dashboard_widget_dto.TreeMapDTO != null) { tbl_dashboard_widget.tblChart_TreeMap = ChartTreeMapDTO_Convert.ChartTreeMapDTO_Convert_DTO_To_Table(dashboard_widget_dto.TreeMapDTO); } else if (dashboard_widget_dto.BarDTO != null) { tbl_dashboard_widget.tblChart_Bar = ChartBarDTO_Convert.ChartBarDTO_Convert_DTO_To_Table(dashboard_widget_dto.BarDTO); } else if (dashboard_widget_dto.PieDTO != null) { tbl_dashboard_widget.tblChart_Pie = ChartPieDTO_Convert.ChartPieDTO_Convert_DTO_Table(dashboard_widget_dto.PieDTO); } else if (dashboard_widget_dto.DonutDTO != null) { tbl_dashboard_widget.tblChart_Donut = ChartDonutDTO_Convert.ChartDonutDTO_Convert_DTO_Table(dashboard_widget_dto.DonutDTO); } else if (dashboard_widget_dto.StackedDTO != null) { tbl_dashboard_widget.tblChart_Stacked = ChartStackedDTO_Convert.ChartStackedDTO_Convert_DTO_Table(dashboard_widget_dto.StackedDTO); } else if (dashboard_widget_dto.LineDTO != null) { tbl_dashboard_widget.tblChart_Line = ChartLineDTO_Convert.ChartLineDTO_Convert_DTO_Table(dashboard_widget_dto.LineDTO); } else if (dashboard_widget_dto.HeapMapDTO != null) { tbl_dashboard_widget.tblChart_Heatmap = ChartHeatMapDTO_Convert.ChartHeatMapDTO_Convert_DTO_To_Table(dashboard_widget_dto.HeapMapDTO); } else if (dashboard_widget_dto.CounterDTO != null) { tbl_dashboard_widget.tblChart_Counter = ChartCounter_Converter.Convert_DTO_To_Table(dashboard_widget_dto.CounterDTO); } } catch (Exception ex) { throw ex; } return(tbl_dashboard_widget); }