예제 #1
0
        public ActionResult Index()
        {
            AssignUserInfo();
            var demo = currentUser;

            dmNguoiDungBusiness = Get <DM_NGUOIDUNGBusiness>();
            LichCongTacViewModel viewModel = new LichCongTacViewModel();

            viewModel.calendarType    = LICH_CONSTANT.NGAY;
            viewModel.groupOfLanhDaos = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), 0);
            viewModel.isLeader        = dmNguoiDungBusiness.CheckIsLeader(currentUser.ID);
            //kiểm tra là lãnh đạo
            if (viewModel.isLeader)
            {
                viewModel.groupOfLanhDaos = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = currentUser.ID.ToString(),
                        Text  = currentUser.HOTEN
                    }
                };
            }

            DM_THAOTAC userFunction = currentUser.ListThaoTac.Where(o => o.MA_THAOTAC.ToUpper() == "TAO_LICHCONGTAC").FirstOrDefault();

            viewModel.canCreate = (userFunction != null && userFunction.DM_THAOTAC_ID > 0);
            return(View(viewModel));
        }
예제 #2
0
        public PartialViewResult EditFastRoomRequest(QUANLY_PHONGHOP item)
        {
            AssignUserInfo();
            DM_NGUOIDUNGBusiness    = Get <DM_NGUOIDUNGBusiness>();
            QUANLY_PHONGHOPBusiness = Get <QUANLY_PHONGHOPBusiness>();
            QUANLY_PHONGHOP roomEntity;

            if (item.ID > 0)
            {
                roomEntity = QUANLY_PHONGHOPBusiness.Find(item.ID) ?? new QUANLY_PHONGHOP();
            }
            else
            {
                if (item.GIOBATDAU >= 8 && item.GIOBATDAU < 23)
                {
                    item.GIOKETTHUC = item.GIOBATDAU + 1;
                }
                else if (item.GIOBATDAU < 8)
                {
                    item.GIOBATDAU  = 8;
                    item.GIOKETTHUC = item.GIOBATDAU + 1;
                }
                else
                {
                    item.GIOKETTHUC = item.GIOBATDAU;
                }
                roomEntity = item;
            }
            EditVM viewModel = new EditVM(roomEntity);

            viewModel.groupLeaders = DM_NGUOIDUNGBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), roomEntity.USER_ID);
            return(PartialView("EditPhong", viewModel));
        }
예제 #3
0
        public PartialViewResult EditFastLichCongTac(int year, int month, int day, int hour = 0, int minute = 0, long id = 0)
        {
            AssignUserInfo();
            lichCongTacBusiness   = Get <LICHCONGTACBusiness>();
            dmNguoiDungBusiness   = Get <DM_NGUOIDUNGBusiness>();
            dmDanhMucDataBusiness = Get <DM_DANHMUC_DATABusiness>();

            EditLichCongTacViewModel model = new EditLichCongTacViewModel();
            List <long> groupLanhDaoIds    = new List <long>();
            long        userId             = 0;

            if (id > 0)
            {
                LICHCONGTAC entity = lichCongTacBusiness.Find(id);
                if (entity != null && entity.IS_DELETE != true && entity.NGAY_CONGTAC.IsOldWeek() == false)
                {
                    model  = new EditLichCongTacViewModel(entity);
                    userId = entity.LANHDAO_ID.GetValueOrDefault();
                }
            }
            else
            {
                LICHCONGTAC entity = new LICHCONGTAC();
                entity.NGAY_CONGTAC = new DateTime(year, month, day);
                entity.GIO_CONGTAC  = hour;
                entity.PHUT_CONGTAC = minute;
                model = new EditLichCongTacViewModel(entity);
            }
            model.groupOfLanhDaos     = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), userId);
            model.groupOfDestinations = dmDanhMucDataBusiness.GetGroupTextByCode(DMLOAI_CONSTANT.DIEM_DEN);
            model.isPopUp             = true;
            return(PartialView("_EditFastLichCongTac", model));
        }
예제 #4
0
        public ActionResult Index()
        {
            AssignUserInfo();
            DM_NGUOIDUNGBusiness = Get <DM_NGUOIDUNGBusiness>();
            LichHopViewModel viewModel = new LichHopViewModel();

            viewModel.groupOfLeaders = DM_NGUOIDUNGBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), 0);
            return(View(viewModel));
        }
예제 #5
0
        public PartialViewResult SendEmail(long userId = 0)
        {
            AssignUserInfo();
            dmNguoiDungBusiness = Get <DM_NGUOIDUNGBusiness>();
            LichCongTacEmailViewModel viewModel = new LichCongTacEmailViewModel();

            viewModel.groupOfUsers = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), 0);
            return(PartialView("_SendEmailLichCongTac", viewModel));
        }
