Example #1
0
        public JsonResult IndexAjax(Davisoft_BDSProject.Web.Models.DataTableJS data)
        {
            var    itmes  = _service.GetIQueryableItems().ToList();
            String search = null;

            if (data.search != null && data.search["value"] != null)
            {
                search = data.search["value"];
            }
            var    column      = data.order[0]["column"];
            var    dir         = data.order[0]["dir"];
            string columnName  = ((String[])data.columns[int.Parse(column)]["data"])[0];
            var    queryFilter =
                _service.GetIQueryableItems()
                .Where(
                    T => T.Active == 1 &&
                    (search == "" || (search != null &&
                                      (T.KeySearch.ToLower().Contains(search.ToLower())))));

            if (dir == "asc")
            {
                queryFilter = queryFilter.OrderByField(columnName, true);
            }
            else
            {
                queryFilter = queryFilter.OrderByField(columnName, false);
            }
            data.recordsTotal    = _service.GetIQueryableItems().Where(T => T.Active == 1).Count();
            data.recordsFiltered = queryFilter.Count();
            data.data            = queryFilter.Skip(data.start)
                                   .Take(data.length == -1 ? data.recordsTotal : data.length)
                                   .ToList();
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ApplyAjax(DataTableJS data, int?id)
        {
            if (id.HasValue && id > 0)
            {
                var q = (from a in db.BDSApplies
                         join b in db.BDSEmployerInformationEns on a.IdAccountEm equals b.IdAccount
                         join c in db.BDSPersonalInformationEns on a.IdAccountPer equals c.IdAccount
                         join d in db.BDSNewEns on a.IdNews equals d.ID
                         where a.TypeProfile == 1 && c.ID == id orderby a.CreateDate
                         select new { Date = a.CreateDate, IdNew = a.IdNews, IdCompany = b.ID, IdAccount = b.IdAccount, TitleNew = d.Title, FromDateNew = d.FromCreateNews, ToDateNew = d.ToCreateNews, NameCompany = b.Name, Carrers = d.Career });
                var dataCarrer = _serviceCareer.GetIQueryableItems().ToList().Select(T => new { ID = T.ID.ToString(), Name = T.Name }).ToList();
                data.recordsTotal    = q.Count();
                data.recordsFiltered = q.Count();
                var dataEx = q.Skip(data.start)
                             .Take(data.length == -1 ? data.recordsTotal : data.length)
                             .ToList().Select(T => new { Carrers = String.Join(",", dataCarrer.Where(X => T.Carrers.Split(',').Contains(X.ID)).Select(X => X.Name).ToArray()), Date = T.Date, IdNew = T.IdNew, IdCompany = T.IdCompany, IdAccount = T.IdAccount, TitleNew = T.TitleNew, FromDateNew = T.FromDateNew, ToDateNew = T.ToDateNew, NameCompany = T.NameCompany });
                data.data = dataEx;
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        void LoadDataList()
        {
            List <ShowDrop> listSalary = new List <ShowDrop>();

            for (int i = 0; i <= 100; i++)
            {
                var valueshow = new ShowDrop
                {
                    Value = i,
                    Text  = i + " Triệu"
                };
                listSalary.Add(valueshow);
            }
            var Cities = (from a in db.States
                          join b in db.StateTexts on a.name_id equals b.id
                          where b.language_id == "vi" && a.Status == 1
                          select new { ID = a.state_id, Name = b.text }).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();


            var Educations = _serviceEducation.GetIQueryableItems().Where(T => T.Active == 1).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();
            var NewsTypes = _serviceNewsType.GetIQueryableItems().Where(T => T.Active == 1).OrderBy(T => T.Order).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();
            var NewsTypePrices = _serviceNewsTypePrice.GetIQueryableItems().Where(T => T.Active == 1).ToList();
            var TimeWorks      = _serviceTimeWork.GetIQueryableItems().Where(T => T.Active == 1).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();
            var Careers = _serviceCareer.GetIQueryableItems().Where(T => T.Active == 1).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();
            var Languages = _serviceLanguage.GetIQueryableItems().Where(T => T.Active == 1).ToList().Select(T => new SelectListItem {
                Value = T.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();
            var EmployerInformations = _serviceEmployerInformation.GetIQueryableItems().Where(T => T.Active == 1).ToList().Select(T => new SelectListItem {
                Value = T.BDSAccount.ID.ToString(), Text = T.Name.ToString(), Selected = false
            }).ToList();

            Cities.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });

            Educations.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });
            NewsTypes.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });
            TimeWorks.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });
            EmployerInformations.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });
            Languages.Insert(0, new SelectListItem {
                Value = "", Text = "Chọn", Selected = true
            });

            ViewBag.Cities         = Cities;
            ViewBag.Educations     = Educations;
            ViewBag.NewsTypes      = NewsTypes;
            ViewBag.NewsTypePrices = NewsTypePrices;
            ViewBag.TimeWorks      = TimeWorks;
            ViewBag.Careers        = Careers;
            ViewBag.Languages      = Languages;
            ViewBag.ListSalary     = listSalary.ToList().Select(T => new SelectListItem {
                Value = T.Value.ToString(), Text = T.Text.ToString(), Selected = false
            }).ToList();
            ViewBag.EmployerInformations = EmployerInformations;
        }