Beispiel #1
0
        public ActionResult Apply(ApplyForLeaveViewModel model)
        {
            BLLLeave _leave = new BLLLeave();

            JsonResult json = new JsonResult();
            json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

            model.PeriodFrom = Convert.ToDateTime(model.PeriodFrom).ToShortDateString();
            model.PeriodTo = Convert.ToDateTime(model.PeriodTo).ToShortDateString();

            string result = "error";
            if(_leave.Apply(User.IDNO, model))
            {
                //Email manager
                BLLEmail _email = new BLLEmail();
                if(_email.EmailManager(model))
                {
                    result = "success";
                }
            }

            json.Data = new { result = result };

            return json;
        }
Beispiel #2
0
        // GET: Leave
        public ActionResult Index()
        {

            BLLLeave _leave = new BLLLeave();

            return View(_leave.GetUserLeaves(User.IDNO));
        }
Beispiel #3
0
        public ActionResult Respond(LeaveViewModel model)
        {
            BLLLeave _leave = new BLLLeave();

            JsonResult json = new JsonResult();
            json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

            string result = "error";
            if (_leave.UpdateLeaveStatus(User.IDNO, model))
            {
                model = _leave.GetLeaveInfo(model.LeaveID);

                BLLEmail _email = new BLLEmail();
                if(_email.EmailEmployee(model))
                {
                    result = "success";
                }
            }

            json.Data = new { result = result, id = model.LeaveID, status = model.LeaveStatus };

            return json;
        }
Beispiel #4
0
        public ActionResult GetLeaveInfoPartial(int LeaveID)
        {
            BLLLeave _leave = new BLLLeave();

            LeaveViewModel model = _leave.GetLeaveInfo(LeaveID);
            

            return PartialView("LeaveInfoPartial",model);
        }
Beispiel #5
0
        public ActionResult Pending()
        {
            BLLLeave _leave = new BLLLeave();

            return View(_leave.GetPendingLeaves(User.IDNO));
        }
Beispiel #6
0
        public ActionResult Cancel(int LeaveID)
        {
            BLLLeave _leave = new BLLLeave();

            return View();
        }
Beispiel #7
0
        public ActionResult Apply()
        {
            BLLLeave _leave = new BLLLeave();

            return View(_leave.GetEmployeeLeaveInfo(User.IDNO));
        }
Beispiel #8
0
        public ActionResult InsertLeaveCredit()
        {
            BLLLeave _leave = new BLLLeave();
            LeaveCreditModel model = new LeaveCreditModel();

            //int[] idnos = {10001, 10002, 10003, 10004, 10005, 10006, 10007, 10009, 10012, 10014, 10016, 10018, 10020, 10023, 10025, 
            //               10027, 10028, 10029, 10030, 10032, 10033, 10035, 10038, 10042, 10043, 10047, 10051, 10054, 10057, 10058, 10059,
            //               10060, 10061, 10062, 10063, 10064, 10065, 10067, 10069, 10070, 10071, 10074, 10075, 10076, 10077, 10081,
            //               10083, 10084, 10085, 10086, 10087, 10090, 10091, 10092, 10093, 10094, 10095, 10096, 10099, 10101, 10102, 10103, 10104,
            //               10105, 10106, 10107, 10108, 10109, 10111, 10112, 10113, 10114, 10115, 10116, 10117, 10118, 10119, 10120, 10121, 10122,
            //               10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131, 10132, 10133, 10134};

            var idnos = _leave.GetIDNOs();

            foreach (string idno in idnos)
            {
                model.IDNO = Convert.ToInt32(idno);
                model.HireDate = _leave.GetHireDate(idno);
                model.LeaveType = 1;
                _leave.InsertLeaveCredit(model);

                model.LeaveType = 3;
                _leave.InsertLeaveCredit(model);
            }

            //if (_leave.InsertLeaveCredit(model))
            //{
            //    TempData["insertLeaveCredit_result"] = "LeaveCredit information was added.";
            //}

            return View();
        }
Beispiel #9
0
        public ActionResult GetLeaveCreditPreviousBalance(string LeaveType)
        {
            BLLLeave _leave = new BLLLeave();

            Int16 previousBalance = (Int16)_leave.GetLeaveCreditPreviousBalance(User.IDNO, Convert.ToByte(LeaveType));

            return Json(previousBalance, JsonRequestBehavior.AllowGet);
        }
Beispiel #10
0
        public int GetPendingLeavesCount()
        {
            BLLLeave _leave = new BLLLeave();

            int count = _leave.GetPendingLeavesCount("10001");

            return count;
        }
Beispiel #11
0
        public ActionResult GetSearchPartial()
        {
            BLLLeave _leave = new BLLLeave();

            SearchViewModel model = new SearchViewModel();
            model.LeaveType = _leave.GetAllLeaveTypes();

            return PartialView("SearchPartial", model);
        }
Beispiel #12
0
        public ActionResult SummarySearch(SearchViewModel model)
        {
            BLLLeave _leave = new BLLLeave();

            IEnumerable<LeaveViewModel> result = _leave.Search(model);

            return PartialView("SearchResultPartial", result);
        }
Beispiel #13
0
        public ActionResult SummaryAll()
        {
            BLLLeave _leave = new BLLLeave();

            var leaves = _leave.GetAllLeaves();

            return PartialView("SearchResultPartial", leaves);
        }
Beispiel #14
0
        public ActionResult GetLeaveInfoPendingPartial(int LeaveID, string EmployeeIDNO)
        {

            BLLLeave _leave = new BLLLeave();

            LeaveViewModel model = _leave.GetLeaveInfo(LeaveID);
            model.EmployeeIDNO = EmployeeIDNO;

            return PartialView("LeaveInfoPendingPartial", model);
        }