Exemple #1
0
        public ActionResult Create()
        {
            KeHoachCT keHoachCT = new KeHoachCT();
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            keHoachCT.ListPhongBan         = phongBanBussinessService.GetAllNguoiDung();
            keHoachCT.ListPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(keHoachCT.ListPhongBan);
            keHoachCT.MucDo = 3;
            return(View(keHoachCT));
        }
Exemple #2
0
        // GET: LichTuan/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                KeHoachCTBussinessService keHoachCTBussinessService = new KeHoachCTBussinessService();
                PhongBanBussinessService  phongBanBussinessService  = new PhongBanBussinessService();
                List <KeHoachCT>          listkeHoachCT             = keHoachCTBussinessService.GetKeHoachForUpdate(id);
                KeHoachCT keHoachCT = listkeHoachCT[0];
                //Get All User
                keHoachCT.ListPhongBan = phongBanBussinessService.GetAllNguoiDung();

                //Get List PhongBan
                keHoachCT.ListPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(keHoachCT.ListPhongBan);


                List <ThamDuModel> listThamDuModel = keHoachCTBussinessService.GetThamDuByIdKeHoach(id);
                //Get List KhachMoi
                //ThamDu : type =1
                keHoachCT.ListKhachMoiThamDu = keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id) == null ?
                                               null : keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id).FindAll(t => t.Kieu == 1);
                //ChuTri : type =2
                keHoachCT.ListKhachMoiChuTri = keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id) == null ?
                                               null : keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id).FindAll(t => t.Kieu == 2);

                //Check and fill selected for User in PhongBan
                //ThamDu : type =1
                keHoachCT.ListPhongBanThamDu = new List <PhongBan>();
                List <PhongBan> listPhongBanThamDuOld = keHoachCT.ListPhongBan;

                List <PhongBan> listPhongBanChuTriOld = ListExtensions.DeepCopy(listPhongBanThamDuOld);

                List <ThamDuModel> listKhachMoiModel = listThamDuModel.FindAll(t => t.Kieu == 1);
                keHoachCT.ListPhongBanThamDu = phongBanBussinessService.CheckSelectedThamDu(listPhongBanThamDuOld, listKhachMoiModel);
                //ChuTri : type =2
                keHoachCT.ListPhongBanChuTri = new List <PhongBan>();

                List <ThamDuModel> listChutriModel = listThamDuModel.FindAll(t => t.Kieu == 2);
                keHoachCT.ListPhongBanChuTri = phongBanBussinessService.CheckSelectedThamDu(listPhongBanChuTriOld, listChutriModel);

                //Get tuan le
                ViewBag.TuanLe = this.GetListWeekEdit(DateTimeExtensions.WeekOfYearISO8601(DateTime.ParseExact(keHoachCT.DenNgay, "dd/MM/yyyy", CultureInfo.InvariantCulture)));

                return(View(listkeHoachCT[0]));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        public ActionResult NavList()
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            var    listPhongBan = phongBanBussinessService.GetAllNguoiDung();
            string IdPhongBan   = CurrentUser.Claims.Where(c => c.Type == "IdPhongBan").FirstOrDefault().Value.ToString();
            string maChucVu     = CurrentUser.Claims.Where(c => c.Type == "MaChucVu").FirstOrDefault().Value.ToString();

            if (maChucVu == "TP" || maChucVu == "CVP")
            {
            }
            var listPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(listPhongBan);

            ViewBag.ListPhongBan         = listPhongBan;
            ViewBag.ListPhongBanDistinct = listPhongBanDistinct;
            return(View());
        }
        // GET: LichTuan/Create

        // GET: LichTuan/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                KeHoachCTBussinessService keHoachCTBussinessService = new KeHoachCTBussinessService();
                PhongBanBussinessService  phongBanBussinessService  = new PhongBanBussinessService();
                List <KeHoachCT>          listkeHoachCT             = keHoachCTBussinessService.GetKeHoachForUpdate(id);
                KeHoachCT keHoachCT = listkeHoachCT[0];
                //Get All User
                keHoachCT.ListPhongBan = phongBanBussinessService.GetAllNguoiDung();

                //Get List PhongBan
                keHoachCT.ListPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(keHoachCT.ListPhongBan);


                List <ThamDuModel> listThamDuModel = keHoachCTBussinessService.GetThamDuByIdKeHoach(id);
                //Get List KhachMoi
                //ThamDu : type =1
                keHoachCT.ListKhachMoiThamDu = keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id) == null ?
                                               null : keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id).FindAll(t => t.Kieu == 1);
                //ChuTri : type =2
                keHoachCT.ListKhachMoiChuTri = keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id) == null ?
                                               null : keHoachCTBussinessService.GetKhachMoiByIdKeHoach(id).FindAll(t => t.Kieu == 2);

                //Check and fill selected for User in PhongBan
                //ThamDu : type =1
                keHoachCT.ListPhongBanThamDu = new List <PhongBan>();
                List <PhongBan> listPhongBanThamDuOld = keHoachCT.ListPhongBan;

                List <PhongBan> listPhongBanChuTriOld = ListExtensions.DeepCopy(listPhongBanThamDuOld);

                List <ThamDuModel> listKhachMoiModel = listThamDuModel.FindAll(t => t.Kieu == 1);
                keHoachCT.ListPhongBanThamDu = phongBanBussinessService.CheckSelectedThamDu(listPhongBanThamDuOld, listKhachMoiModel);
                //ChuTri : type =2
                keHoachCT.ListPhongBanChuTri = new List <PhongBan>();

                List <ThamDuModel> listChutriModel = listThamDuModel.FindAll(t => t.Kieu == 2);
                keHoachCT.ListPhongBanChuTri = phongBanBussinessService.CheckSelectedThamDu(listPhongBanChuTriOld, listChutriModel);


                return(View(listkeHoachCT[0]));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create()
        {
            KeHoachCT keHoachCT = new KeHoachCT();

            keHoachCT.Deadline = DateTime.Now;
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <KeHoachCT>         listKeHoachCT            = new List <KeHoachCT>();

            listKeHoachCT.Add(keHoachCT);

            ViewBag.Month = this.GetListMonth(DateTime.Now.Year);
            var listPhongBan         = phongBanBussinessService.GetAllNguoiDung();
            var listPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(listPhongBan);

            ViewBag.ListPhongBan         = listPhongBan;
            ViewBag.ListPhongBanDistinct = listPhongBanDistinct;

            return(View(listKeHoachCT));
        }
Exemple #6
0
        public ActionResult Create()
        {
            KeHoachCT keHoachCT = new KeHoachCT();

            keHoachCT.DenNgay = DateTime.Now.ToString("dd/MM/yyyy");
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <KeHoachCT>         listKeHoachCT            = new List <KeHoachCT>();

            listKeHoachCT.Add(keHoachCT);

            ViewBag.TuanLe = this.GetListWeek();
            var listPhongBan         = phongBanBussinessService.GetAllNguoiDung();
            var listPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(listPhongBan);

            ViewBag.ListPhongBan         = listPhongBan;
            ViewBag.ListPhongBanDistinct = listPhongBanDistinct;

            return(View(listKeHoachCT));
        }