private void cmdOk_Click(object sender, RoutedEventArgs e) { try { Loan objLoan = LoanServices.Get(_strId); if (objLoan == null) { objLoan = new Loan(); } DateTime objDate; if (DateTime.TryParse(txtEndDate.Text, out objDate) == true) { objLoan.EndDate = objDate; } else { new MessageBoxYesNo("End Date is not valide", false, true).ShowDialog(); txtEndDate.Focus(); return; } if (DateTime.TryParse(txtStartDate.Text, out objDate) == true) { objLoan.StartDate = objDate; } else { new MessageBoxYesNo("Start Date is not valide", false, true).ShowDialog(); txtStartDate.Focus(); return; } string strFriends; if (string.IsNullOrEmpty(cboAlias.Text) == false) { strFriends = cboAlias.Text; } else { new MessageBoxYesNo("Please Choose a friend", false, true).ShowDialog(); cboAlias.Focus(); return; } objLoan.ItemId = _strId; LoanServices.Update(objLoan, strFriends, _selectedItems); Close(); } catch (Exception ex) { CatchException(ex); } }
///<summary> /// Move Loan To Employee Method ///</summary> public void MoveLoanToEmployee(int userId, int LoanId, int EmployeeId, LoanDecision loanDecision) { try { Db db = new Db(DbServices.ConnectionString); // 0- Create Loan Decision LoanDecision decision = LoanDecisionServices.Insert(userId, loanDecision, db); // 1- Change the Status Of Old Loan to be Move To Employee Loan loan = LoanServices.Get(LoanId, db); loan.LoanStatus = (int)LoanStatusEnum.MoveToEmployee; LoanServices.Update(userId, loan, db); // 2- Process the Installments // 3- Create New Product + Refundable Product LoanRequest req = new LoanRequest() { //Request= }; Loan NewLoan = new Loan() { LoanDecision = decision.Id, Product = loan.Product, LoanGenerationStatus = (int)LoanGenerationStatusEnum.IncommingFromOtherSubscriber, LoanStatus = (int)LoanStatusEnum.Unfinished, LoanType = loan.LoanType }; LoanServices.Insert(userId, NewLoan); // 2- Add Loan and Generate Installment //db.LoanGenerate(model.Requests[i].RequestId, decision.Id, (int)LoanGenerationStatusEnum.LoanRequest); // 4- Generate Installment for the new Loan // } catch (Exception ex) { } }
// GET: Loan/Delete/5 public ActionResult Delete(Nullable <int> id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Db db = new Db(DbServices.ConnectionString); Loan loan = LoanServices.Get(id.Value, db); if (loan == null) { return(HttpNotFound()); } return(View(loan)); }
// GET: Loan/Edit/5 public ActionResult Edit(Nullable <int> product) { Db db = new Db(DbServices.ConnectionString); if (product == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Loan loan = LoanServices.Get(product.Value, db); if (loan == null) { return(HttpNotFound()); } ViewBag.LoanDecisionList = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", loan.LoanDecision); ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name", loan.LoanGenerationStatus); ViewBag.LoanStatusList = new SelectList(LoanStatusServices.List(db), "Id", "Name", loan.LoanStatus); ViewBag.LoanTypeList = new SelectList(LoanTypeServices.List(db), "ProductType", "Name", loan.LoanType); ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes", loan.Product); return(View(loan)); }
public LoanTo(ThumbItem thumbitem) { InitializeComponent(); if (thumbitem == null) { return; } _strId = thumbitem.Id; _selectedItems = thumbitem.EType; cboAlias.ItemsSource = FriendServices.Gets(); cboAlias.DisplayMemberPath = "Alias"; imgTitle.Source = Util.CreateSmallImage(thumbitem.Cover); lblTitle.Text = thumbitem.Name; Loan objLoan = LoanServices.Get(_strId); if (objLoan != null) { txtEndDate.Text = objLoan.EndDate.ToShortDateString(); //Fix since 2.7.12.0 if (objLoan.Friend != null) { cboAlias.Text = objLoan.Friend.Alias; } txtStartDate.Text = objLoan.StartDate.ToShortDateString(); } else { txtStartDate.Text = DateTime.Now.ToShortDateString(); txtEndDate.Text = DateTime.Now.AddDays(10).ToShortDateString(); } }