public ActionResult Create(ParticularModel model) { //try //{ // TODO: Add insert logic here objContext.CONTRACTS_CONDITIONS_PARTICULAR.Add(model); objContext.SaveChanges(); return(RedirectToAction("Index")); //} //catch //{ // return View(); //} }
public ActionResult Edit(int id, ParticularModel model) { //try //{ ParticularModel tbParticular = objContext.CONTRACTS_CONDITIONS_PARTICULAR.Where(x => x.ParticularId == model.ParticularId).SingleOrDefault(); if (tbParticular != null) { objContext.Entry(tbParticular).CurrentValues.SetValues(model); objContext.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbParticular)); //} //catch //{ // return View(); //} }
/// <summary> /// Creates Receipt Voucher with Particular data, Updates Balance of both ledgers /// Add transaction bills and remove done bills from bills. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateButton_Click(object sender, RoutedEventArgs e) { VoucherModel voucherModel = new VoucherModel(); ParticularModel particularModel = new ParticularModel(); //Save Receipt Voucher //Balance Logic string balType = (string)balanceComboBox.SelectedItem; if (balType == credDeb[0]) { double amnt = amount; LedgerModel accountModel = (LedgerModel)AccountLedgerCombobox.SelectedItem; LedgerModel particular = (LedgerModel)ParticularLedgerCombobox.SelectedItem; //TODO Ledger Balance //update Particular Ledger particular.credit_bal = particular.credit_bal + amnt; particular.current_bal = GetBalance(particular); GlobalConfig.Connection.UpdateLedger(particular); //update Account Ledger accountModel.debit_bal = accountModel.debit_bal + amnt; accountModel.current_bal = GetBalance(accountModel); GlobalConfig.Connection.UpdateLedger(accountModel); } else if (balType == credDeb[1]) { double amnt = amount; LedgerModel accountModel = (LedgerModel)AccountLedgerCombobox.SelectedItem; LedgerModel particular = (LedgerModel)ParticularLedgerCombobox.SelectedItem; //TODO Ledger Balance //update Particular Ledger particular.debit_bal = particular.debit_bal + amnt; particular.current_bal = GetBalance(particular); GlobalConfig.Connection.UpdateLedger(particular); //update Account Ledger accountModel.credit_bal = accountModel.credit_bal + amnt; accountModel.current_bal = GetBalance(accountModel); GlobalConfig.Connection.UpdateLedger(accountModel); } //VoucherModel string d = DatePicker.SelectedDate.ToString().Split(' ').First(); string[] dateList = d.Split('-'); voucherModel.v_date = $"{dateList[2]}-{dateList[1]}-{dateList[0]}"; if (vouchers.Count != 0) { voucherModel.v_number = vouchers[vouchers.Count - 1].vid + 1; } else { voucherModel.v_number = 1; } voucherModel.vtype = "Receipt"; voucherModel.account = AccountId; //Particular Model particularModel.particular_amount = double.Parse(AmountTextbox.Text); particularModel.particular_name = ParticularId; voucherModel.Particular = particularModel; //Create Voucher And Particular Model. voucherModel = GlobalConfig.Connection.CreateVoucher(voucherModel); //Save Transactions SaveTransactions(); }
// // GET: /PMSContracts/Particular/Delete/5 public ActionResult Delete(int id) { ParticularModel tbParticular = objContext.CONTRACTS_CONDITIONS_PARTICULAR.Find(id); return(View(tbParticular)); }
private void WireUpDatabase() { VoucherModel voucherModel = new VoucherModel(); ParticularModel particularModel = new ParticularModel(); //Balance Logic string balType = (string)balanceComboBox.SelectedItem; if (balType == credDeb[0]) { double amnt = double.Parse(AmountTextbox.Text); LedgerModel accountModel = (LedgerModel)AccountLedgerCombobox.SelectedItem; LedgerModel particular = (LedgerModel)ParticularLedgerCombobox.SelectedItem; //TODO Ledger Balance //update Particular Ledger particular.credit_bal = particular.credit_bal + amnt; particular.current_bal = GetBalance(particular); GlobalConfig.Connection.UpdateLedger(particular); //update Account Ledger accountModel.debit_bal = accountModel.debit_bal + amnt; accountModel.current_bal = GetBalance(accountModel); GlobalConfig.Connection.UpdateLedger(accountModel); } else if (balType == credDeb[1]) { double amnt = double.Parse(AmountTextbox.Text); LedgerModel accountModel = (LedgerModel)AccountLedgerCombobox.SelectedItem; LedgerModel particular = (LedgerModel)ParticularLedgerCombobox.SelectedItem; //TODO Ledger Balance //update Particular Ledger particular.debit_bal = particular.debit_bal + amnt; particular.current_bal = GetBalance(particular); GlobalConfig.Connection.UpdateLedger(particular); //update Account Ledger accountModel.credit_bal = accountModel.credit_bal + amnt; accountModel.current_bal = GetBalance(accountModel); GlobalConfig.Connection.UpdateLedger(accountModel); } //Voucher Model string d = DatePicker.SelectedDate.ToString().Split(' ').First(); string[] dateList = d.Split('-'); voucherModel.v_date = $"{dateList[2]}-{dateList[1]}-{dateList[0]}"; if (vouchers.Count != 0) { voucherModel.v_number = vouchers[vouchers.Count - 1].vid + 1; } else { voucherModel.v_number = 1; } voucherModel.vtype = "Payment"; voucherModel.account = AccountId; //Particular Model particularModel.particular_amount = double.Parse(AmountTextbox.Text); particularModel.particular_name = ParticularId; voucherModel.Particular = particularModel; //Create Voucher And Particular Model. voucherModel = GlobalConfig.Connection.CreateVoucher(voucherModel); //Bills foreach (PaymentBill bill in paymentBills) { BillModel billModel = new BillModel(); billModel.bill_name = bill.emi; string[] list = bill.due_date.Split('-'); billModel.bill_due_date = $"{list[2]}-{list[1]}-{list[0]}"; billModel.bill_amount = double.Parse(bill.amount); billModel.lid = ParticularId; billModel.pid = voucherModel.Particular.pid; billModel.bill_done = false; billModel.vid = voucherModel.vid; availableBills.Add(billModel); } foreach (BillModel bill in availableBills) { GlobalConfig.Connection.CreateBill(bill); } }