Exemple #1
0
        public string SendOtp(int installmentID)
        {
            var        uvm        = Session["UserDetails"] as UserViewModel;
            VerifyUser verifyUser = new VerifyUser();

            verifyUser.msisdn = uvm.MobileNo;
            verifyUser.OTP    = verifyUser.GenerateRandomOTP(4);

            string res = verifyUser.SendOtp();

            //save otp to DB;
            InstallmentDetail installmentDetail = new InstallmentDetail();

            installmentDetail     = _installmentDetailService.Get().Where(i => i.InstallmentId == installmentID).FirstOrDefault();
            installmentDetail.OTP = verifyUser.OTP;
            _installmentDetailService.Update(installmentDetail);
            _installmentDetailService.SaveChanges();

            return(res);
        }
Exemple #2
0
        public ActionResult ChiefOfficer(InstallmentDetailsViewModel installmentDetailViewModel)
        {
            var installment = _installmentDetailService.GetInstallmentDetailById(installmentDetailViewModel.InstallmentId);

            if (installment != null)
            {
                if (Session["UserDetails"] != null)
                {
                    var user = Session["UserDetails"] as UserViewModel;

                    if (installment.StageID == (int)Common.WorkFlowStages.Accountant)
                    {
                        installment.IsCompleted = true;
                        installment.StageID     = (int)Common.WorkFlowStages.LastChiefOfficer;

                        InstallmentDetail installmentDetail = new InstallmentDetail();
                        //Insert new rocrd with new installment in installment details
                        var newInstallmentNo = installment.InstallmentNo;
                        if (newInstallmentNo <= 6)
                        {
                            newInstallmentNo = newInstallmentNo + 1;
                            installmentDetail.InstallmentNo   = newInstallmentNo;
                            installmentDetail.BeneficiaryId   = installment.BeneficiaryId;
                            installmentDetail.BeneficiaryAmnt = 0;
                            installmentDetail.LoanAmnt        = 0;
                            installmentDetail.IsCentreAmnt    = null;
                            installmentDetail.StageID         = 1;
                            installmentDetail.IsCompleted     = false;
                            installmentDetail.CreatedDate     = DateTime.Now;
                            installmentDetail.CreatedBy       = "System";
                            installmentDetail.CompanyID       = installment.CompanyID;
                            installmentDetail.IsRecommended   = false;

                            _installmentDetailService.Add(installmentDetail);
                            _installmentDetailService.SaveChanges();
                        }
                    }
                    else
                    {
                        installment.StageID = (int)Common.WorkFlowStages.ChiefOfficer;
                    }
                    installment.ModifiedBy   = user.UserName;
                    installment.ModifiedDate = DateTime.Now;

                    // Insert reocrd in comment table
                    var comments = new Comment();
                    comments.Comments      = installmentDetailViewModel._Comments;
                    comments.CreatedBy     = user.UserName;
                    comments.BeneficiaryId = installment.BeneficiaryId;
                    comments.RoleId        = (int)Common.Roles.ChiefOfficer;
                    comments.CreatedDate   = DateTime.Now;
                    comments.CompanyID     = user.CompanyID;

                    // Insert reocrd in GeoTaggingDetail table
                    var signing = new InstallmentSigning();
                    signing.InstallmentId = installment.InstallmentId;
                    signing.UserId        = user.UserId;
                    signing.RoleId        = (int)Common.Roles.ChiefOfficer;
                    signing.Sign          = true;
                    signing.CreatedDate   = DateTime.Now;
                    signing.CreatedBy     = user.UserName;
                    signing.CompanyID     = user.CompanyID;

                    // Applying changes to database tables
                    installment.Comments.Add(comments);

                    installment.InstallmentSignings.Add(signing);
                    _installmentDetailService.Update(installment);


                    _installmentDetailService.SaveChanges();

                    ViewBag.Message = "sussess message";

                    installmentDetailViewModel.BeneficiaryAmnt   = installment.BeneficiaryAmnt;
                    installmentDetailViewModel.LoanAmnt          = installment.LoanAmnt;
                    installmentDetailViewModel.ConstructionLevel = installment.ConstructionLevel;
                }
            }

            return(PartialView("_ChiefOfficer", installmentDetailViewModel));
        }
