示例#1
0
        public ActionResult Add(PayrollLeaveDeductionDTO Record)
        {
            Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            Record.YearSelectList         = _SpecialleavetypeService.GetYearSelectList();
            Record.LeaveTypeSelectList    = _payrollLeaveDeductionService.GetPayrollLeaveDeductionLeaveTypeSelectList();
            Record.LeaveDate = Convert.ToDateTime(NepEngDate.NepToEng(Record.LeaveDateNepali));
            try
            {
                if (ModelState.IsValid)
                {
                    _payrollLeaveDeductionService.AddPayrollLeaveDeduction(Record);

                    Session["Success"] = "Successfully Added Payroll Leave Deduction";
                    return(RedirectToAction("Index", "PayrollLeaveDeduction"));
                }
                else
                {
                    ViewBag.Error = "Form Error";
                }
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(View("../Leave/PayrollLeaveDeduction/Add", Record));
        }
示例#2
0
        public JsonResult PayrollLeaveBalance(int LeaveTypeId, int LeaveYearId, int EmpCode)
        {
            PayrollLeaveDeductionDTO Record = new PayrollLeaveDeductionDTO();

            Record.leavebalance = _payrollLeaveDeductionService.GetPayrollLeaveBalance(LeaveTypeId, LeaveYearId, EmpCode);
            return(Json(Record.leavebalance, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult Update(PayrollLeaveDeductionDTO Record)
        {
            int roleid = Convert.ToInt32(Session["RoleId"]);

            Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            Record.YearSelectList         = _SpecialleavetypeService.GetYearSelectList();
            Record.LeaveTypeSelectList    = _payrollLeaveDeductionService.GetPayrollLeaveDeductionLeaveTypeSelectList();
            try
            {
                if (ModelState.IsValid)
                {
                    _payrollLeaveDeductionService.UpdatePayrollLeaveDeduction(Record);

                    Session["Success"] = "Successfully Updated Payroll Leave Deduction";
                    return(RedirectToAction("Index", "PayrollLeaveDeduction"));
                }
                else
                {
                    ViewBag.Error = "Form Error";
                }
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(View("../Leave/PayrollLeaveDeduction/Update", Record));
        }
        public PayrollLeaveDeductionDTO GetOnePayrollLeaveDeduction(int id)
        {
            PayrollLeaveDeduction    Record       = _unitOfWork.PayrollLeaveDeductionRepository.Get(x => x.DeductionId == id).FirstOrDefault();
            PayrollLeaveDeductionDTO ReturnRecord = PayrollLeaveDeductionResponseFormatter.PayrollLeaveDeductionToDto(Record);

            return(ReturnRecord);
        }
        public void AddPayrollLeaveDeduction(PayrollLeaveDeductionDTO Record)
        {
            PayrollLeaveDeduction ReturnRecord = RequestFormatters.PayrollLeaveDeductionRequestFormatter.PayrollLeaveDeductionDtoToDb(Record);

            ReturnRecord.DeductionType = "C";

            _unitOfWork.PayrollLeaveDeductionRepository.Create(ReturnRecord);
        }
        public void UpdatePayrollLeaveDeduction(PayrollLeaveDeductionDTO Record)
        {
            PayrollLeaveDeduction ReturnRecord = RequestFormatters.PayrollLeaveDeductionRequestFormatter.PayrollLeaveDeductionDtoToDb(Record);

            ReturnRecord.DeductionType = "C";

            ReturnRecord.EmpCode = Record.EmpId;
            _unitOfWork.PayrollLeaveDeductionRepository.Update(ReturnRecord);
        }
示例#7
0
        public ActionResult Update(int id)
        {
            PayrollLeaveDeductionDTO Record = _payrollLeaveDeductionService.GetOnePayrollLeaveDeduction(id);

            Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            Record.YearSelectList         = _SpecialleavetypeService.GetYearSelectList();
            Record.LeaveDateNepali        = (NepEngDate.EngToNep(Record.LeaveDate));
            Record.LeaveTypeSelectList    = _payrollLeaveDeductionService.GetPayrollLeaveDeductionLeaveTypeSelectList();
            Record.EmpId = Record.EmpCode;
            return(View("../Leave/PayrollLeaveDeduction/Update", Record));
        }
示例#8
0
        public ActionResult Add()
        {
            int roleid = Convert.ToInt32(Session["RoleId"]);
            PayrollLeaveDeductionDTO Record = new PayrollLeaveDeductionDTO();

            Record.YearSelectList      = _SpecialleavetypeService.GetYearSelectList();
            Record.LeaveTypeSelectList = _payrollLeaveDeductionService.GetPayrollLeaveDeductionLeaveTypeSelectList();
            Record.LeaveYearId         = _payrollLeaveDeductionService.GetCurrentYear();
            if (Record.LeaveTypeId == null)
            {
                ViewBag.Error = "No Current Leave Year. Please Add Current Leave Year.";
                return(View("../Leave/PayrollLeaveDeduction/Add", Record));
            }
            Record.EmployeeCodeSelectlist = _LeaveEarnedService.GetBrancheEmployeeSelectList(Convert.ToInt32(ViewBag.Empcode));
            return(View("../Leave/PayrollLeaveDeduction/Add", Record));
        }
        public static PayrollLeaveDeductionDTO PayrollLeaveDeductionToDto(PayrollLeaveDeduction Data)
        {
            PayrollLeaveDeductionDTO Record = new PayrollLeaveDeductionDTO
            {
                DeductionId   = Data.DeductionId,
                EmpCode       = Data.EmpCode,
                LeaveTypeId   = Data.LeaveTypeId,
                LeaveDays     = Data.LeaveDays,
                DeductionType = Data.DeductionType,
                LeaveYearId   = Data.LeaveYearId,
                LeaveDate     = Convert.ToDateTime(Data.LeaveDate),
                Details       = Data.Details,
                isEncashed    = Data.isEncashed,
            };

            return(Record);
        }
示例#10
0
        public static PayrollLeaveDeduction PayrollLeaveDeductionDtoToDb(PayrollLeaveDeductionDTO Data)
        {
            PayrollLeaveDeduction Record = new PayrollLeaveDeduction
            {
                DeductionId   = Data.DeductionId,
                EmpCode       = Data.EmpCode,
                LeaveTypeId   = Data.LeaveTypeId,
                LeaveDays     = Data.LeaveDays,
                DeductionType = Data.DeductionType,
                LeaveYearId   = Data.LeaveYearId,
                LeaveDate     = Data.LeaveDate,
                Details       = Data.Details,
                isEncashed    = Data.isEncashed,
            };

            return(Record);
        }
        public static List <PayrollLeaveDeductionDTO> PayrollLeaveDeductionListToDtoList(List <PayrollLeaveDeduction> Data)
        {
            List <PayrollLeaveDeductionDTO> ReturnRecord = new List <PayrollLeaveDeductionDTO>();

            foreach (var Row in Data)
            {
                PayrollLeaveDeductionDTO Record = new PayrollLeaveDeductionDTO
                {
                    DeductionId   = Row.DeductionId,
                    EmpCode       = Row.EmpCode,
                    LeaveTypeId   = Row.LeaveTypeId,
                    LeaveDays     = Row.LeaveDays,
                    DeductionType = Row.DeductionType,
                    LeaveYearId   = Row.LeaveYearId,
                    LeaveDate     = Convert.ToDateTime(Row.LeaveDate),
                    Details       = Row.Details,
                    isEncashed    = Row.isEncashed,
                    Employee      = new EmployeeDTO
                    {
                        EmpCode = Row.Employee.EmpCode,
                        EmpName = Row.Employee.EmpName
                    },

                    LeaveType = new LeaveTypeDTO
                    {
                        LeaveTypeId   = Row.LeaveType.LeaveTypeId,
                        LeaveTypeName = Row.LeaveType.LeaveTypeName
                    },
                    LeaveYear = new LeaveYearDTO
                    {
                        YearName = Row.LeaveYear.YearName
                    }
                };
                ReturnRecord.Add(Record);
            }
            return(ReturnRecord);
        }