コード例 #1
0
        public ActionResult DeleteUserPermanent(int id)
        {
            //get mentor
            mentorList = _MentorRepositeryObject.GetALLMentorByEmployeeMentorId(id);
            //delete mentor as Traineer
            if (mentorList.Count > 0)
            {
                _MentorRepositeryObject.DeleteMentorPermanent(mentorList);
            }


            //get mentor
            List <Mentor> mentorListNew = _MentorRepositeryObject.GetAllMentorByEmployeeId(id);

            //delete mentor as Traineer
            if (mentorListNew.Count > 0)
            {
                _MentorRepositeryObject.DeleteMentorPermanent(mentorListNew);
            }

            //get task
            taskList = _TaskRepositeryObject.GetAllTaskByEmployeeId(id);


            if (taskList.Count > 0)
            {
                foreach (Task task in taskList)
                {
                    //get attachement
                    attachmentList = _AttachmentRepositeryObject.GetAttachmentsByTaskId(task.Id);
                    //Delete All attachement
                    if (attachmentList.Count > 0)
                    {
                        _AttachmentRepositeryObject.PermanentDeleteAttachement(attachmentList);
                    }
                }
                //delete task
                _TaskRepositeryObject.PermanentDeleteTask(taskList);
            }

            //get user
            user = _UsersRepositeryObject.GetUsersDetailUsingId(id);
            //delete user
            if (user != null)
            {
                _UsersRepositeryObject.DeletePermanent(user);
            }


            TempData["Message"] = "Employee Deleted Permanentliy";
            return(RedirectToAction("Trash"));
        }
コード例 #2
0
        public ActionResult EmployeeDashboard(int?page)
        {
            int          pageSize         = 15;
            int          pageNumber       = (page ?? 1);
            List <Users> traineeUsersList = new List <Users>();
            List <Task>  taskList1        = new List <Task>();
            int          id = Convert.ToInt32(Session["UserId"]);

            //All task Submiteed by Employee //read by EmployeeId
            ViewBag.task = _TaskRepositeryObject.GetAllTaskByEmployeeId(id);

            //Employee personal details //read by EmployeeId
            ViewBag.Employee = _UsersRepositeryObject.GetUsersDetailUsingId(id);

            //Employee's trainees details //read by EmployeeMentorId
            traineeList = _TaskRepositeryObject.GetAllTaineesByEmployeeMentorId(id);

            //Read user details for a perticulae employee for there deytails
            foreach (var item in traineeList)
            {
                traineeUsersList.Add(_UsersRepositeryObject.GetUsersDetailUsingId(item.EmployeeId));
            }
            ViewBag.traineeUsersList = traineeUsersList;

            //Get all task from the task table
            taskList = _TaskRepositeryObject.GetAllTask();

            //remove all other employee task who are not under the particular employee
            taskList.RemoveAll(x => !traineeList.Exists(i => x.EmployeeId == i.EmployeeId));
            ViewBag.traineesTask = taskList;

            //read all attechement
            attachementList     = _AttachmentRepositeryObject.GetAllAttachments();
            ViewBag.attachement = attachementList.ToList();
            ViewBag.Message     = TempData["Message"];


            return(View());
        }