예제 #6
0
        public PartialViewResult EditRoomRequest(long id)
        {
            AssignUserInfo();
            DM_NGUOIDUNGBusiness    = Get <DM_NGUOIDUNGBusiness>();
            QUANLY_PHONGHOPBusiness = Get <QUANLY_PHONGHOPBusiness>();
            QUANLY_PHONGHOP roomEntity = QUANLY_PHONGHOPBusiness.Find(id) ?? new QUANLY_PHONGHOP();
            EditVM          viewModel  = new EditVM(roomEntity);

            viewModel.groupLeaders = DM_NGUOIDUNGBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), roomEntity.USER_ID);
            return(PartialView("EditPhong", viewModel));
        }
예제 #7
0
        public ActionResult Edit(long id)
        {
            AssignUserInfo();

            dmNguoiDungBusiness = Get <DM_NGUOIDUNGBusiness>();
            qlDangKyXeBusiness  = Get <QL_DANGKY_XEBusiness>();
            QL_DANGKY_XE          register = qlDangKyXeBusiness.Find(id) ?? new QL_DANGKY_XE();
            DangKyXeEditViewModel model    = new DangKyXeEditViewModel(register);

            model.groupOfLanhDaos = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), register.CANBO_ID.GetValueOrDefault());
            return(View("EditDangKyXe", model));
        }
예제 #8
0
        public ActionResult CreateLichCongTac(long idVanBanDen = 0)
        {
            AssignUserInfo();
            hscvVanBanDenBusiness = Get <HSCV_VANBANDENBusiness>();
            cctcThanhPhanBusiness = Get <CCTC_THANHPHANBusiness>();
            dmNguoiDungBusiness   = Get <DM_NGUOIDUNGBusiness>();
            dmDanhMucDataBusiness = Get <DM_DANHMUC_DATABusiness>();
            wfLogBusiness         = Get <WF_LOGBusiness>();

            EditLichCongTacViewModel model = new EditLichCongTacViewModel();
            long userId = 0;

            if (idVanBanDen > 0)
            {
                HSCV_VANBANDEN entityVanBanDen = hscvVanBanDenBusiness.Find(idVanBanDen);
                if (entityVanBanDen != null && entityVanBanDen.NGUOITAO == currentUser.ID && hscvVanBanDenBusiness.CheckIsFinish(entityVanBanDen.ID))
                {
                    LICHCONGTAC calendar = new LICHCONGTAC();
                    calendar.TIEUDE       = entityVanBanDen.TRICHYEU;
                    calendar.NGAY_CONGTAC = entityVanBanDen.NGAYCONGTAC ?? DateTime.Now;
                    calendar.GIO_CONGTAC  = entityVanBanDen.GIO_CONGTAC.GetValueOrDefault();
                    calendar.PHUT_CONGTAC = entityVanBanDen.PHUT_CONGTAC.GetValueOrDefault();
                    model = new EditLichCongTacViewModel(calendar);
                    model.entityLichCongTac = calendar;

                    //lấy người xử lý cuối làm người chủ trì công tác
                    DM_NGUOIDUNG_BO lastProcessor = wfLogBusiness.GetFinalProcessor(entityVanBanDen.ID, MODULE_CONSTANT.VANBANDEN);
                    userId = lastProcessor.ID;
                }
                else
                {
                    return(Redirect("/Home/UnAuthor"));
                }
            }
            else if (SessionManager.HasValue("CreateCalendarOfTheDay"))
            {
                LICHCONGTAC entityCalendar = (LICHCONGTAC)SessionManager.GetValue("CreateCalendarOfTheDay");
                model = new EditLichCongTacViewModel(entityCalendar);

                SessionManager.Remove("CreateCalendarOfTheDay");
            }
            model.groupOfLanhDaos     = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), userId);
            model.groupOfDestinations = dmDanhMucDataBusiness.GetGroupTextByCode(DMLOAI_CONSTANT.DIEM_DEN);
            return(View("EditLichCongTac", model));
        }
예제 #9
0
        public ActionResult UpdateLichCongTac(long id)
        {
            AssignUserInfo();
            JsonResultBO editResult = new JsonResultBO(true);

            cctcThanhPhanBusiness = Get <CCTC_THANHPHANBusiness>();
            dmNguoiDungBusiness   = Get <DM_NGUOIDUNGBusiness>();
            lichCongTacBusiness   = Get <LICHCONGTACBusiness>();
            dmDanhMucDataBusiness = Get <DM_DANHMUC_DATABusiness>();

            LICHCONGTAC entity = lichCongTacBusiness.Find(id);

            if (entity != null && entity.IS_DELETE != true && entity.NGAY_CONGTAC.IsOldWeek() == false)
            {
                EditLichCongTacViewModel model = new EditLichCongTacViewModel(entity);
                model.groupOfLanhDaos     = dmNguoiDungBusiness.GetDropDownByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), entity.LANHDAO_ID.GetValueOrDefault());
                model.groupOfDestinations = dmDanhMucDataBusiness.GetGroupTextByCode(DMLOAI_CONSTANT.DIEM_DEN);
                return(View("EditLichCongTac", model));
            }
            return(Redirect("/Home/UnAuthor"));
        }