public static LotViewModel getLot(int idLot) { LotDAO pDAO = LotDAO.getLot(idLot); LotViewModel p = new LotViewModel(pDAO.id_lot, pDAO.id_vente_enchere, pDAO.description); return(p); }
//show host info private void setViewBagHostInfo() { if (Session["HostId"] != null) { HostDAO dao = new HostDAO(); Host host = dao.getHostById(Session["HostId"].ToString()); if (host != null) { ViewBag.Address = host.Address; ViewBag.FullName = host.Fullname; } } if (Session["LotId"] != null) { Lot lot = new LotDAO().getLotById(Session["LotId"].ToString()); if (lot != null) { ViewBag.LotName = lot.Name; } else { ViewBag.LotName = "All"; } } }
public static LotViewModel getLot(int idLot) { LotDAO pDAO = LotDAO.getLot(idLot); LotViewModel p = new LotViewModel(pDAO.idLotDAO, pDAO.nomLotDAO, pDAO.descriptionLotDAO, pDAO.idEnchereLotDAO); return(p); }
public static ObservableCollection <LotDAO> selectLot() { ObservableCollection <LotDAO> l = new ObservableCollection <LotDAO>(); string query = "SELECT * FROM lot;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataReader reader = null; try { cmd.ExecuteNonQuery(); reader = cmd.ExecuteReader(); while (reader.Read()) { LotDAO p = new LotDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3)); l.Add(p); } } catch (Exception e) { MessageBox.Show("Il y a un problème dans la table Categorie : {0}", e.StackTrace); } reader.Close(); return(l); }
public static void updateLot(LotDAO p) { string query = "UPDATE lot set nom=\"" + p.nomLotDAO + "\", description=\"" + p.descriptionLotDAO + "\", idEnchere=\"" + p.idEnchereLotDAO + "\" where id=" + p.idLotDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void updateLot(LotDAO p) { string query = "UPDATE Lot set id_vente_enchere=\"" + p.id_vente_enchere + "\", description=\"" + p.description + "\" where id_lot=" + p.id_lot + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertLot(LotDAO p) { int id = getMaxIdLot() + 1; string query = "INSERT INTO lot VALUES (\"" + id + "\",\"" + p.nomLotDAO + "\",\"" + p.descriptionLotDAO + "\",\"" + p.idEnchereLotDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static ObservableCollection <LotViewModel> listeLot() { ObservableCollection <LotDAO> lDAO = LotDAO.listeLot(); ObservableCollection <LotViewModel> l = new ObservableCollection <LotViewModel>(); foreach (LotDAO element in lDAO) { LotViewModel p = new LotViewModel(element.idLotDAO, element.nomLotDAO, element.descriptionLotDAO, element.idEnchereLotDAO); l.Add(p); } return(l); }
public ActionResult Create() { if (Session["hostID"] == null) { RedirectToAction("Login", "Index"); } MultipleCreatePage model = new MultipleCreatePage(); List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; return(View(model)); }
public static ObservableCollection <LotViewModel> listeLots() { ObservableCollection <LotDAO> lDAO = LotDAO.listeLots(); ObservableCollection <LotViewModel> l = new ObservableCollection <LotViewModel>(); foreach (LotDAO element in lDAO) { LotViewModel p = new LotViewModel(element.id_lot, element.id_vente_enchere, element.description); l.Add(p); } return(l); }
public static LotDAO getLot(int id) { string query = "SELECT * FROM lot WHERE id=" + id + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); LotDAO cat = new LotDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3)); reader.Close(); return(cat); }
// INSERT & Update public static void InsertOrAddNewLot(LotDAO lot) { // Inserer lot dans la bdd var query = @"INSERT INTO public.lot (""idLot"",""nomLot"",""description"") values (:idLot,:nomLot,:description) ON CONFLICT ON CONSTRAINT pk_lot DO UPDATE SET ""idLot""=:idLot, ""nomLot""=:nomLot, ""description""=:description, where lot.""idLot""=:idLot"; var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection()); cmd.Parameters.AddWithValue("idLot", lot.IdLot); cmd.Parameters.AddWithValue("nomLot", lot.NomLot); cmd.Parameters.AddWithValue("description", lot.Description); cmd.ExecuteNonQuery(); }
public ActionResult Checkout(int bldId, String loHID, int blId, int page = 1, int pageSize = 4) { BookingLotDetailDAO bldDao = new BookingLotDetailDAO(); bldDao.updateStatus(bldId, 3); //3 is paid Areas.Host.Dao.LotHostDAO lhDao = new Areas.Host.Dao.LotHostDAO(); // update available lot lhDao.updateAvailableLot(loHID, true); BookinglotDAO blDao = new BookinglotDAO();// update exitTime blDao.UpdateExitTime(blId); //Update totalPrice after calculate hours String lotId = lhDao.getLotHostById(loHID).LotID; double unitPrice = new LotDAO().getLotById(lotId).UnitPrice; BookingLot dto = blDao.GetBookingLotById(blId); bldDao.updateTotalPrice(bldId, dto.EntryDateTime, unitPrice); return(View("Index", InitialPage(page, pageSize))); }
// SELECT public static LotDAO SelectLotById(string id) { var lotDao = new LotDAO(); // Selectionne la lot a partir de l'id var query = "SELECT * FROM public.lot a where a.\"idLot\"=:idLotParam"; var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection()); cmd.Parameters.AddWithValue("idLotParam", id); var reader = cmd.ExecuteReader(); while (reader.Read()) { // récup les paramètres principaux var idLot = (string)reader["idLot"]; var nomLot = (string)reader["nomLot"]; var description = Convert.IsDBNull(reader["description"]) ? null : (string)reader["description"]; lotDao = new LotDAO(idLot, nomLot, description); } reader.Close(); return(lotDao); }
public ActionResult Create(MultipleCreatePage model) { try { // TODO: Add insert logic here if (ModelState.IsValid) { LotHostDAO dao = new LotHostDAO(); int count = dao.CountLotHot(Session["hostID"].ToString()); string LoHID = Session["hostID"].ToString().ToUpper() + "-" + count; int result = dao.Create(LoHID, Session["hostID"].ToString(), model.LotHostInsert.LotID); if (result > 0) { Session["SUCCESS"] = "Create Parking Lot " + LoHID + " Success!\n Waiting For Administration Accept!"; return(RedirectToAction("Create", "CreateParkingLot", new { area = "Host" })); } else { ModelState.AddModelError("", "Create new parking lot is false!"); } } Session["SUCCESS"] = null; List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; return(View(model)); } catch { Session["SUCCESS"] = null; List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; model.CreateErrorMessage = "You must select range of parking lot!"; return(View(model)); } }
public static void insertLot(LotViewModel p) { LotDAO.insertLot(new LotDAO(p.idLotProperty, p.nomLotProperty, p.descriptionLotProperty, p.idEnchereLotProperty)); }
public static void supprimerLot(int id) { LotDAO.supprimerLot(id); }
public static void insertLot(LotViewModel p) { LotDAO.insertLot(new LotDAO(p.id, p.id_vente_enchere, p.description)); }