private void EditListings() { agentEmail = (this.Tag as AgentWindow).currentAgentName; Classes.ListingManager listManager = new Classes.ListingManager(); if (listManager.GetAddressID(currentAreaID, streetName, streetNo) == -1) { listManager.AddListingAddress(currentAreaID, streetName, streetNo); } else { listManager.EditListingAddress(listManager.GetAddressID(currentAreaID, streetName, streetNo), currentAreaID, streetName, streetNo); } addressID = listManager.GetAddressID(currentAreaID, streetName, streetNo); if (CB_Complex.IsChecked == true) { if (listManager.GetComplexID(complexName, addressID) == -1) { listManager.AddListingComplex(complexName, addressID); } else { listManager.EditListingComplex(listManager.GetComplexID(complexName, addressID), complexName, addressID); } complexID = listManager.GetComplexID(complexName, addressID); } else { complexID = -1; } agentID = listManager.GetAgentID(agentEmail); propertyID = listManager.GetPropertyID(agentID, currentListID); listManager.EditListingProperty(propertyID, currentClientID, addressID, complexID, complexNo, bedrooms, bathrooms, garages, hasPool, plotSize, houseSize, propertyValue, description); listManager.EditListing(currentListID, propertyID, agentID, propertyPrice, isNegotiable, isSold, description); }
private void RefreshOffers() { new System.Threading.Thread(() => { Classes.ListingManager listManager = new Classes.ListingManager(); currentAgentID = listManager.GetAgentID(GetCurrentAgent()); ClearOffersGrid(); DatabaseManager dbManager = new DatabaseManager(); var listings = dbManager.ReturnQuery("SELECT * FROM Listing WHERE Agent_ID = " + currentAgentID + " ORDER BY List_ID;"); foreach (var listing in listings) { DatabaseManager dbManager2 = new DatabaseManager(); var offers = dbManager2.ReturnQuery("SELECT * FROM Offer WHERE List_ID = " + listing[0] + " ORDER BY Offer_ID;"); foreach (var offer in offers) { DatabaseManager dbManager3 = new DatabaseManager(); var clients = dbManager3.ReturnQuery("SELECT Client_Email FROM Clients WHERE Client_ID = " + offer[2] + " ORDER BY Client_Email;"); foreach (var client in clients) { DatabaseManager dbManager4 = new DatabaseManager(); var properties = dbManager4.ReturnQuery("SELECT Property_Value, Client_ID FROM Property WHERE Property_ID = " + listing[1] + " ORDER BY Client_ID;"); foreach (var property in properties) { DatabaseManager dbManager5 = new DatabaseManager(); var owners = dbManager5.ReturnQuery("SELECT Client_Email FROM Clients WHERE Client_ID = " + property[1] + " ORDER BY Client_Email;"); foreach (var owner in owners) { InsertIntoOffersGrid(client[0], Convert.ToInt32(listing[0]), Convert.ToInt32(offer[3]), Convert.ToInt32(listing[2]), Convert.ToInt32(property[0]), Convert.ToInt32(offer[4]), offer[5], owner[0], Convert.ToInt32(offer[0])); } } } } } }).Start(); }
private void LoadProvinces() { Classes.ListingManager listManager = new Classes.ListingManager(); foreach (string provinces in listManager.GetProvinces()) { CB_Province.Items.Add(provinces); } provinceID = listManager.GetProvincesID(); }
private void LoadClients() { Classes.ListingManager listManager = new Classes.ListingManager(); foreach (string clients in listManager.GetClients()) { CB_Client.Items.Add(clients); } clientsID = listManager.GetClientsID(); }
private void LoadArea() { this.Dispatcher.Invoke(() => { Classes.ListingManager listManager = new Classes.ListingManager(); foreach (string areas in listManager.GetAreas(currentCityID)) { CB_Area.Items.Add(areas); } areaID = listManager.GetAreasID(currentCityID); }); }
private void LoadCities() { this.Dispatcher.Invoke(() => { Classes.ListingManager listManager = new Classes.ListingManager(); foreach (string cities in listManager.GetCities(currentProvinceID)) { CB_City.Items.Add(cities); } cityID = listManager.GetCitiesID(currentProvinceID); }); }
public AgentWindow(string agent) { InitializeComponent(); currentAgentName = agent; this.Title = this.Title + agent; AV_Listings.Tag = this; AV_Offers.Tag = this; AV_MangeClients.Tag = this; AV_AddListing.Tag = this; AV_EditListing.Tag = this; AV_ViewProperties.Tag = this; Classes.ListingManager listManager = new Classes.ListingManager(); currentAgentID = listManager.GetAgentID(currentAgentName); }
private void EditListings() { agentEmail = (this.Tag as AgentWindow).currentAgentName; Classes.ListingManager listManager = new Classes.ListingManager(); if (listManager.GetAddressID(currentAreaID, streetName, streetNo) == -1) listManager.AddListingAddress(currentAreaID, streetName, streetNo); else listManager.EditListingAddress(listManager.GetAddressID(currentAreaID, streetName, streetNo), currentAreaID, streetName, streetNo); addressID = listManager.GetAddressID(currentAreaID, streetName, streetNo); if (CB_Complex.IsChecked == true) { if (listManager.GetComplexID(complexName, addressID) == -1) listManager.AddListingComplex(complexName, addressID); else listManager.EditListingComplex(listManager.GetComplexID(complexName, addressID), complexName, addressID); complexID = listManager.GetComplexID(complexName, addressID); } else complexID = -1; agentID = listManager.GetAgentID(agentEmail); propertyID = listManager.GetPropertyID(agentID, currentListID); listManager.EditListingProperty(propertyID, currentClientID, addressID, complexID, complexNo, bedrooms, bathrooms, garages, hasPool, plotSize, houseSize, propertyValue, description); listManager.EditListing(currentListID, propertyID, agentID, propertyPrice, isNegotiable, isSold, description); }
private void CreateListings() { Classes.ListingManager listManager = new Classes.ListingManager(); listManager.AddListingAddress(currentAreaID,streetName,streetNo); addressID = listManager.GetAddressID(currentAreaID, streetName, streetNo); if(CB_Complex.IsChecked == true) { listManager.AddListingComplex(complexName, addressID); complexID = listManager.GetComplexID(complexName,addressID); } else complexID = -1; listManager.AddListingProperty(currentClientID, addressID, complexID, complexNo, bedrooms, bathrooms, garages, hasPool, plotSize, houseSize, propertyValue); propertyID = listManager.GetPropertyID(currentClientID); agentID = listManager.GetAgentID(agentEmail); listManager.AddListing(propertyID,agentID,propertyPrice,isNegotiable,isSold); }