Ejemplo n.º 1
0
        public ActionResult DanhGiaChatLuong()
        {
            CCTC_THANHPHANBusiness = Get <CCTC_THANHPHANBusiness>();
            DM_NGUOIDUNGBusiness   = Get <DM_NGUOIDUNGBusiness>();
            AssignUserInfo();
            // Chỉ lấy các khối đơn vị
            ReportViewModel model = new ReportViewModel();

            if (IsInActivities(currentUser.ListThaoTac, PermissionVanbanModel.DONVI))
            {
                List <SelectListItem> LstCoCauToChuc = CCTC_THANHPHANBusiness.repository.All().Where(x => x.PARENT_ID == currentUser.DeptParentID && x.ID != currentUser.DM_PHONGBAN_ID).Select(
                    x => new SelectListItem()
                {
                    Text  = x.NAME,
                    Value = x.ID.ToString(),
                }).ToList();
                model.LstCoCauToChuc    = LstCoCauToChuc;
                model.LstDonVi          = new List <SelectListItem>();
                model.HasRoleAssignUnit = true;
                model.LstNhanVien       = new List <SelectListItem>();
            }
            else if (IsInActivities(currentUser.ListThaoTac, PermissionVanbanModel.PHONGBAN))
            {
                CCTC_THANHPHAN DonVi = CCTC_THANHPHANBusiness.Find(currentUser.DM_PHONGBAN_ID);
                if (DonVi != null)
                {
                    SelectListItem selectListItem = new SelectListItem();
                    selectListItem.Text     = DonVi.NAME;
                    selectListItem.Value    = DonVi.ID.ToString();
                    selectListItem.Selected = true;
                    List <SelectListItem> selectListItems = new List <SelectListItem>();
                    selectListItems.Add(selectListItem);
                    model.LstCoCauToChuc = selectListItems;
                    model.LstDonVi       = CCTC_THANHPHANBusiness.GetDataByParent(currentUser.DM_PHONGBAN_ID.HasValue ? currentUser.DM_PHONGBAN_ID.Value : 0, 0);
                }
                else
                {
                    model.LstCoCauToChuc = new List <SelectListItem>();
                    model.LstDonVi       = new List <SelectListItem>();
                }
                model.HasRoleAssignDepartment = true;
                model.LstNhanVien             = new List <SelectListItem>();
                if (model.LstDonVi.Count == 0 && currentUser.DM_PHONGBAN_ID.HasValue)
                {
                    List <int> LstTmpDonVi = new List <int>();
                    LstTmpDonVi.Add(currentUser.DM_PHONGBAN_ID.Value);
                    model.LstNhanVien = DM_NGUOIDUNGBusiness.GetByPhongBan(LstTmpDonVi, 0, new List <int>())
                                        .Select(x => new SelectListItem
                    {
                        Text  = x.HOTEN,
                        Value = x.ID.ToString()
                    }).ToList();
                }
            }
            else if (IsInActivities(currentUser.ListThaoTac, PermissionVanbanModel.CANHAN))
            {
                CCTC_THANHPHAN DonVi = CCTC_THANHPHANBusiness.Find(currentUser.DM_PHONGBAN_ID);
                if (DonVi != null)
                {
                    SelectListItem selectListItem = new SelectListItem();
                    selectListItem.Text     = DonVi.NAME;
                    selectListItem.Value    = DonVi.ID.ToString();
                    selectListItem.Selected = true;
                    List <SelectListItem> selectListItems = new List <SelectListItem>();
                    selectListItems.Add(selectListItem);
                    model.LstDonVi    = selectListItems;
                    model.LstNhanVien = DM_NGUOIDUNGBusiness.GetDsNguoiDung(currentUser.DM_PHONGBAN_ID.HasValue ? currentUser.DM_PHONGBAN_ID.Value : 0);
                }
                else
                {
                    model.LstDonVi = new List <SelectListItem>();
                }
                model.HasRoleAssignChuyenVien = true;
            }
            return(View(model));
        }