Example #1
0
        public static ChartBarDTO ChartBarDTO_Convert_Table_To_DTO(tblChart_Bar chart_bar_tbl)
        {
            if (chart_bar_tbl != null)
            {
                try
                {
                    ChartBarDTO chart_bar_dto = new ChartBarDTO();
                    chart_bar_dto.Chart_Title         = chart_bar_tbl.Chart_Title;
                    chart_bar_dto.Dashboard_Widget_Id = chart_bar_tbl.DashboardWidget_Id;
                    chart_bar_dto.Group_By            = chart_bar_tbl.Group_By;
                    chart_bar_dto.Id               = chart_bar_tbl.Id;
                    chart_bar_dto.Metric.Id        = chart_bar_tbl.Metric_Id;
                    chart_bar_dto.Target_Metric.Id = (int)chart_bar_tbl.Target_Metric_Id;

                    chart_bar_dto.Chart_Common_Property_DTO.From_Date = chart_bar_tbl.From_Date;
                    if (chart_bar_tbl.Time_Line != null)
                    {
                        chart_bar_dto.Chart_Common_Property_DTO.Time_Line = (TimeLine)Enums.TryParse(typeof(TimeLine), chart_bar_tbl.Time_Line);
                    }
                    chart_bar_dto.Chart_Common_Property_DTO.To_Date   = chart_bar_tbl.To_Date;
                    chart_bar_dto.Chart_Common_Property_DTO.Precision = chart_bar_tbl.Precision;
                    return(chart_bar_dto);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                throw new Chart_Bar_Exception(Resources.Chart_Bar_Null_Exception);
            }
        }
Example #2
0
        public static tblChart_Bar ChartBarDTO_Convert_DTO_To_Table(ChartBarDTO chart_bar_dto)
        {
            if (chart_bar_dto != null)
            {
                try
                {
                    tblChart_Bar chart_bar_tbl = new tblChart_Bar();
                    chart_bar_tbl.Chart_Title        = chart_bar_dto.Chart_Title;
                    chart_bar_tbl.DashboardWidget_Id = chart_bar_dto.Dashboard_Widget_Id;
                    chart_bar_tbl.Group_By           = chart_bar_dto.Group_By;
                    chart_bar_tbl.Id               = chart_bar_dto.Id;
                    chart_bar_tbl.Metric_Id        = chart_bar_dto.Metric.Id;
                    chart_bar_tbl.Target_Metric_Id = chart_bar_dto.Target_Metric.Id;

                    chart_bar_tbl.From_Date = chart_bar_dto.Chart_Common_Property_DTO.From_Date;
                    if (chart_bar_dto.Chart_Common_Property_DTO.Time_Line != null)
                    {
                        chart_bar_tbl.Time_Line = chart_bar_dto.Chart_Common_Property_DTO.Time_Line.ToString();
                    }
                    chart_bar_tbl.To_Date   = chart_bar_dto.Chart_Common_Property_DTO.To_Date;
                    chart_bar_tbl.Precision = chart_bar_dto.Chart_Common_Property_DTO.Precision;

                    return(chart_bar_tbl);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                throw new Chart_Bar_Exception(Resources.Chart_Bar_Null_Exception);
            }
        }