public ActionResult DeleteDiscount(int sr_num, int acc_id, string session, FormCollection collection) { std_discountMain stdMain = new std_discountMain(); stdMain.DeleteDiscount(sr_num, acc_id, session); return(RedirectToAction("AllStdDiscountList")); }
public ActionResult EditDiscount(std_discount mst) { std_discountMain stdMain = new std_discountMain(); stdMain.EditDiscount(mst); return(RedirectToAction("AllStdDiscountList")); }
public ActionResult AddDiscount(std_discount std) { try { std_discountMain main = new std_discountMain(); main.AddFees(std); return(RedirectToAction("AllStdDiscountList")); } catch { mst_feesMain mstfess = new mst_feesMain(); var acc_head = mstfess.account_head(); IEnumerable <SelectListItem> list1 = new SelectList(acc_head, "acc_id", "acc_name"); ViewData["acc_id"] = list1; ModelState.AddModelError(String.Empty, "Discount on Admission number already applied for the particular account head or Admission number not exist"); return(View(std)); } }
private IEnumerable <fees_payment> GetFeesPayment(int sr_num, string session) { using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { List <fees_payment> payment = new List <fees_payment>(); out_standingMain outstd = new out_standingMain(); std_discount discount = new std_discount(); std_discountMain discountMain = new std_discountMain(); IEnumerable <out_standing> std = new List <out_standing>(); std = outstd.AllOutStanding(sr_num, session); string query = @"SELECT fine, start_date, upper_limit FROM mst_fine_rule WHERE session = @session AND acc_id = @acc_id and enable = 1"; string start_yr = @"SELECT YEAR(session_start_date) FROM mst_session WHERE session = @session"; string end_yr = @"SELECT YEAR(session_end_date) FROM mst_session WHERE session = @session"; foreach (out_standing val in std) { decimal amt_fine = 0; int year = 0; mst_fine_rule result = con.Query <mst_fine_rule>(query, new { acc_id = val.acc_id, session = val.session }).FirstOrDefault(); if (val.month_no >= 4 && val.month_no <= 12) { year = con.Query <int>(start_yr, new { session = val.session }).FirstOrDefault(); } else { year = con.Query <int>(end_yr, new { session = val.session }).FirstOrDefault(); } if (result != null) { DateTime dt = new DateTime(year, val.month_no, result.start_date); if (dt < System.DateTime.Now.AddMinutes(dateTimeOffSet)) { amt_fine = (decimal)((System.DateTime.Now.Date - dt).TotalDays) * result.fine; if (amt_fine >= result.upper_limit) { amt_fine = result.upper_limit; } } } payment.Add(new fees_payment { fine = amt_fine, acc_id = val.acc_id, Fees_type = val.acc_name, amount_to_be_paid = val.outstd_amount, due_amount = val.outstd_amount, serial = val.serial, sr_num = val.sr_number, session = val.session }); } return(payment); } }
public ActionResult DeleteDiscount(int sr_num, int acc_id, string session) { std_discountMain stdMain = new std_discountMain(); return(View(stdMain.FindDiscount(sr_num, acc_id))); }
public ActionResult AllStdDiscountList() { std_discountMain stdMain = new std_discountMain(); return(View(stdMain.AllStdDiscountList())); }