// // GET: /Billing/ public ActionResult Index() { if (Request.Cookies["user"] != null) { double totalPay = 0.00; string transactions = ""; LogModel lgm = new LogModel(); lgm.user_id = Request.Cookies["user"].Value; foreach (LogModel log in lgm.getAllLogsbyUserOutTime()) { transactions = transactions + "<tr>"; ParkinglotModel plm = new ParkinglotModel(); plm.lot_id = log.lot_id; plm = plm.getLot(); transactions = transactions + "<td>" + plm.lot_name + "</td>" + "<td>" + log.day + " " + log.out_time + "</td><td>18 Tk</td>"; string duration = getDuration(log.in_time, log.out_time); transactions = transactions + "<td>" + duration + "</td>"; double charge = getPrice(log.day, log.in_time, log.out_time, 18.00); transactions = transactions + "<td>" + String.Format("{0: 0.00}", charge) + " Tk</td>"; if (log.pay_status.Trim() == "0") { transactions = transactions + "<td>Pending</td></tr>"; totalPay = totalPay + charge; } else { transactions = transactions + "<td>Paid</td></tr>"; } } ViewBag.Transactions = transactions; ViewBag.TotalPayable = String.Format("{0: 0.00}", totalPay); if (totalPay < 1.00) { ViewBag.DueDate = "N/A"; } else { ViewBag.DueDate = DateTime.Now.ToString("MMM") + " " + DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month).ToString() + ", " + DateTime.Now.ToString("yyyy"); } return(View()); } else { return(RedirectToAction("Login", "Home")); } }
public ActionResult getLot(string lot_id) { pLotModel plot = new pLotModel(); ParkinglotModel plm = new ParkinglotModel(); plm.lot_id = lot_id; plm = plm.getLot(); plot.lot_id = lot_id; plot.lot_name = plm.lot_name; plot.lat = double.Parse(plm.latitude); plot.lon = double.Parse(plm.longitude); plot.desc = getFreeSpaces(lot_id, plm.max_vehicle) + "/" + plm.max_vehicle; return(Json(plot, JsonRequestBehavior.AllowGet)); }