예제 #1
0
        // GET: PayrollOvertimes/Edit/5
        public ActionResult Edit(int id)
        {
            int EmpCode            = Convert.ToInt32(Session["Empcode"]);
            PayrollOvertimeDTO res = new PayrollOvertimeDTO();

            res = _payrollOvertimeService.GetPayrollOvertimeById(id);
            res.OvertimeDateNP        = (NepEngDate.EngToNep(Convert.ToDateTime(res.OvertimeDate)));
            res.ApproveStatusDateNP   = (NepEngDate.EngToNep(Convert.ToDateTime(res.ApproveStatusDate)));
            res.OvertimeAppliedDateNP = (NepEngDate.EngToNep(Convert.ToDateTime(res.OvertimeAppliedDate)));
            res.ApproverList          = _dynamicSelectList.GetLeaveApproverSelectList(res.EmpCode, "Overtime");
            ViewBag.EmpCode           = res.EmpCode;
            ViewBag.ddlEmployeeList   = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList();
            return(View(res));
        }
        public LeaveApplicationDTOs CreateLeaveApplicationInformation(int empcode, int leaveid, string recommendType)
        {
            LeaveApplicationDTOs Result = new LeaveApplicationDTOs();

            Result.LeaveEmpCode  = empcode;
            Result.LeaveTypeId   = leaveid;
            Result.LeaveTypeName = _unitOfWork.LeaveTypeRepository.All().Where(x => x.LeaveTypeId == leaveid).Select(x => x.LeaveTypeName).FirstOrDefault();

            var leaveTypeData = _unitOfWork.LeaveTypeRepository.All().Where(x => x.LeaveTypeId == leaveid).FirstOrDefault();

            // Result.Leavetypes.HalfdayAllow = leaveTypeData.HalfdayAllow;

            Result.IsHalfDayAllow = leaveTypeData.HalfdayAllow;


            LeaveBalance LeaveBalance = LeavebalanceIndividual(null, empcode, leaveid);

            if (LeaveBalance.Leave_Balance <= 0)
            {
                throw new Exception("This Leave Is not assigned for you .");
            }
            else
            if (LeaveBalance.LeaveTypeAssignment != "General")
            {
                throw new Exception("Special Leave can not be applied from  here..");
            }
            Result.ApproverList    = _DynamicSelectList.GetLeaveApproverSelectList(empcode, recommendType).ToList();
            Result.RecommenderList = _DynamicSelectList.GetLeaveRecommenderSelectList(empcode, recommendType).ToList();
            return(Result);
        }
예제 #3
0
        public ActionResult Update(int id)
        {
            int            curentemp = Convert.ToInt32(Session["Empcode"]);
            int            roleid    = Convert.ToInt32(Session["RoleId"]);
            LeaveEarnedDTO Record    = new LeaveEarnedDTO();

            Record = _LeaveEarnedService.GetOneLeaveEarned(id);
            Record.WorkedStartDateNP   = NepEngDate.EngToNep(Record.WorkedStartDate);
            Record.WorkedEndDateNP     = NepEngDate.EngToNep(Record.WorkedEndDate);
            Record.YearSelectList      = _SpecialleavetypeService.GetYearSelectList();
            Record.LeaveTypeSelectList = _LeaveEarnedService.GetEarnedLeaveTypeList();


            //   Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetSelectedBranchEmployeeSelectList(curentemp,Convert.ToInt32(Record.EmpCode));
            Record.ApproveEmployeeCodeSelectlist = _DynamicSelectList.GetLeaveApproverSelectList(Record.EmpCode, "Earning");
            Record.EmpId = Record.EmpCode;
            Record.GetRecommederSelectList = _DynamicSelectList.GetLeaveRecommenderSelectList(Record.EmpCode, "Earning");

            return(View("../Leave/LeaveEarned/Update", Record));
        }
예제 #4
0
        public ActionResult Create(LeaveApplicationDTOs Record, int levid)
        {
            string recommendType = "General";
            int    empcode       = Convert.ToInt32(Session["EmpCode"]);

            Record.ApproverList    = _DynamicSelectList.GetLeaveApproverSelectList(empcode, recommendType).ToList();
            Record.RecommenderList = _DynamicSelectList.GetLeaveRecommenderSelectList(empcode, recommendType).ToList();
            try
            {
                Record.LeaveStartDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveStartDateNP));
                Record.LeaveEndDate   = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveEndDateNP));

                if (Record.IsHalfDay)
                {
                    Record.LeaveEndDate = Record.LeaveStartDate;
                }

                if (ModelState.IsValid)
                {
                    Record = _ValidateLeave.ValidateLeave(Record);

                    if (Record.ErrorList != null && Record.ErrorList.Count > 0)
                    {
                        return(View(Record));
                    }
                    else
                    {
                        _LeaveAddAdmin.LeaveApplicationCreate(Record);
                        Session["success"] = "Leave Created Sucessfully ";
                        return(RedirectToAction("Index"));
                    }
                }
                else
                {
                    Record.ApproverList = _LeaveAddAdmin.CreateLeaveApplicationInformation(empcode, Record.LeaveTypeId, recommendType).ApproverList;

                    return(View(Record));
                }
            }
            catch (Exception Ex)
            {
                Session["error"]    = Ex.Message;
                Record.ApproverList = _LeaveAddAdmin.CreateLeaveApplicationInformation(empcode, Record.LeaveTypeId, recommendType).ApproverList;

                return(View(Record));
            }
        }