Пример #1
0
        public ApplyForLeaveViewModel GetEmployeeLeaveInfo(string IDNO)
        {
            DALLeave _leave = new DALLeave();

            ApplyForLeaveViewModel temp = _leave.GetEmployeeLeaveInfo(IDNO);

            temp.IDNO = IDNO;
            temp.DateFiled = System.DateTime.Today.ToShortDateString();
            temp.EmploymentStatus = temp.EmploymentStatus;
            temp.LeaveType = GetLeaveTypes(IDNO);
            temp.Manager = GetManagers();

            return temp;
        }
Пример #2
0
        public bool Apply(string IDNO, ApplyForLeaveViewModel model)
        {
            bool updatedLeaveCreditWithPay = true;
            bool apply = false;

            DALLeave _leave = new DALLeave();

            //If leave type is VL/SL with Pay
            if(model.LessThisLeave != 0)
            {
                model.LessThisLeave = RoundLessThisLeave(model.LessThisLeave);
                updatedLeaveCreditWithPay = _leave.UpdateLeaveCreditWithPay(IDNO, model);
            }

            //Insert into dbo.Leave
            apply = _leave.Apply(IDNO, model);

            return (updatedLeaveCreditWithPay && apply);
        }
Пример #3
0
        public IEnumerable<LeaveTypeModel> GetAllLeaveTypes()
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetAllLeaveTypes();
        }
Пример #4
0
        public bool DeleteLeave(int leaveID)
        {
            DALLeave _leave = new DALLeave();

            return _leave.DeleteLeave(leaveID);
        }
Пример #5
0
        public void Cancel(int LeaveID)
        {
            DALLeave _leave = new DALLeave();

            return;
        }
Пример #6
0
        public bool InsertDepartmentInfo()
        {
            DALLeave _leave = new DALLeave();

            return _leave.InsertDepartmentInfo();
        }
Пример #7
0
        public IEnumerable<LeaveViewModel> GetPendingLeaves(string IDNO)
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetPendingLeaves(IDNO);
        }
Пример #8
0
        public IEnumerable<LeaveViewModel> GetAllLeaves()
        {
            DALLeave _leave = new DALLeave();

            var leaves = _leave.GetAllLeaves();
            
            foreach(LeaveViewModel leave in leaves)
            {
                leave.Manager = _leave.GetManagerName(leave.LeaveID);
            }

            return leaves;
        }
Пример #9
0
        public bool InsertLeaveCredit(LeaveCreditModel model)
        {
            DALLeave _leave = new DALLeave();

            model.BeginningDate = CalculateBeginningDate(model.HireDate);
            model.CutOffDate = new DateTime(2016, 11, 30);

            model.CreditsAtCutOffInDays = Days360.CalculateDays360(model.BeginningDate, model.CutOffDate);
            model.CreditsAtCutOffInMonths = (float)model.CreditsAtCutOffInDays / 30f;

            float _creditsPerMonth = CalculateCreditsPerMonth(model.IDNO, model.LeaveType);
            model.LeaveCreditsPerMonth = _creditsPerMonth / 12f;

            model.UnusedLeavesDays = model.CreditsAtCutOffInMonths * model.LeaveCreditsPerMonth;
            model.UnusedLeavesHours = model.UnusedLeavesDays * 8f;
            model.LessLeaveAvailmentHours = 0;
            model.ConvertibleLeavesHours = model.UnusedLeavesHours - model.LessLeaveAvailmentHours;

            return _leave.InsertLeaveCredit(model);
        }
Пример #10
0
        //public bool UpdateLeave()
        //{

        //}

        

        public bool UpdateLeaveStatus(string IDNO, LeaveViewModel model)
        {
            DALLeave _leave = new DALLeave();

            return _leave.UpdateLeaveStatus(IDNO, model);
        }
Пример #11
0
        public IEnumerable<LeaveViewModel> Search(SearchViewModel model)
        {
            var minDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;

            if(model.From < minDate)
            {
                model.From = minDate;
            }
            if (model.To < minDate)
            {
                model.To = minDate;
            }
            if (model.DateFiled < minDate)
            {
                model.DateFiled = minDate;
            }

            DALLeave _leave = new DALLeave();

            return _leave.Search(model);
        }
Пример #12
0
        public LeaveSummaryModel GetLeaveInfoSummary(int leaveID)
        {
            DALProfile _profile = new DALProfile();
            DALLeave _leave = new DALLeave();

            LeaveViewModel temp = _leave.GetLeaveInfo(leaveID);
            var profile = _profile.GetEmployeeProfile(temp.EmployeeIDNO);
            string name = profile.LastName + ", " + profile.FirstName + " " + profile.MiddleName;
            string manager = _leave.GetManagerName(leaveID);

            LeaveSummaryModel model = new LeaveSummaryModel();
            model.EmployeeName = name;
            model.Manager = manager;

            model.Address = temp.Address;
            model.DateFiled = temp.DateFiled;
            model.DateOfLeaveFrom = temp.DateOfLeaveFrom;
            model.DateOfLeaveTo = temp.DateOfLeaveTo;
            model.DateResponded = temp.DateResponded;
            model.DurationInDays = temp.DurationInDays;
            model.DurationInHours = temp.DurationInHours;
            model.EmployeeIDNO = temp.EmployeeIDNO;
            model.EmploymentStatus = profile.EmploymentStatus;
            model.LeaveID = temp.LeaveID;
            model.LeaveStatus = temp.LeaveStatus;
            model.LeaveType = temp.LeaveType;
            model.Reason = temp.Reason;
            model.RemarksForEmployee = temp.RemarksForEmployee;
            model.RemarksForHR = temp.RemarksForHR;
            model.RespondedBy = temp.RespondedBy;

            return model;
        }
Пример #13
0
        public LeaveViewModel GetLeaveInfo(int leaveID)
        {
            DALProfile _profile = new DALProfile();
            DALLeave _leave = new DALLeave();

            LeaveViewModel temp = _leave.GetLeaveInfo(leaveID);

            var profile = _profile.GetEmployeeProfile(temp.EmployeeIDNO);
            string name = profile.LastName + ", " + profile.FirstName + " " + profile.MiddleName;
            string manager = _leave.GetManagerName(leaveID);

            temp.EmployeeName = name;
            temp.Manager = manager;

            return temp;
        }
Пример #14
0
        public int GetPendingLeavesCount(string IDNO)
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetPendingLeavesCount(IDNO);
        }
Пример #15
0
        public IEnumerable<LeaveTypeModel> GetLeaveTypes(string IDNO)
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetLeaveTypes(IDNO);
        }
Пример #16
0
        public List<string> GetIDNOs()
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetIDNOs();
        }
Пример #17
0
        public IEnumerable<ManagerModel> GetManagers()
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetManagers();
        }
Пример #18
0
        public bool InsertAdditionalInfo()
        {
            DALLeave _leave = new DALLeave();

            return _leave.InsertAdditionalInfo();
        }
Пример #19
0
        public decimal GetLeaveCreditPreviousBalance(string IDNO, byte leaveType)
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetLeaveCreditPreviousBalance(IDNO, leaveType);
        }
Пример #20
0
        public DateTime GetHireDate(string IDNO)
        {
            DALLeave _leave = new DALLeave();

            return _leave.GetHireDate(IDNO).HireDate;
        }