Exemplo n.º 1
0
        public ActionResult LoadSkillGrid(int?employeeId, string module, int page, int rows)
        {
            try
            {
                PersonalDetailsDAL    dal   = new PersonalDetailsDAL();
                SkillDetailsViewModel model = new SkillDetailsViewModel();

                int totalCount;

                model.EmployeeSkillDetails = dal.GetEmpSkillDetailsAndHistory(page, rows, employeeId.GetValueOrDefault(), out totalCount, module);

                if ((model.EmployeeSkillDetails == null || model.EmployeeSkillDetails.Count <= 0) && page - 1 > 0)
                {
                    page = page - 1;
                    model.EmployeeSkillDetails = dal.GetEmployeeSkillHistoryDetails(page, rows, employeeId.GetValueOrDefault(), out totalCount);
                }

                var jsonData = new
                {
                    total   = (int)Math.Ceiling((double)totalCount / (double)rows),
                    page    = page,
                    records = totalCount,
                    rows    = model.EmployeeSkillDetails
                };

                return(Json(jsonData));
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", "Error", new { errorCode = "There are some errors." }));
            }
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     DataContext = new SkillDetailsViewModel((int)e.Parameter);
     base.OnNavigatedTo(e);
 }