예제 #1
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));
        }
예제 #2
0
        public ActionResult Create(long calendarId = 0)
        {
            AssignUserInfo();
            dmNguoiDungBusiness   = Get <DM_NGUOIDUNGBusiness>();
            lichCongTacBusiness   = Get <LICHCONGTACBusiness>();
            qlDangKyXeBusiness    = Get <QL_DANGKY_XEBusiness>();
            dmDanhMucDataBusiness = Get <DM_DANHMUC_DATABusiness>();

            DangKyXeEditViewModel model = new DangKyXeEditViewModel();

            model.dangKyXeEntity.DIEM_XUATPHAT = DEFAULT_START_POINT;
            model.groupOfLanhDaos = dmNguoiDungBusiness.GetListUserByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), 0);
            if (calendarId != 0)
            {
                LICHCONGTAC calendar = lichCongTacBusiness.Find(calendarId);
                //kiểm tra lịch công tác chưa bị xóa - mới nhất - chưa được đăng ký
                if (calendar != null && calendar.IS_DELETE != true && calendar.IS_LATTEST == true)
                {
                    QL_DANGKY_XE registration = qlDangKyXeBusiness.GetAvailableRegistrationByCalendarId(calendarId);
                    if (registration == null)
                    {
                        registration = new QL_DANGKY_XE();
                        registration.LICHCONGTAC_ID = calendar.ID;
                        registration.CANBO_ID       = calendar.LANHDAO_ID;
                        registration.MUCDICH        = calendar.TIEUDE;
                        registration.NGAY_XUATPHAT  = calendar.NGAY_CONGTAC;
                        registration.GIO_XUATPHAT   = calendar.GIO_CONGTAC;
                        registration.PHUT_XUATPHAT  = calendar.PHUT_CONGTAC;
                        registration.DIEM_KETTHUC   = calendar.DIADIEM;
                        registration.GHICHU         = calendar.GHICHU;
                        model = new DangKyXeEditViewModel(registration);
                        model.groupOfLanhDaos = dmNguoiDungBusiness
                                                .GetListUserByDeptParentId(currentUser.DeptParentID.GetValueOrDefault(), calendar.LANHDAO_ID.GetValueOrDefault());
                    }
                }
            }
            model.groupOfStartPoints  = dmDanhMucDataBusiness.GetGroupTextByCode(DMLOAI_CONSTANT.DIEM_XUATPHAT);
            model.groupOfDestinations = dmDanhMucDataBusiness.GetGroupTextByCode(DMLOAI_CONSTANT.DIEM_DEN);
            return(View("EditDangKyXe", model));
        }
예제 #3
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));
        }
예제 #4
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"));
        }