/// <summary>
 /// Statistics the result.
 /// </summary>
 /// <returns>Statistics the result</returns>
 public List <f_ThongKe_Edit_Result> StatisticsResult()
 {
     using (var data = new Entities())
     {
         try
         {
             var c_gen = data.f_ThongKe_Edit().ToList <f_ThongKe_Edit_Result>();
             return(c_gen);
         }
         catch (Exception)
         {
             return(null);
         }
     }
 }
        /// <summary>
        /// Statistics the table.
        /// </summary>
        /// <returns>Statistic Table</returns>
        public DataTable StatisticTable()
        {
            using (var data = new Entities())
            {
                var entityList = data.f_ThongKe_Edit().ToList <f_ThongKe_Edit_Result>();
                var properties = typeof(f_ThongKe_Edit_Result).GetProperties();
                var table      = new DataTable();

                foreach (var property in properties)
                {
                    var type = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;
                    table.Columns.Add(property.Name, type);
                }

                foreach (var entity in entityList)
                {
                    table.Rows.Add(properties.Select(p => p.GetValue(entity, null)).ToArray());
                }

                return(table);
            }
        }