Ejemplo n.º 1
0
        public ManageLeaveModel GetLeaveBalance(string userid)
        {
            int id = Convert.ToInt32(userid);
            ManageLeaveModel leaveBalance = new ManageLeaveModel();

            leaveBalance = LeaveAccess.GetLeaveBalance(id);
            return(leaveBalance);
        }
Ejemplo n.º 2
0
        public ManageLeaveModel GetLeaveBalance(int userid)
        {
            USER user = NCSSEntities.USERs.Where(p => p.UserId == userid).FirstOrDefault();
            List <LEAVEBALANCE> leaveBalance = NCSSEntities.LEAVEBALANCEs.Where(p => p.UserId == userid).ToList();
            ManageLeaveModel    manageleave  = new ManageLeaveModel
            {
                AnnualLeave   = leaveBalance.Where(p => p.LeaveTypeId == 1).FirstOrDefault().RemainingDays.ToString(),
                FullName      = user.FullName,
                HospitalLeave = leaveBalance.Where(p => p.LeaveTypeId == 4).FirstOrDefault().RemainingDays.ToString(),
                ManagerName   = NCSSEntities.USERs.Where(p => p.UserId == user.ManagerId).FirstOrDefault().FullName,
                MedicalLeave  = leaveBalance.Where(p => p.LeaveTypeId == 2).FirstOrDefault().RemainingDays.ToString(),
                NoPayLeave    = leaveBalance.Where(p => p.LeaveTypeId == 3).FirstOrDefault().RemainingDays.ToString()
            };

            return(manageleave);
        }
Ejemplo n.º 3
0
 public ActionResult Index()
 {
     if (Session["user"] == null)
     {
         return(RedirectToAction("Index", "Users"));
     }
     else
     {
         ManageLeaveModel leaveModel = new ManageLeaveModel();
         try
         {
             string id = Session["id"].ToString();
             leaveModel = leaveManagement.GetLeaveBalance(id);
         }
         catch
         {
         }
         return(View(leaveModel));
     }
 }