Example #1
0
        public ActionResult Reject(InstallmentDetailsViewModel installmentDetailViewModel)
        {
            if (ModelState.IsValidField("txtFirstComment"))
            {
                if (Session["UserDetails"] != null)
                {
                    var installment = _installmentDetailService.GetInstallmentDetailById(installmentDetailViewModel.InstallmentId);

                    var comments             = new Comment();
                    var installmentRejection = new InstallmentRejection();
                    var user = Session["UserDetails"] as UserViewModel;

                    //add data into comments table
                    comments.Comments      = installmentDetailViewModel.FirstComment;
                    comments.CreatedBy     = user.UserName;
                    comments.BeneficiaryId = installment.BeneficiaryId;
                    comments.CreatedDate   = DateTime.Now;
                    comments.CompanyID     = user.CompanyID;
                    comments.RoleId        = user.UserInRoles.Where(u => u.UserId == user.UserId).Select(r => r.RoleId).FirstOrDefault();

                    //add data into installmentRejection table
                    installmentRejection.BeneficiaryId = installment.BeneficiaryId;
                    installmentRejection.InstallmentNo = installment.InstallmentNo;
                    installmentRejection.Comment       = installmentDetailViewModel.FirstComment;
                    installmentRejection.CreatedDate   = DateTime.Now;
                    installmentRejection.CreatedBy     = user.UserName;
                    installmentRejection.CompanyID     = user.CompanyID;

                    //add data into installmentDetails table
                    installment.IsRecommended = false;
                    installment.StageID       = Convert.ToInt32(Common.WorkFlowStages.Rejected);
                    installment.ModifiedBy    = user.UserName;
                    installment.ModifiedDate  = DateTime.Now;
                    _iInstallmentRejectionService.Add(installmentRejection);
                    _iInstallmentRejectionService.SaveChanges();
                    installment.Comments.Add(comments);
                    _installmentDetailService.SaveChanges();
                    return(Json(installmentDetailViewModel.InstallmentId));
                }
            }
            return(Json(installmentDetailViewModel.InstallmentId));
        }
Example #2
0
 public void Update(InstallmentRejection InstallmentRejection)
 {
     installmentRejectionRepository.Update(InstallmentRejection);
 }
Example #3
0
 public void Add(InstallmentRejection InstallmentRejection)
 {
     installmentRejectionRepository.Add(InstallmentRejection);
 }
Example #4
0
        public InstallmentRejection GetInstallmentRejectionById(int id)
        {
            InstallmentRejection benficiaries = installmentRejectionRepository.GetById(id);

            return(benficiaries);
        }