Exemple #1
0
        public JsonResult Delete(string userName)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            bool check = phongBanBussinessService.DeleteNguoiDung(userName);

            return(Json(!check, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult GetChucVuTheoPhongBan(int id)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <ChucVuModel>       listChucVu = phongBanBussinessService.GetChucVuTheoPhongBan(id);

            return(Json(listChucVu, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public JsonResult CheckUserName(string UserName)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            bool check = phongBanBussinessService.CheckUserName(UserName);

            return(Json(!check, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Search(string[] lanhDao, int tuanLe, string search)
        {
            KeHoachCT keHoachCT = new KeHoachCT();
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            keHoachCT.ListPhongBan = phongBanBussinessService.GetNguoiDungLanhDao();
            ViewBag.TuanLe         = this.GetListWeek();
            ViewBag.KeHoachCT      = keHoachCT.ListPhongBan;

            KeHoachCTBussinessService ketHoachCTBussinessService = new KeHoachCTBussinessService();
            JQueryDataTableParamModel param = new JQueryDataTableParamModel();

            param.CanBo = "'" + CurrentUser.Name + "'";

            if (lanhDao == null || string.IsNullOrEmpty(lanhDao[0]))
            {
                param.CanBo = StringExtensions.GetListPhongBanOrLanhDao(keHoachCT.ListPhongBan);
            }
            else
            {
                param.CanBo = StringExtensions.GetStringListUser(lanhDao);
            }
            param.StartDate = DateTimeExtensions.FirstDateOfWeek(DateTime.Now.Year, tuanLe, System.Globalization.CultureInfo.CurrentCulture);
            param.EndDate   = param.StartDate.AddDays(6);
            param.sSearch   = search;
            //Print day of week
            GetDayOfWeek(param.StartDate);
            List <KeHoachCongTacModel> listKeHoachCongTacModel = ketHoachCTBussinessService.GetKeHoachCongTac(param);

            return(View(listKeHoachCongTacModel));
        }
Exemple #5
0
        public JsonResult ChangePassWord(string userName, string passWord)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            bool check = phongBanBussinessService.ChangePassWord(userName, passWord, this.CurrentUser.Name);

            return(Json(!check, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public ActionResult Create(User user)
        {
            user.CreateBy = this.CurrentUser.Name;
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            phongBanBussinessService.AddNguoiDung(user);
            return(RedirectToAction("Index"));
        }
        public JsonResult GetJson(JQueryDataTableParamModel param)
        {
            // check login

            int    sortColumnIndex = param.ISortCol_0;
            string order           = param.SSortDir_0;

            string orderBy = string.Empty;

            switch (sortColumnIndex)
            {
            case 0:
                orderBy = "Name";
                break;

            case 1:
                orderBy = "Description";
                break;

            case 2:
                orderBy = "Code";
                break;

            case 3:
                orderBy = "CreateDate";
                break;
            }

            KeHoachCTBussinessService keHoachCTBussinessService = new KeHoachCTBussinessService();
            PhongBanBussinessService  phongBanBussinessService  = new PhongBanBussinessService();

            param.CanBo = CurrentUser.Name;

            if (param.TuanLe == 0)
            {
                param.StartDate = DateTimeExtensions.FirstDateOfWeek(DateTime.Now.Year, DateTimeExtensions.WeekNumber(DateTime.Today), System.Globalization.CultureInfo.CurrentCulture);
                param.EndDate   = param.StartDate.AddDays(6);
            }
            else
            {
                param.StartDate = DateTimeExtensions.FirstDateOfWeek(DateTime.Now.Year, param.TuanLe, System.Globalization.CultureInfo.CurrentCulture);
                param.EndDate   = param.StartDate.AddDays(6);
            }
            List <KeHoachCT> listKeHoachCT = keHoachCTBussinessService.GetKeHoachCaNhan(param);
            int totalRecords = 0;

            totalRecords = 1;

            // return jon datatable
            return(Json(new
            {
                sEcho = param.SEcho,
                iTotalRecords = totalRecords,
                iTotalDisplayRecords = totalRecords,
                aaData = listKeHoachCT
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
        //
        // GET: /PhongBan/
        public ActionResult Index()
        {
            KeHoachCT keHoachCT = new KeHoachCT();
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            keHoachCT.ListPhongBan         = phongBanBussinessService.GetNguoiDungPhongBan();
            keHoachCT.ListPhongBanDistinct = phongBanBussinessService.GetNguoiDungDistinct(keHoachCT.ListPhongBan);
            ViewBag.TuanLe = this.GetListWeek();
            return(View(keHoachCT));
        }
Exemple #9
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 #10
0
        public object GetLichCongTacCaNhan()
        {
            JQueryDataTableParamModel param = new JQueryDataTableParamModel();
            var    identity = (ClaimsIdentity)User.Identity;
            string username = identity.Claims.First().Value;
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            param.CanBo     = username;
            param.StartDate = DateTime.Today.AddYears(-1);
            param.EndDate   = DateTime.Today.AddYears(1);
            return(phongBanBussinessService.GetLichCaNhan(param));
        }
Exemple #11
0
        public ActionResult Edit(string userName)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <User> listUser = phongBanBussinessService.getNguoiDungByUserName(userName);

            if (listUser == null || listUser.Count == 0)
            {
                return(HttpNotFound());
            }
            ViewBag.PhongBan = this.GetPhongBan(listUser[0].IdPhongBan);
            ViewBag.IdChucVu = this.GetChucVu(listUser[0].IdChucVu, listUser[0].IdPhongBan);
            return(View(listUser[0]));
        }
Exemple #12
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 #13
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());
        }
Exemple #14
0
        // 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());
            }
        }
Exemple #15
0
        public JsonResult GetJsonNguoiDung(JQueryDataTableParamModel param)
        {
            // check login

            int    sortColumnIndex = param.ISortCol_0;
            string order           = param.SSortDir_0;

            string orderBy = string.Empty;

            switch (sortColumnIndex)
            {
            case 0:
                orderBy = "Name";
                break;

            case 1:
                orderBy = "Description";
                break;

            case 2:
                orderBy = "Code";
                break;

            case 3:
                orderBy = "CreateDate";
                break;
            }

            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();


            List <User> listUser     = phongBanBussinessService.GetListNguoiDung(param);
            int         totalRecords = 0;

            totalRecords = phongBanBussinessService.GetCountListNguoiDung(param);

            // return jon datatable
            return(Json(new
            {
                sEcho = param.SEcho,
                iTotalRecords = totalRecords,
                iTotalDisplayRecords = totalRecords,
                aaData = listUser
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #16
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));
        }
Exemple #17
0
        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 #18
0
        public ActionResult Index()
        {
            KeHoachCT keHoachCT = new KeHoachCT();
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();

            keHoachCT.ListPhongBan = phongBanBussinessService.GetNguoiDungLanhDao();
            ViewBag.TuanLe         = this.GetListWeek();
            ViewBag.LanhDao        = keHoachCT.ListPhongBan;

            KeHoachCTBussinessService ketHoachCTBussinessService = new KeHoachCTBussinessService();
            JQueryDataTableParamModel param = new JQueryDataTableParamModel();

            param.CanBo = StringExtensions.GetVariableSql(CurrentUser.Name);

            param.CanBo     = StringExtensions.GetListPhongBanOrLanhDao(keHoachCT.ListPhongBan);
            param.StartDate = DateTimeExtensions.FirstDateOfWeek(DateTime.Now.Year, DateTimeExtensions.WeekNumber(DateTime.Today), System.Globalization.CultureInfo.CurrentCulture);
            param.EndDate   = param.StartDate.AddDays(6);
            //Print day of week
            GetDayOfWeek(param.StartDate);
            return(View(ketHoachCTBussinessService.GetKeHoachCongTac(param, "distinct")));
        }
Exemple #19
0
        private List <SelectListItem> GetPhongBan(int selected = -1)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <PhongBan>          listPhongBan             = phongBanBussinessService.GetAllPhongBan();
            List <SelectListItem>    listItemPhongBan         = new List <SelectListItem>();

            foreach (var item in listPhongBan)
            {
                if (item.MaPhongBan == selected)
                {
                    listItemPhongBan.Add(new SelectListItem {
                        Text = item.TenPhongBan, Value = item.MaPhongBan.ToString(), Selected = true
                    });
                }
                else
                {
                    listItemPhongBan.Add(new SelectListItem {
                        Text = item.TenPhongBan, Value = item.MaPhongBan.ToString()
                    });
                }
            }
            return(listItemPhongBan);
        }
Exemple #20
0
        private List <SelectListItem> GetChucVu(int selected, int idPhongBan)
        {
            PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService();
            List <ChucVuModel>       listChucVu     = phongBanBussinessService.GetChucVuTheoPhongBan(idPhongBan);
            List <SelectListItem>    listItemChucVu = new List <SelectListItem>();

            foreach (var item in listChucVu)
            {
                if (item.IdChucVu == selected)
                {
                    listItemChucVu.Add(new SelectListItem {
                        Text = item.TenChucVu, Value = item.IdChucVu.ToString(), Selected = true
                    });
                }
                else
                {
                    listItemChucVu.Add(new SelectListItem {
                        Text = item.TenChucVu, Value = item.IdChucVu.ToString()
                    });
                }
            }
            return(listItemChucVu);
        }