Exemple #1
0
 public Datatable AJAX_GetTableByIDCustomerGroup(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search, int idCustomerGroup)
 {
     try
     {
         IEnumerable <dynamic> data = Dynamic_GetAll_ByIDCustomerGroup(idCustomerGroup);
         int count = data.Count();
         if (!string.IsNullOrEmpty(search))
         {
             data = data.Where(x =>
                               x.FirstName.ToLower().Contains(search.ToLower()) ||
                               x.LastName.ToLower().Contains(search.ToLower()) ||
                               x.Email.ToLower().Contains(search.ToLower())
                               ).ToArray();
         }
         List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
         foreach (dynamic currData in data)
         {
             Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
             newData.Add("IDCustomer", currData.IDCustomer);
             newData.Add("Name", currData.FirstName + ' ' + currData.LastName);
             newData.Add("Email", currData.Email);
             newData.Add("Active", currData.Active);
             newData.Add("PhoneNumber", currData.PhoneNumber);
             resultList.Add(newData);
         }
         return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemple #2
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            IEnumerable <dynamic> data = Dynamic_GetAll();
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.Name.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDRole", currData.IDRole);
                newData.Add("Name", currData.Name);
                newData.Add("DateInsert", currData.DateInsert);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #3
0
    public Datatable AJAX_GetTable_Log_Stock_filter(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search, DateTime startDate, DateTime endDate)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            var datamentah            = db.TBLog_Stocks.Where(x => x.InsertDate >= startDate && x.InsertDate <= endDate).ToArray();
            //dynamic[] data = db.SP_Report_GetCategoryDistribution(startDate, endDate).ToArray();
            dynamic[] data = datamentah;

            int count  = data.Count();
            int number = 1;
            if (!string.IsNullOrEmpty(search))
            {
                data = data.AsEnumerable().Where(x =>
                                                 x.TBEmployee.Name.ToLower().Contains(search.ToLower()) ||
                                                 x.ProductName.ToLower().Contains(search.ToLower()) ||
                                                 x.Description.ToLower().Contains(search.ToLower())
                                                 ).ToArray();
            }
            Dictionary <string, dynamic>[] resultList = new Dictionary <string, dynamic> [data.Count()];
            for (int i = 0; i < data.Count(); i++)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("Number", number);
                newData.Add("EmployeeName", data[i].TBEmployee == null ? "" : data[i].TBEmployee.Name);
                newData.Add("ProductName", data[i].ProductName);
                newData.Add("Type", data[i].Type);
                newData.Add("Description", data[i].Description);
                newData.Add("Quantity", data[i].Quantity);
                newData.Add("QuantityBefore", data[i].InitialQuantity);
                newData.Add("QuantityAfter", data[i].LastQuantity);
                newData.Add("InsertDate", data[i].InsertDate);
                number       += 1;
                resultList[i] = newData;
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #4
0
    public Datatable AJAX_GetTable_Log_Order(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            DateTime  startDate       = db.TBOrders.FirstOrDefault().DateInsert;
            dynamic[] data            = db.TBLog_Orders.ToArray();
            int       count           = data.Count();
            int       number          = 1;
            if (!string.IsNullOrEmpty(search))
            {
                data = data.AsEnumerable().Where(x =>
                                                 x.TBEmployee.Name.ToLower().Contains(search.ToLower()) ||
                                                 x.Reference.ToLower().Contains(search.ToLower()) ||
                                                 x.Description.ToLower().Contains(search.ToLower())
                                                 ).ToArray();
            }
            Dictionary <string, dynamic>[] resultList = new Dictionary <string, dynamic> [data.Count()];
            for (int i = 0; i < data.Count(); i++)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("Number", number);
                newData.Add("EmployeeName", data[i].TBEmployee == null ? "" : data[i].TBEmployee.Name);
                newData.Add("Reference", data[i].Reference);
                newData.Add("Customer", data[i].CustomerName);
                newData.Add("Status", data[i].OrderStatus);
                newData.Add("Description", data[i].Description);
                newData.Add("InsertDate", data[i].DateInsert);
                number       += 1;
                resultList[i] = newData;
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #5
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search, string idCarrier)
    {
        try
        {
            DataClassesDataContext db   = new DataClassesDataContext();
            IEnumerable <dynamic>  data = db.TBShippings.Where(X => !X.Deflag && X.IDCarrier.ToString() == idCarrier).Select(x => new
            {
                x.IDShipping,
                x.IDCarrier,
                x.IDDistrict,
                x.Price,
                DistrictName = x.TBDistrict.Name,
                CityName     = x.TBDistrict.TBCity.Name
            }).ToList();
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.CityName.ToLower().Contains(search.ToLower()) || x.DistrictName.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("CityName", currData.CityName);
                newData.Add("DistrictName", currData.DistrictName);
                newData.Add("Price", currData.Price);
                newData.Add("IDShipping", currData.IDShipping);
                newData.Add("IDCarrier", currData.IDCarrier);
                newData.Add("IDDistrict", currData.IDDistrict);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #6
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            IEnumerable <dynamic> data = Dynamic_GetAll(new DataClassesDataContext());
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.Name.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDVoucher", currData.IDVoucher);
                newData.Add("Name", currData.Name);
                newData.Add("Code", currData.Code);
                newData.Add("Description", currData.Description);
                newData.Add("VoucherType", currData.VoucherType);
                newData.Add("Value", currData.Value);
                newData.Add("TotalAvailable", currData.TotalAvailable);
                newData.Add("Used", currData.Used);
                newData.Add("MinimumAmount", currData.MinimumAmount);
                newData.Add("StartDate", currData.StartDate);
                newData.Add("EndDate", currData.EndDate);
                newData.Add("Active", currData.Active);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #7
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db            = new DataClassesDataContext();
            Class_Page_Category    _pageCategory = new Class_Page_Category();
            IEnumerable <dynamic>  data          = Dynamic_GetAll(db);
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.Post_Title.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDPost", currData.IDPost);
                newData.Add("Post_Title", currData.Post_Title);
                newData.Add("Page_Title", currData.Page_Title);
                newData.Add("Post_ShortContent", currData.Post_ShortContent);
                newData.Add("Post_Content", currData.Post_Content);
                newData.Add("DateInsert", currData.DateInsert.ToString("dd-MM-yyyy") + " " + currData.DateInsert.ToLongTimeString());
                newData.Add("DateLastUpdate", currData.DateLastUpdate.ToString("dd-MM-yyyy") + " " + currData.DateLastUpdate.ToLongTimeString());
                newData.Add("Active", currData.Active);
                newData.Add("Categories", Dynamic_GetData_PageCategories_ByIDPost(db, currData.IDPost));
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #8
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search, int idPage)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                IEnumerable <dynamic> data = Dynamic_GetAll(db, idPage).Where(x => !x.Deflag);
                int count = data.Count();
                if (!string.IsNullOrEmpty(search))
                {
                    data = data.Where(x => x.Name.ToLower().Contains(search.ToLower())).ToArray();
                }
                List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
                foreach (dynamic currData in data)
                {
                    Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                    newData.Add("IDPageCategory", currData.IDPageCategory);
                    newData.Add("IDPage", currData.IDPage);
                    newData.Add("Name", currData.Name);
                    newData.Add("Description", currData.Description);
                    newData.Add("DateInsert", currData.DateInsert.ToString("dd-MM-yyyy") + " " + currData.DateInsert.ToLongTimeString());
                    newData.Add("DateLastUpdate", currData.DateLastUpdate.ToString("dd-MM-yyyy") + " " + currData.DateLastUpdate.ToLongTimeString());
                    newData.Add("Deflag", currData.Deflag);
                    resultList.Add(newData);
                }
                return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #9
0
    public Datatable AJAX_GetTable_Monitoring(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db   = new DataClassesDataContext();
            IEnumerable <dynamic>  data = Dynamic_GetData_MonitoringStock();
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.CombinationName.ToLower().Contains(search.ToLower()) ||
                                  x.ProductName.ToLower().Contains(search.ToLower())
                                  ).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDProductCombination", currData.IDProduct_Combination);
                newData.Add("ProductName", currData.ProductName);
                newData.Add("CombinationName", currData.CombinationName);
                newData.Add("Quantity", currData.Quantity);
                newData.Add("ReferenceCode", currData.ReferenceCode);
                newData.Add("Active", currData.Active);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #10
0
    public Datatable AJAX_GetTable_Log_Error(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            dynamic[] data            = db.TBLog_Errors.OrderByDescending(x => x.ID).ToArray();
            int       count           = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.AsEnumerable().Where(x =>
                                                 x.TBEmployee.Name.ToLower().Contains(search.ToLower()) ||
                                                 x.ProductName.ToLower().Contains(search.ToLower()) ||
                                                 x.Description.ToLower().Contains(search.ToLower())
                                                 ).ToArray();
            }
            Dictionary <string, dynamic>[] resultList = new Dictionary <string, dynamic> [data.Count()];
            for (int i = 0; i < data.Count(); i++)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("ID", data[i].ID);
                newData.Add("Message", data[i].ErrorMessage);
                newData.Add("StackTrace", data[i].StackTrace);
                newData.Add("Date", data[i].DateInsert);
                resultList[i] = newData;
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #11
0
    public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db   = new DataClassesDataContext();
            IEnumerable <dynamic>  data = db.TBPayment_Methods.Where(X => !X.Deflag).ToList();
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.Name.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDPaymentMethod", currData.IDPaymentMethod);
                newData.Add("Name", currData.Name);
                newData.Add("Bank", currData.Bank);
                newData.Add("Owner", currData.Owner);
                newData.Add("AccountNumber", currData.AccountNumber);
                newData.Add("Description", currData.Description);
                newData.Add("Image", currData.Image);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #12
0
    public Datatable AJAX_GetTable_Country(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            DataClassesDataContext db   = new DataClassesDataContext();
            IEnumerable <dynamic>  data = db.TBCountries.Where(X => !X.Deflag).Select(x => new
            {
                x.IDCountry,
                x.Name
            }).ToList();
            int count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.Where(x => x.Name.ToLower().Contains(search.ToLower())).ToArray();
            }
            List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
            foreach (dynamic currData in data)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDCountry", currData.IDCountry);
                newData.Add("Name", currData.Name);
                resultList.Add(newData);
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #13
0
    public WITLibrary.Datatable AJAX_GetTable_BestManufacturer(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    {
        try
        {
            dynamic[] data  = Dynamic_Get_BestManufacturer();
            int       count = data.Count();
            if (!string.IsNullOrEmpty(search))
            {
                data = data.AsEnumerable().Where(x =>
                                                 x.Name.ToLower().Contains(search.ToLower()) ||
                                                 x.ReferenceCode.ToLower().Contains(search.ToLower())
                                                 ).ToArray();
            }
            Dictionary <string, dynamic>[] resultList = new Dictionary <string, dynamic> [data.Count()];
            for (int i = 0; i < data.Count(); i++)
            {
                Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
                newData.Add("IDManufacturer", data[i].IDManufacturer);
                newData.Add("Name", data[i].Name);
                newData.Add("Quantity", data[i].Quantity);
                resultList[i] = newData;
            }
            return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(new WITLibrary.Datatable
            {
                sEcho = 0,
                iTotalRecords = 0,
                iTotalDisplayRecords = 0,
                aaData = new List <Dictionary <string, dynamic> >()
            });
        }
    }
Exemple #14
0
 public Datatable AJAX_GetTable(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
 {
     try
     {
         IEnumerable <dynamic> data = Dynamic_GetAll(new DataClassesDataContext());
         int count = data.Count();
         if (!string.IsNullOrEmpty(search))
         {
             data = data.Where(x => x.CustomerName.ToLower().Contains(search.ToLower()) ||
                               x.ProductName.ToLower().Contains(search.ToLower()) ||
                               x.Email.ToLower().Contains(search.ToLower())
                               ).ToArray();
         }
         List <Dictionary <string, dynamic> > resultList = new List <Dictionary <string, dynamic> >();
         foreach (dynamic currData in data)
         {
             Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
             newData.Add("IDWishlist", currData.IDWishlist);
             newData.Add("CustomerName", currData.CustomerName == null ? "-" : currData.CustomerName);
             newData.Add("Email", currData.Email);
             newData.Add("ProductName", currData.Product);
             newData.Add("DateInsert", currData.DateInsert);
             newData.Add("Member", currData.IDCustomer == null ? false : true);
             resultList.Add(newData);
         }
         return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
     }
     catch (Exception)
     {
         return(new WITLibrary.Datatable
         {
             sEcho = 0,
             iTotalRecords = 0,
             iTotalDisplayRecords = 0,
             aaData = new List <Dictionary <string, dynamic> >()
         });
     }
 }
Exemple #15
0
 public WITLibrary.Datatable AJAX_GetTable_BestCustomer(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
 {
     try
     {
         dynamic[] data  = Dynamic_Get_BestCustomer();
         int       count = data.Count();
         if (!string.IsNullOrEmpty(search))
         {
             data = data.AsEnumerable().Where(x =>
                                              x.Name.ToLower().Contains(search.ToLower()) ||
                                              x.ReferenceCode.ToLower().Contains(search.ToLower())
                                              ).ToArray();
         }
         Dictionary <string, dynamic>[] resultList = new Dictionary <string, dynamic> [data.Count()];
         for (int i = 0; i < data.Count(); i++)
         {
             Dictionary <string, dynamic> newData = new Dictionary <string, dynamic>();
             newData.Add("IDCustomer", data[i].IDCustomer);
             newData.Add("Email", data[i].Email);
             newData.Add("Name", data[i].FirstName + " " + data[i].LastName);
             newData.Add("Quantity", data[i].Quantity);
             newData.Add("Amount", data[i].Amount);
             resultList[i] = newData;
         }
         return(OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir));
     }
     catch (Exception)
     {
         return(new WITLibrary.Datatable
         {
             sEcho = 0,
             iTotalRecords = 0,
             iTotalDisplayRecords = 0,
             aaData = new List <Dictionary <string, dynamic> >()
         });
     }
 }