Exemple #3
0
        public static InstallmentDetailsViewModel Detach(InstallmentDetail installmentDetail)
        {
            InstallmentDetailsViewModel installmentDetailsViewModel = new InstallmentDetailsViewModel();

            installmentDetailsViewModel.InstallmentId     = installmentDetail.InstallmentId;
            installmentDetailsViewModel.BeneficiaryId     = installmentDetail.BeneficiaryId;
            installmentDetailsViewModel.BeneficiaryAmnt   = installmentDetail.BeneficiaryAmnt;
            installmentDetailsViewModel.LoanAmnt          = installmentDetail.LoanAmnt;
            installmentDetailsViewModel.IsCentreAmnt      = installmentDetail.IsCentreAmnt;
            installmentDetailsViewModel.ConstructionLevel = installmentDetail.ConstructionLevel;
            installmentDetailsViewModel.StageID           = installmentDetail.StageID;
            installmentDetailsViewModel.IsCompleted       = installmentDetail.IsCompleted;
            installmentDetailsViewModel.InstallmentNo     = installmentDetail.InstallmentNo;
            installmentDetailsViewModel.CreatedDate       = installmentDetail.CreatedDate;
            installmentDetailsViewModel.CreatedBy         = installmentDetail.CreatedBy;
            installmentDetailsViewModel.ModifiedDate      = installmentDetail.ModifiedDate;
            installmentDetailsViewModel.ModifiedBy        = installmentDetail.ModifiedBy;
            installmentDetailsViewModel.CompanyID         = installmentDetail.CompanyID;
            installmentDetailsViewModel.TransactionID     = installmentDetail.TransactionID;
            installmentDetailsViewModel.IsRecommended     = installmentDetail.IsRecommended.Value;

            installmentDetailsViewModel.BenificiaryMaster = BeneficiaryMapper.Detach(installmentDetail.BenificiaryMaster);

            installmentDetailsViewModel.Comments = installmentDetail.Comments.Select(s => new CommentsViewModel()
            {
                Id             = s.Id,
                BeneficiaryId  = s.BeneficiaryId,
                InstallementId = s.InstallementId,
                Reason         = s.Reason,
                Comments       = s.Comments,
                RoleId         = s.RoleId,
                CreatedDate    = s.CreatedDate,
                CreatedBy      = s.CreatedBy,
                CompanyID      = s.CompanyID,
            }).ToList();

            installmentDetailsViewModel.GeoTaggingDetails = installmentDetail.GeoTaggingDetails.Select(g => new GeoTaggingViewModel()
            {
                Id                = g.Id,
                Photo             = g.Photo,
                ConstructionLevel = g.ConstructionLevel,
                BeneficiaryId     = g.BeneficiaryId,
                UserId            = g.UserId,
                InstallmentId     = g.InstallmentId,
                Date              = g.Date,
                CreatedDate       = g.CreatedDate,
                CreatedBy         = g.CreatedBy,
                ModifiedDate      = g.ModifiedDate,
                ModifiedBy        = g.ModifiedBy,
                CompanyID         = g.CompanyID,
            }).ToList();

            installmentDetailsViewModel.InstallmentSignings = installmentDetail.InstallmentSignings.Select(d => new InstallmentSigningViewModel()
            {
                Id            = d.Id,
                InstallmentId = d.InstallmentId,
                Sign          = d.Sign,
                SignData      = d.SignData,
                UserId        = d.UserId,
                RoleId        = d.RoleId,
                CreatedDate   = d.CreatedDate,
                CreatedBy     = d.CreatedBy,
                ModifiedDate  = d.ModifiedDate,
                ModifiedBy    = d.ModifiedBy,
                CompanyID     = d.CompanyID
            }).ToList();

            installmentDetailsViewModel._Comments = installmentDetailsViewModel.Comments.Select(d => d.Comments).FirstOrDefault();
            installmentDetailsViewModel.Photo     = installmentDetailsViewModel.GeoTaggingDetails.Select(p => p.Photo).FirstOrDefault();

            return(installmentDetailsViewModel);
        }
Exemple #4
0
 public void Update(InstallmentDetail installmentDetail)
 {
     installmentDetailRepository.Update(installmentDetail);
 }
Exemple #5
0
 public void Add(InstallmentDetail installmentDetail)
 {
     installmentDetailRepository.Add(installmentDetail);
 }
Exemple #6
0
        public InstallmentDetail GetInstallmentDetailById(int id)
        {
            InstallmentDetail benficiaries = installmentDetailRepository.GetById(id);

            return(benficiaries);
        }