Exemple #1
0
        public JsonResult GetLoanOutStandingDetail(T_Loan ObjLoan)
        {
            var ObjList = new T_LoanDetails();

            try
            {
                if (_blLoan.GetLoanDetailList(ObjLoan).Count > 0)
                {
                    ObjList = _blLoan.GetLoanOutStandingDetail(ObjLoan);
                }
                else
                {
                    var t_Loan = _blLoan.GetById(ObjLoan.Id);
                    if (t_Loan != null)
                    {
                        ObjList.TotalLoanAmount   = t_Loan.Amount;
                        ObjList.OutStandingAmount = t_Loan.Amount;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(new { ObjList, Message = "Sucess" }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public T_LoanDetails GetLoanOutStandingDetail(T_Loan ObjLoan)
        {
            var ObjList = new T_LoanDetails();

            try
            {
                using (_objUnitOfWork = new UnitOfWork())
                {
                    var queryLoan       = _objUnitOfWork._T_Loan_Repository.Query();
                    var queryLoanDetail = _objUnitOfWork._T_LoanDetails_Repository.Query();

                    var vLoan       = queryLoan.Where(x => x.Id == ObjLoan.Id).FirstOrDefault();
                    var vLoanDetail = queryLoanDetail.Where(x => x.LoanId == ObjLoan.Id).ToList();

                    if (vLoan != null)
                    {
                        ObjList = vLoanDetail.ToList().Select(x => new T_LoanDetails()
                        {
                            OutStandingAmount = (vLoan.Amount - vLoanDetail.Sum(y => y.PaidAmount)),
                        }).FirstOrDefault();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ObjList);
        }
Exemple #3
0
        public ActionResult CreateLoanDetails(T_LoanDetails ObjModel)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(Convert.ToString(ObjModel.Id)))
                {
                    var vObjExists = _blLoan.GetByIdLoanDetail(ObjModel.Id);

                    if (vObjExists == null)
                    {
                        Guid guidId     = Guid.NewGuid();
                        Guid guidLoanId = Guid.Parse(Convert.ToString(ObjModel.LoanId));

                        T_LoanDetails _Obj_T_Loan = new T_LoanDetails()
                        {
                            Id                = guidId,
                            LoanId            = guidLoanId,
                            EventDate         = Convert.ToDateTime(ObjModel.EventDate),
                            SlNo              = ObjModel.SlNo,
                            OutStandingAmount = ObjModel.OutStandingAmount,
                            PaidAmount        = ObjModel.PaidAmount,
                            DueAmount         = ObjModel.DueAmount,
                            Remark            = ObjModel.Remark,
                            CreatedBy         = _objAuthentication.UserName,
                            CreatedDate       = DateTime.Now
                        };
                        _blLoan.CreateLoanDetail(_Obj_T_Loan);

                        return(Json(new { data = ObjModel, Success = true }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        vObjExists.OutStandingAmount = ObjModel.OutStandingAmount;
                        vObjExists.PaidAmount        = ObjModel.PaidAmount;
                        vObjExists.DueAmount         = ObjModel.DueAmount;
                        vObjExists.Remark            = ObjModel.Remark;

                        vObjExists.ModifyBy   = _objAuthentication.UserName;
                        vObjExists.ModifyDate = DateTime.Now;
                        _blLoan.UpdateLoanDetail(vObjExists);

                        return(Json(new { data = ObjModel, Success = true }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(new { data = ObjModel, Success = false }, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
 public T_LoanDetails DeleteLoanDetail(T_LoanDetails ObjModel)
 {
     try
     {
         using (_objUnitOfWork = new UnitOfWork())
         {
             _objUnitOfWork._T_LoanDetails_Repository.Delete(ObjModel.Id);
             _objUnitOfWork.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(ObjModel);
 }
Exemple #5
0
        public T_LoanDetails GetByIdLoanDetail(Guid UserId)
        {
            var ObjLoan = new T_LoanDetails();

            try
            {
                using (_objUnitOfWork = new UnitOfWork())
                {
                    ObjLoan = _objUnitOfWork._T_LoanDetails_Repository.GetById(UserId);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ObjLoan);
        }
Exemple #6
0
 public ActionResult DeleteLoanDetails(T_LoanDetails ObjModel)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(Convert.ToString(ObjModel.Id)))
         {
             var vObj = _blLoan.GetByIdLoanDetail(ObjModel.Id);
             if (vObj != null)
             {
                 _blLoan.DeleteLoanDetail(ObjModel);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(Json(ObjModel));
 }