// Search Employee
        public ActionResult EmployeeSearch(string employeeSearchBox, int pageIndex = 1)
        {
            Employee_Status obj_search = new Employee_Status();

            if (employeeSearchBox != null && employeeSearchBox != " ")
            {
                obj_search.employees = (from t in db.Employees
                                        where
                                        t.EmpName.Contains(employeeSearchBox)
                                        select t).ToList();
            }
            else
            {
                obj_search.employees = db.Employees.ToList();
            }

            obj_search.employeeCount    = obj_search.projects.Count;
            obj_search.employeePageSize = pageSize;

            obj_search.employeePageNumber = pageIndex;

            obj_search.projects          = obj_search.projects.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            obj_search.employeeSearchBox = employeeSearchBox;

            return(PartialView("_Employee", obj_search));
        }
        // GET: Admin
        public ActionResult Index()
        {
            Employee_Status obj = new Employee_Status();

            obj.employees = db.Employees.ToList();
            obj.statuses  = db.Statuses.ToList();
            obj.projects  = db.Projects.ToList();

            obj.employeeCount      = obj.employees.Count;
            obj.employeePageSize   = pageSize;
            obj.employeePageNumber = 1;
            obj.employees          = obj.employees.Take(pageSize).ToList();

            obj.statusCount      = obj.statuses.Count;
            obj.statusPageSize   = pageSize;
            obj.statusPageNumber = 1;
            obj.statuses         = obj.statuses.Take(pageSize).ToList();

            obj.projectsCount      = obj.projects.Count;
            obj.projectsPageSize   = pageSize;
            obj.projectsPageNumber = 1;
            obj.projects           = obj.projects.Take(pageSize).ToList();

            return(View(obj));
        }
        // Search
        public ActionResult TaskSearchPage(string SearchBox, int pageIndex = 1)
        {
            Employee_Status obj = new Employee_Status();

            obj.employees = db.Employees.ToList();
            obj.statuses  = db.Statuses.ToList();
            obj.projects  = db.Projects.ToList();

            if (SearchBox != null && SearchBox != " ")
            {
                obj.tasks = (from t in db.Tasks
                             where
                             t.TaskName.Contains(SearchBox) ||
                             t.Description.Contains(SearchBox) ||
                             t.employee.EmpName.Contains(SearchBox) ||
                             t.status.StatusName.Contains(SearchBox) ||
                             t.project.ProjectName.Contains(SearchBox)
                             select t).ToList();
            }
            else
            {
                obj.tasks         = db.Tasks.ToList();
                ViewData["Error"] = "Error message text.";
            }

            obj.tasksCount    = obj.tasks.Count;
            obj.tasksPageSize = pageSize;

            obj.tasksPageNumber = pageIndex;

            obj.tasks          = obj.tasks.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            obj.tasksSearchBox = SearchBox;

            return(PartialView("_TasksList", obj));
        }
        //Search Status
        public ActionResult StatusSearch(string statusSearchBox, int pageIndex_status = 1)
        {
            Employee_Status obj_search = new Employee_Status();

            if (statusSearchBox != null && statusSearchBox != " ")
            {
                obj_search.statuses = (from t in db.Statuses
                                       where
                                       t.StatusName.Contains(statusSearchBox)
                                       select t).ToList();
            }
            else
            {
                obj_search.statuses = db.Statuses.ToList();
            }


            obj_search.statusCount    = obj_search.statuses.Count;
            obj_search.statusPageSize = pageSize;

            obj_search.statusPageNumber = pageIndex_status;

            obj_search.statuses        = obj_search.statuses.Skip((pageIndex_status - 1) * pageSize).Take(pageSize).ToList();
            obj_search.statusSearchBox = statusSearchBox;

            return(PartialView("_Status", obj_search));
        }
        // Search Employee
        public ActionResult ProjectSearch(string SearchBox, int pageIndex = 1)
        {
            Employee_Status obj_search = new Employee_Status();

            if (SearchBox != null && SearchBox != " ")
            {
                obj_search.projects = (from t in db.Projects
                                       where
                                       t.ProjectName.Contains(SearchBox)
                                       select t).ToList();
            }
            else
            {
                obj_search.projects = db.Projects.ToList();
            }

            obj_search.projectsCount    = obj_search.projects.Count;
            obj_search.projectsPageSize = pageSize;

            obj_search.projectsPageNumber = pageIndex;

            obj_search.projects          = obj_search.projects.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            obj_search.projectsSearchBox = SearchBox;

            return(PartialView("_Project", obj_search));
        }
Exemple #6
0
        // GET: Employees/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Employee employee = db.Employees.Find(id);

            if (employee == null)
            {
                return(HttpNotFound());
            }
            ViewBag.designation_id     = new SelectList(db.Designations, "id", "designation_name", employee.designation_id);
            ViewBag.employee_status_id = new SelectList(db.Employee_Status, "id", "employee_status_name", employee.employee_status_id);
            ViewBag.employee_gender_id = new SelectList(db.Genders, "id", "gender_name", employee.employee_gender_id);

            Departament     depart     = db.Departaments.Find(id);
            Designation     design     = db.Designations.Find(id);
            Gender          gender     = db.Genders.Find(id);
            Employee        employ     = db.Employees.Find(id);
            Employee_Status emp_status = db.Employee_Status.Find(id);

            return(View(new Employee_view_model {
                select_dep = depart, select_des = design, select_gen = gender, selected = employ, select_emp_status = emp_status
            }));
        }