Esempio n. 1
0
        public ActionResult Update(int id, PayrollInsurancePremiumDTO Record)
        {
            int EmpCode = Convert.ToInt32(Session["Empcode"]);

            Record.IsuranceClaimId            = id;
            Record.StartDate                  = Convert.ToDateTime(NepEngDate.NepToEng(Record.StartDateNP));
            Record.EndDate                    = Convert.ToDateTime(NepEngDate.NepToEng(Record.EndDateNP));
            Record.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList();
            Record.AmountTypeSelectList       = StaticSelectList.AmountTypeSelectList();
            ViewBag.ddlEmployeeList           = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList();
            ViewBag.EmpCode                   = Record.EmpCode;
            try
            {
                if (ModelState.IsValid)
                {
                    _PayrollInsurancePremiumService.UpdatePayrollInsurancePremium(Record);
                    Session["Success"] = "Successfully Updated Insurance Information";
                    return(RedirectToAction("Index", "PayrollInsurancePremium", new { id = Record.EmpCode }));
                }
                else
                {
                    ViewBag.Error = "Form Error";
                }
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(View("../PayrollInsurancePremium/Update", Record));
        }
Esempio n. 2
0
        public PayrollInsurancePremiumDTO GetOnePayrollInsurancePremium(int Id)
        {
            PayrollInsurancePremium    Record       = _unitOfWork.PayrollInsurancePremiumRepository.Get(x => x.IsuranceClaimId == Id).FirstOrDefault();
            PayrollInsurancePremiumDTO ReturnRecord = ResponseFormatters.PayrollInsuranceResponseFormatter.PayrollInsuranceDbToDTO(Record);

            return(ReturnRecord);
        }
Esempio n. 3
0
        public ActionResult Create(PayrollInsurancePremiumDTO data)
        {
            data.StartDate = Convert.ToDateTime(NepEngDate.NepToEng(data.StartDateNP));
            data.EndDate   = Convert.ToDateTime(NepEngDate.NepToEng(data.EndDateNP));
            int EmpCode = Convert.ToInt32(Session["Empcode"]);

            data.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList();
            data.AmountTypeSelectList       = StaticSelectList.AmountTypeSelectList();
            ViewBag.ddlEmployeeList         = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList();

            ModelState.Clear();
            try
            {
                if (ModelState.IsValid)
                {
                    _PayrollInsurancePremiumService.InsertPayrollInsurancePremium(data);
                    Session["Success"] = "Successfully Added Employee Insurance Information";
                    return(RedirectToAction("Index/"));
                }
                else
                {
                    ViewBag.Error = "Form Error";
                }
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(View("../PayrollInsurancePremium/Create", data));
        }
Esempio n. 4
0
        public ActionResult Details(int id)
        {
            PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO();

            Record             = _PayrollInsurancePremiumService.GetOnePayrollInsurancePremium(id);
            ViewBag.EmpCode    = Record.EmpCode;
            Record.StartDateNP = NepEngDate.EngToNep(Convert.ToDateTime(Record.StartDate)).ToString().Replace('/', '-');
            Record.EndDateNP   = NepEngDate.EngToNep(Convert.ToDateTime(Record.EndDate)).ToString().Replace('/', '-');
            if (Record.AmountType == "A")
            {
                Record.AmountType = "Annual";
            }
            else if (Record.AmountType == "H")
            {
                Record.AmountType = "Half Yearly";
            }
            else if (Record.AmountType == "Q")
            {
                Record.AmountType = "Quarterly";
            }
            else if (Record.AmountType == "M")
            {
                Record.AmountType = "Monthly";
            }
            return(View("../PayrollInsurancePremium/Details", Record));
        }
        public static IEnumerable <PayrollInsurancePremiumDTO> PayrollInsuranceDbListToDTOList(IEnumerable <PayrollInsurancePremium> ModelData)
        {
            List <PayrollInsurancePremiumDTO> ReturnRecord = new List <PayrollInsurancePremiumDTO>();

            foreach (PayrollInsurancePremium Row in ModelData)
            {
                PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO
                {
                    IsuranceClaimId       = Row.IsuranceClaimId,
                    InsuranceCompanyId    = Row.InsuranceCompanyId,
                    InsuredAmount         = Row.InsuredAmount,
                    PremiumAmount         = Row.PremiumAmount,
                    AmountType            = Row.AmountType,
                    StartDate             = Row.StartDate,
                    EndDate               = Row.EndDate,
                    InsuranceClaimFyId    = Row.InsuranceClaimFyId,
                    EmpCode               = Row.EmpCode,
                    InsurancePolicyNumber = Row.InsurancePolicyNumber,
                    Employee              = new EmployeeDTO
                    {
                        EmpCode = Row.Employee.EmpCode,
                        EmpName = Row.Employee.EmpName,
                    },
                    InsuranceCompany = new InsuranceCompanyDTO
                    {
                        Id          = Row.InsuranceCompany.Id,
                        CompanyName = Row.InsuranceCompany.CompanyName
                    }
                };
                ReturnRecord.Add(Record);
            }
            return(ReturnRecord);
        }
        public static PayrollInsurancePremiumDTO PayrollInsuranceDbToDTO(PayrollInsurancePremium ModelData)
        {
            PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO
            {
                IsuranceClaimId       = ModelData.IsuranceClaimId,
                InsuranceCompanyId    = ModelData.InsuranceCompanyId,
                InsuredAmount         = ModelData.InsuredAmount,
                PremiumAmount         = ModelData.PremiumAmount,
                AmountType            = ModelData.AmountType,
                StartDate             = ModelData.StartDate,
                EndDate               = ModelData.EndDate,
                InsuranceClaimFyId    = ModelData.InsuranceClaimFyId,
                EmpCode               = ModelData.EmpCode,
                InsurancePolicyNumber = ModelData.InsurancePolicyNumber,
                Employee              = new EmployeeDTO
                {
                    EmpCode = ModelData.Employee.EmpCode,
                    EmpName = ModelData.Employee.EmpName,
                },
                InsuranceCompany = new InsuranceCompanyDTO
                {
                    Id          = ModelData.InsuranceCompany.Id,
                    CompanyName = ModelData.InsuranceCompany.CompanyName
                }
            };

            return(Record);
        }
Esempio n. 7
0
        public ActionResult Create()
        {
            //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu();
            int EmpCode = Convert.ToInt32(Session["Empcode"]);

            ViewBag.EmpCode = "";
            PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO();

            Record.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList();
            ViewBag.ddlEmployeeList           = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList();
            Record.AmountTypeSelectList       = StaticSelectList.AmountTypeSelectList();
            //Record.EmpCode = Id;
            return(View("../PayrollInsurancePremium/Create", Record));
        }
Esempio n. 8
0
        public ActionResult Update(int id)
        {
            int EmpCode = Convert.ToInt32(Session["Empcode"]);
            PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO();

            Record = _PayrollInsurancePremiumService.GetOnePayrollInsurancePremium(id);
            Record.InsuranceCompanySelectlist = _PayrollInsurancePremiumService.GetInsuranceCompanySelectList();
            Record.AmountTypeSelectList       = StaticSelectList.AmountTypeSelectList();
            ViewBag.ddlEmployeeList           = _dynamicSelectList.GetEmployeeByEmpCode(EmpCode).ToList();
            ViewBag.EmpCode    = Record.EmpCode;
            Record.StartDateNP = NepEngDate.EngToNep(Convert.ToDateTime(Record.StartDate)).ToString().Replace('/', '-');
            Record.EndDateNP   = NepEngDate.EngToNep(Convert.ToDateTime(Record.EndDate)).ToString().Replace('/', '-');
            return(View("../PayrollInsurancePremium/Update", Record));
        }
Esempio n. 9
0
        public ActionResult Delete(int id)
        {
            PayrollInsurancePremiumDTO Record = new PayrollInsurancePremiumDTO();

            try
            {
                //Record.EmpCode = _PayrollInsurancePremiumService.GetEmpCode(id);
                _PayrollInsurancePremiumService.DeletePayrollInsurancePremium(id);
                Session["Success"] = "Successfully Deleted Insurance Information";
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(RedirectToAction("Index", "PayrollInsurancePremium"));
        }
 public static PayrollInsurancePremium ConvertRespondentInfoFromDTO(PayrollInsurancePremiumDTO empDocDTO)
 {
     Mapper.CreateMap <PayrollInsurancePremiumDTO, PayrollInsurancePremium>().ConvertUsing(
         m =>
     {
         return(new PayrollInsurancePremium
         {
             IsuranceClaimId = m.IsuranceClaimId,
             InsuranceCompanyId = m.InsuranceCompanyId,
             InsuredAmount = m.InsuredAmount,
             PremiumAmount = m.PremiumAmount,
             AmountType = m.AmountType,
             StartDate = Convert.ToDateTime(m.StartDate),
             EndDate = Convert.ToDateTime(m.EndDate),
             InsuranceClaimFyId = m.InsuranceClaimFyId,
             EmpCode = m.EmpCode,
             InsurancePolicyNumber = m.InsurancePolicyNumber
         });
     });
     return(Mapper.Map <PayrollInsurancePremiumDTO, PayrollInsurancePremium>(empDocDTO));
 }
Esempio n. 11
0
        public void UpdatePayrollInsurancePremium(PayrollInsurancePremiumDTO Record)
        {
            PayrollInsurancePremium ReturnRecord = PayrollInsuranceRequestFormatter.ConvertRespondentInfoFromDTO(Record);

            _unitOfWork.PayrollInsurancePremiumRepository.Update(ReturnRecord);
        }
Esempio n. 12
0
        public PayrollInsurancePremiumDTO InsertPayrollInsurancePremium(PayrollInsurancePremiumDTO Record)
        {
            PayrollInsurancePremium ReturnRecord = PayrollInsuranceRequestFormatter.ConvertRespondentInfoFromDTO(Record);

            return(PayrollInsuranceRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.PayrollInsurancePremiumRepository.Create(ReturnRecord)));
        }