Example #1
0
        public JsonResult Fetchlabels(int iDisplayStart = 0, int iDisplayLength = 0, int sEcho = 1, string sSearch = null, int iSortCol_0 = 0, string sSortDir_0 = "asc")
        {
            int adminId = Convert.ToInt16(Session["AdminId"]);
            TableDate <tbllabel> tableDate = new TableDate <tbllabel>();
            List <string[]>      list      = new List <string[]>();
            int    recordsTotal            = 0;
            Global _global = new Database.Global();

            using (CRMClassDataContext dataClasses1DataContext = new CRMClassDataContext(_global.con))
            {
                List <tbllabel> list2 = (from a in dataClasses1DataContext.tbllabels.Where(a => a.AdminId == adminId && a.Isactive == true)
                                         select a).ToList <tbllabel>();
                recordsTotal = list2.Count <tbllabel>();
                if (!string.IsNullOrEmpty(sSearch))
                {
                    list2 = list2.Where(a => a.LableName.Contains(sSearch) || a.Description.Contains(sSearch)).ToList <tbllabel>();
                }
                string sortby = "mDataProp_" + iSortCol_0;
                sortby                         = Request.QueryString[sortby].ToString();
                list2                          = SortList <tbllabel>(list2, sSortDir_0, sortby).Skip(iDisplayStart).Take(iDisplayLength).ToList();
                tableDate.sEcho                = sEcho;
                tableDate.aaData               = list2;
                tableDate.iTotalRecords        = list2.Count <tbllabel>();
                tableDate.iTotalDisplayRecords = recordsTotal;
            }
            return(base.Json(tableDate, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public JsonResult Fetchusers(int iDisplayStart = 0, int iDisplayLength = 0, int sEcho = 1, string sSearch = null, int iSortCol_0 = 0, string sSortDir_0 = "asc")
        {
            int adminId = 1;
            TableDate <tbllogin> tableDate = new TableDate <tbllogin>();
            List <string[]>      list      = new List <string[]>();
            int    recordsTotal            = 0;
            Global _global = new Database.Global();

            using (CRMClassDataContext dataClasses1DataContext = new CRMClassDataContext(_global.con))
            {
                List <tbllogin> list2 = (from a in dataClasses1DataContext.tbllogins.Where(a => a.IsActive == "Y")
                                         select a).ToList <tbllogin>();
                recordsTotal = list2.Count <tbllogin>();
                if (!string.IsNullOrEmpty(sSearch))
                {
                    list2 = list2.Where(a => a.FirstName.Contains(sSearch) || a.Email.Contains(sSearch) || a.PhoneNumber.Contains(sSearch)).ToList <tbllogin>();
                }
                string sortby = "mDataProp_" + iSortCol_0;
                sortby                         = Request.QueryString[sortby].ToString();
                list2                          = SortList <tbllogin>(list2, sSortDir_0, sortby).Skip(iDisplayStart).Take(iDisplayLength).ToList();
                tableDate.sEcho                = sEcho;
                tableDate.aaData               = list2;
                tableDate.iTotalRecords        = list2.Count <tbllogin>();
                tableDate.iTotalDisplayRecords = recordsTotal;
            }
            return(base.Json(tableDate, JsonRequestBehavior.AllowGet));
        }