public ActionResult Update(int page = 1, int pageSize = 10) { string LotID = Request.Form["slRange"]; string LoHID = Request.Form["txtLoHID"]; MultipleAdmin model = new MultipleAdmin(); LotHostDAO dao = new LotHostDAO(); try { int result = dao.UpdateRangeLoH(LotID, LoHID); if (result <= 0) { model.ErrorAcceptMessage = "Can't update parking lot " + LoHID; } else { model.ErrorAcceptMessage = ""; } } catch (Exception) { model.ErrorAcceptMessage = "New range of parking lot " + LoHID + " was not selected!"; } IPagedList <LotHostDTO> lists = (IPagedList <LotHostDTO>) new LotHostDAO().ListLotHost(Session["HostIDDetail"].ToString(), page, pageSize); model.ListLotHost = lists; model.CountHostRequest = new HostRequestDAO().CountHostRequest(); model.Lot = new LotHostDAO().ListLot(); return(View("Details", model)); }
public ActionResult Create(MultipleAdmin model) { try { if (!ModelState.IsValid) { string LotID = Request.Form["SLRange"]; LotHostDAO dao = new LotHostDAO(); int result = dao.Create(model.LotHostInsert.LoHID, model.LotHostInsert.HostID, LotID); if (result > 0) { Session["SUCCESS"] = "Create Parking Lot"; return(RedirectToAction("Create", "AdminCreateParkingLot", new { area = "Admin" })); } } Session["SUCCESS"] = null; model.ErrorAcceptMessage = "Can't create new parking lot!"; model.Lot = new LotHostDAO().ListLot(); return(View(model)); } catch { Session["SUCCESS"] = null; model.ErrorAcceptMessage = "Host ID is not existed or LoHID is existed!"; model.Lot = new LotHostDAO().ListLot(); return(View(model)); } }
public ActionResult Create() { MultipleAdmin model = new MultipleAdmin(); model.Lot = new LotHostDAO().ListLot(); return(View(model)); }
// GET: Admin/RegisterHost public ActionResult Index() { MultipleAdmin model = new MultipleAdmin(); model.cityId = model.SelectCity.ElementAt(0).Value; model.countyId = model.SelectCountyByCityId.ElementAt(0).Value; return(View(model)); }
public JsonResult ChooseCity(String cityId) { MultipleAdmin model = new MultipleAdmin(); //assign cityId to search counties model.cityId = cityId; return(this.Json(model.SelectCountyByCityId, JsonRequestBehavior.AllowGet)); }
// GET: Admin/HostRequest public ActionResult Index(int page = 1, int pageSize = 10) { MultipleAdmin model = new MultipleAdmin(); IPagedList <HostRequestDTO> lists = (IPagedList <HostRequestDTO>) new HostRequestDAO().ListHostRequest(page, pageSize); model.CountHostRequest = new HostRequestDAO().CountHostRequest(); model.ListHostRequest = lists; return(View(model)); }
public ActionResult FinanceDetail(int id) { Session["BillID"] = id; MultipleAdmin model = new MultipleAdmin(); AdminFinanceDAO dao = new AdminFinanceDAO(); model.SumPriceBill = String.Format("{0:n}", dao.TotalFinancial(Session["HostFinance"].ToString(), id, int.Parse(Session["SlMonth"].ToString()), int.Parse(Session["SlYear"].ToString()))); model.ListFinanceDetail = dao.ListInfoEachLot(Session["HostFinance"].ToString(), id, int.Parse(Session["SlMonth"].ToString()), int.Parse(Session["SlYear"].ToString())); return(View(model)); }
// GET: Admin/Admin public ActionResult Index(int page = 1, int pageSize = 10) { if (Session["adminID"] == null) { RedirectToAction("Login", "Index"); } MultipleAdmin model = new MultipleAdmin(); IPagedList <HostDTO> lists = (IPagedList <HostDTO>) new HostDAO().ListHost(page, pageSize); model.ListHost = lists; model.CountHostRequest = new HostRequestDAO().CountHostRequest(); return(View(model)); }
public ActionResult Search(int page = 1, int pageSize = 10) { int month = int.Parse(Request.Form["slMonth"]); int year = int.Parse(Request.Form["slYear"]); Session["SlMonth"] = month; Session["SlYear"] = year; MultipleAdmin model = new MultipleAdmin(); AdminFinanceDAO dao = new AdminFinanceDAO(); IPagedList <FinanceDTO> lists = (IPagedList <FinanceDTO>)dao.ListFinancialByMonthAndYear(Session["HostFinance"].ToString(), month, year, page, pageSize); model.ListFinance = lists; model.Income = String.Format("{0:n}", dao.TotalIncome(@Session["HostFinance"].ToString(), DateTime.Now.Month, DateTime.Now.Year)); return(View("AdminFinance", model)); }
public ActionResult Details(string id, int page = 1, int pageSize = 10) { if (Session["adminID"] == null) { RedirectToAction("Login", "Index"); } Session["HostIDDetail"] = id; MultipleAdmin model = new MultipleAdmin(); IPagedList <LotHostDTO> lists = (IPagedList <LotHostDTO>) new LotHostDAO().ListLotHost(Session["HostIDDetail"].ToString(), page, pageSize); model.ListLotHost = lists; model.CountHostRequest = new HostRequestDAO().CountHostRequest(); model.Lot = new LotHostDAO().ListLot(); return(View(model)); }
public ActionResult AdminFinance(string id, int page = 1, int pageSize = 10) { Session["HostFinance"] = id; AdminFinanceDAO dao = new AdminFinanceDAO(); Session["SlMonth"] = DateTime.Now.Month; Session["SlYear"] = DateTime.Now.Year; MultipleAdmin model = new MultipleAdmin(); model.CountHostRequest = new HostRequestDAO().CountHostRequest(); IPagedList <FinanceDTO> lists = (IPagedList <FinanceDTO>)dao.ListFinancialByMonthAndYear(Session["HostFinance"].ToString(), DateTime.Now.Month, DateTime.Now.Year, page, pageSize); model.ListFinance = lists; model.Income = String.Format("{0:n}", dao.TotalIncome(@Session["HostFinance"].ToString(), DateTime.Now.Month, DateTime.Now.Year)); return(View(model)); }
public ActionResult UpdateHost(MultipleAdmin model) { HostDAO dao = new HostDAO(); int result = dao.UpdateHost(model.HostDetail.Fullname, model.HostDetail.Address, model.HostDetail.Password, model.countyId, model.HostDetail.ID); if (result > 0) { ViewBag.Message = "Update Success!"; } else { model.ErrorAcceptMessage = "Can't Update!"; } model.cityId = model.SelectCity.ElementAt(0).Value; model.countyId = model.SelectCountyByCityId.ElementAt(0).Value; return(View("EditHost", model)); }
public ActionResult EditHost(string id) { if (Session["adminID"] == null) { RedirectToAction("Login", "Index"); } Session["DetailID"] = id; MultipleAdmin model = new MultipleAdmin(); model.HostDetail = new HostDAO().HostDetail(id); model.CountHostRequest = new HostRequestDAO().CountHostRequest(); model.cityId = model.SelectCity.ElementAt(0).Value; model.countyId = model.SelectCountyByCityId.ElementAt(0).Value; return(View(model)); }
public ActionResult Cancel(string id, int page = 1, int pageSize = 10) { MultipleAdmin model = new MultipleAdmin(); HostRequestDAO dao = new HostRequestDAO(); int cancel = dao.CancelRequest(id); if (cancel <= 0) { model.ErrorAcceptMessage = "Can't cancel parking lot " + id; } else { model.ErrorAcceptMessage = ""; } IPagedList <HostRequestDTO> lists = (IPagedList <HostRequestDTO>)dao.ListHostRequest(page, pageSize); model.CountHostRequest = dao.CountHostRequest(); model.ListHostRequest = lists; return(View("Index", model)); }
public ActionResult UnenableHost(string id) { HostDAO dao = new HostDAO(); int result = dao.HostUnenable(id); MultipleAdmin model = new MultipleAdmin(); if (result > 0) { ViewBag.Message = "Update Success!"; } else { model.ErrorAcceptMessage = "Can't Update!"; } model.HostDetail = new HostDAO().HostDetail(id); model.CountHostRequest = new HostRequestDAO().CountHostRequest(); model.cityId = model.SelectCity.ElementAt(0).Value; model.countyId = model.SelectCountyByCityId.ElementAt(0).Value; return(View("EditHost", model)); }
public ActionResult Register(MultipleAdmin model) { RegisterDAO dao = new RegisterDAO(); string Confirm = Request.Form["txtConfirm"]; if (model.host.Password == Confirm) { try { int result = dao.RegisterHost(model.host.ID, model.host.Fullname, model.host.Address, model.host.Password, model.countyId); if (result > 0) { ViewBag.Message = "Register successful!"; model.host.ID = ""; model.host.Fullname = ""; model.host.Address = ""; model.host.Password = ""; } else { model.host.Password = ""; model.ErrorAcceptMessage = "Can't not register!"; } } catch (Exception) { model.ErrorAcceptMessage = "Host ID has already existed!"; model.host.Password = ""; } } else { model.ErrorAcceptMessage = "Confirm not match password!"; model.host.Password = ""; } model.cityId = model.SelectCity.ElementAt(0).Value; model.countyId = model.SelectCountyByCityId.ElementAt(0).Value; return(View("Index", model)); }
public ActionResult SaveEdition() { DriverDAO dao = new DriverDAO(); String username = Request.Form["txtUsername"]; try { int phonenumber = int.Parse(Request.Form["txtPhonenumber"]); String fullname = Request.Form["txtFullname"]; if (fullname.Trim().Length != 0 && phonenumber > 0) { ParkinglotOnline.Models.Driver driver = new ParkinglotOnline.Models.Driver { Username = username, Fullname = fullname, PhoneNumber = phonenumber, }; dao.UpdateDriver(driver); ViewBag.Status = "Update \"" + username + "\" successfully !!!"; } else { ViewBag.Status = "Phone must be number and can't be blank any field"; } } catch (Exception) { ViewBag.Status = "Phone must be number and can't be blank any field"; } //search after edit DriverManageModel model = new DriverManageModel(); model.ListDriver = dao.SearchByNameOrId(username, 1, 4); ViewData["lastSearch"] = username; MultipleAdmin modelMulti = new MultipleAdmin(); modelMulti.Divermanager = model; return(View("Index", modelMulti)); }
public ActionResult ViewDetail(String username, int page = 1, int pageSize = 4) { // B/c pagelistPager can't pass parameters if (username != null) { Session["DriverViewing"] = username; } DriverHistoryDAO dao = new DriverHistoryDAO(); DriverManageModel model = new DriverManageModel(); DriverDAO driverDAO = new DriverDAO(); model.History = dao.loadHistory(Session["DriverViewing"].ToString(), page, pageSize); model.ListDriver = driverDAO.getListDriver(1, 4); model.DriverViewing = driverDAO.getDriverById(Session["DriverViewing"].ToString()); ViewBag.TotalPrice = dao.totalPrice; //after view detail Session["lastSearch"] = null; MultipleAdmin modelMulti = new MultipleAdmin(); modelMulti.Divermanager = model; return(View("Index", modelMulti)); }
// GET: Admin/DriverManage public ActionResult Index(int page = 1, int pageSize = 4) { MultipleAdmin modelMulti = new MultipleAdmin(); DriverManageModel model = new DriverManageModel(); DriverDAO dao = new DriverDAO(); if (Request.Form["txtSearch"] != null) { Session["lastSearch"] = Request.Form["txtSearch"]; ViewData["lastSearch"] = Session["lastSearch"]; if (Session["lastSearch"].ToString().Equals("")) { model.ListDriver = dao.getListDriver(page, pageSize); //after call another page Session["lastSearch"] = null; } else { model.ListDriver = dao.SearchByNameOrId(Session["lastSearch"].ToString(), page, pageSize); } } else if (Session["lastSearch"] != null) { ViewData["lastSearch"] = Session["lastSearch"]; model.ListDriver = dao.SearchByNameOrId(Session["lastSearch"].ToString(), page, pageSize); } else { model.ListDriver = dao.getListDriver(page, pageSize); } modelMulti.Divermanager = model; modelMulti.CountHostRequest = new HostRequestDAO().CountHostRequest(); return(View(modelMulti)); }