Beispiel #1
0
        public ActionResult CreateEmployee()
        {
            var gender = new List <DDL_Data> {
                new DDL_Data()
                {
                    vchText = "Male", vchValue = "Male"
                },
                new DDL_Data()
                {
                    vchText = "Female", vchValue = "Female"
                },
                new DDL_Data()
                {
                    vchText = "prefer not to say", vchValue = "prefer not to say"
                }
            };

            ViewBag.gender     = gender.ToList();
            ViewBag.courseList = _course.CourseList1().ToList();
            //ViewBag.branchList = _branches.BranchList().ToList();
            ViewBag.designationList  = _designation.DesignationList().ToList();
            ViewBag.joinCategoryList = _joincategory.JoinCategoryList().ToList();
            ViewBag.roleList         = _role.RoleList().ToList();
            ViewBag.levelList        = _level.LevelList().ToList();
            ViewBag.employeeList     = _employee.EmployeeList1().ToList();
            return(View());
        }
        public ActionResult GetLevels()
        {
            //Note: Install "System.Linq.Dynamic" from Nuget Packages

            // after this just include namespace in our Controller "using System.Linq.Dynamic;".

            //Draw counter. This is used by DataTables to ensure that the Ajax returns from server-side processing requests are drawn in sequence by DataTables (Ajax requests are asynchronous and thus can return out of sequence).
            var draw = Request.Form.GetValues("draw").FirstOrDefault();

            //Paging first record indicator. This is the start point in the current data set (0 index based - i.e. 0 is the first record)
            var start = Request.Form.GetValues("start").FirstOrDefault();
            //Number of records that the table can display in the current draw.
            var length = Request.Form.GetValues("length").FirstOrDefault();

            //Find Order Column
            var sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();


            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            //var subjectList = _subject.SubjectList();



            var levelList = (from a in _level.LevelList() select a);

            string search = Request.Form.GetValues("search[value]")[0];

            // Verification.
            if (!string.IsNullOrEmpty(search) &&
                !string.IsNullOrWhiteSpace(search))
            {
                // Apply search
                levelList = levelList.Where(p => p.vchLevelName.ToString().ToLower().Contains(search.ToLower()) ||
                                            p.vchRemarks.ToLower().Contains(search.ToLower()));
            }

            //Sort not working
            //SORT
            //if (!(string.IsNullOrEmpty(sortColumn) && string.IsNullOrEmpty(sortColumnDir)))
            //{
            //    designationList = designationList.OrderBy(sortColumn + " " + sortColumnDir);
            //}

            recordsTotal = levelList.Count();
            var data = levelList.Skip(skip).Take(pageSize).ToList();

            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }, JsonRequestBehavior.AllowGet));



            //  return Json(new { data = subjectList }, JsonRequestBehavior.AllowGet);
        }
Beispiel #3
0
 public ActionResult CreateJoinCategory()
 {
     ViewBag.levelList = _levels.LevelList().ToList();
     return(View());
 }