Collaboration diagram for HouseOver.THARM.RealtyManager:
Public Member Functions | |
RealtyManager (CatalogueData data) | |
Constructor. | |
void | Run () |
Starts displaying the userinterface. Blocks. | |
IList< Customer > | GetAllCustomersByEarliestSale () |
Gets all Customers selling items, sorted by the earliest date the items were put for sale. | |
IList< Customer > | GetAllCustomersByPriciestProfile () |
Gets all Customers buying items, sorted by how much they are willing to pay for the items. | |
List< Sale > | GetAllSalesWithinMaxPrice (int maxPrice) |
Returns a list of all sales which matches a specified max price. | |
List< Sale > | FindPotentialItems (Profile p) |
Returns a list of items which matches a specified profile. | |
List< Profile > | FindPotentialBuyers (Sale s) |
Finds all profiles that matches a Sale. | |
int | SortProfileByPrice (Profile x, Profile y) |
A Comparison delegate that sorts a list of profiles descending by MaxPrice. | |
RealtyManager (CatalogueData data) | |
Constructor. | |
void | Run () |
Starts displaying the userinterface. Blocks. | |
IList< Customer > | GetAllCustomersByEarliestSale () |
Gets all Customers selling items, sorted by the earliest date the items were put for sale. | |
IList< Customer > | GetAllCustomersByPriciestProfile () |
Gets all Customers buying items, sorted by how much they are willing to pay for the items. | |
List< Sale > | GetAllSalesWithinMaxPrice (int maxPrice) |
Returns a list of all sales which matches a specified max price. | |
List< Sale > | FindPotentialItems (Profile p) |
Returns a list of items which matches a specified profile. | |
List< Profile > | FindPotentialBuyers (Sale s) |
Finds all profiles that matches a Sale. | |
int | SortProfileByPrice (Profile x, Profile y) |
A Comparison delegate that sorts a list of profiles descending by MaxPrice. | |
Private Member Functions | |
void | ShowMainMenu () |
Draws the Main Menu. | |
void | ShowMaxPriceSales (int maxPrice) |
Draws all sales whose prices are lower or equal to maxPrice. | |
void | ShowCustomersByPotentialSales (Sale s) |
Shows highest bidding customers who have a profile that matches with a specific sale. | |
void | ShowCustomersByOldestSale () |
Shows all customers sorted by the ones that have the oldest existing sales. | |
void | ShowCustomersByBid () |
Shows all Customers buying items sorted by the amount they are willing to pay for said items. | |
void | ShowCustomerMenu () |
Shows the Customer menu, where users are deleted or listed. | |
void | ShowCustomerList () |
Shows a list of all customers. | |
void | ShowCustomer (Customer customer) |
Shows a Customers information and allows creation of Sales and Profiles for the customer. Also allows search by all the users profiles. | |
void | ShowSales (Customer customer) |
Show all a Customers sales. | |
void | ShowSale (Sale sale) |
Show options for a Sale. | |
void | ShowSaleDetails (Sale sale) |
Show details about a sale and allows user to change the details. | |
void | ShowAddSale (Customer customer) |
Shows a wizard for adding a new Sale. | |
object | ShowMakeItem (string header, Type type) |
Shows a wizard for creation of Items. Takes a Type of Item to be created. | |
void | SetValueOfProperty (PropertyInfo pi, string propertyName, object instance, string header) |
Shows a screen that allows for a arbitrary Property's value to be set. Provided it is marked by the SaleCriteria Attribute. | |
void | ShowProfiles (Customer customer) |
Lists a Customers profile. | |
void | AddCustomer () |
Shows a wizard to create a new Customer. | |
void | ShowAddProfile (Customer c) |
Shows a Wizard to create a new Profile for a Customer. | |
void | ShowProfile (Profile profile) |
Displays a options for a Profile. Options are: Find Matching Sales, Set Profile Search Criteria and Delete Profile. | |
void | ShowMatchingSales (Customer c) |
Show all sales that matches a Customers Profiles. | |
void | ShowMatchingSales (Profile c) |
Shows all sales that match a single Profile. | |
void | ShowProfileDetails (Profile p) |
Shows details of a Profile, and allows for the details to be changed. | |
void | SetComparableCheck (Profile p, ComparableCheck check) |
Shows a screen that sets the minimum and maximum values of a ComparableCheck. | |
void | SetEnumCheck (Profile p, EnumCheck check) |
Shows a menu that allows selection of an enum value for an EnumCheck. | |
void | ShowMainMenu () |
Draws the Main Menu. | |
void | ShowMaxPriceSales (int maxPrice) |
Draws all sales whose prices are lower or equal to maxPrice. | |
void | ShowCustomersByPotentialSales (Sale s) |
Shows highest bidding customers who have a profile that matches with a specific sale. | |
void | ShowCustomersByOldestSale () |
Shows all customers sorted by the ones that have the oldest existing sales. | |
void | ShowCustomersByBid () |
Shows all Customers buying items sorted by the amount they are willing to pay for said items. | |
void | ShowCustomerMenu () |
Shows the Customer menu, where users are deleted or listed. | |
void | ShowCustomerList () |
Shows a list of all customers. | |
void | ShowCustomer (Customer customer) |
Shows a Customers information and allows creation of Sales and Profiles for the customer. Also allows search by all the users profiles. | |
void | ShowSales (Customer customer) |
Show all a Customers sales. | |
void | ShowSale (Sale sale) |
Show options for a Sale. | |
void | ShowSaleDetails (Sale sale) |
Show details about a sale and allows user to change the details. | |
void | ShowAddSale (Customer customer) |
Shows a wizard for adding a new Sale. | |
object | ShowMakeItem (string header, Type type) |
Shows a wizard for creation of Items. Takes a Type of Item to be created. | |
void | SetValueOfProperty (PropertyInfo pi, string propertyName, object instance, string header) |
Shows a screen that allows for a arbitrary Property's value to be set. Provided it is marked by the SaleCriteria Attribute. | |
void | ShowProfiles (Customer customer) |
Lists a Customers profile. | |
void | AddCustomer () |
Shows a wizard to create a new Customer. | |
void | ShowAddProfile (Customer c) |
Shows a Wizard to create a new Profile for a Customer. | |
void | ShowProfile (Profile profile) |
Displays a options for a Profile. Options are: Find Matching Sales, Set Profile Search Criteria and Delete Profile. | |
void | ShowMatchingSales (Customer c) |
Show all sales that matches a Customers Profiles. | |
void | ShowMatchingSales (Profile c) |
Shows all sales that match a single Profile. | |
void | ShowProfileDetails (Profile p) |
Shows details of a Profile, and allows for the details to be changed. | |
void | SetComparableCheck (Profile p, ComparableCheck check) |
Shows a screen that sets the minimum and maximum values of a ComparableCheck. | |
void | SetEnumCheck (Profile p, EnumCheck check) |
Shows a menu that allows selection of an enum value for an EnumCheck. | |
Private Attributes | |
UserInterface | ui = new UserInterface() |
CatalogueData | data |
Definition at line 15 of file RealtyManager.cs.
HouseOver.THARM.RealtyManager.RealtyManager | ( | CatalogueData | data | ) |
Constructor.
data | CatalogueData object to use |
Definition at line 24 of file RealtyManager.cs.
00025 { 00026 this.data = data; 00027 }
HouseOver.THARM.RealtyManager.RealtyManager | ( | CatalogueData | data | ) |
Constructor.
data | CatalogueData object to use |
Definition at line 24 of file RealtyManager.cs.
00025 { 00026 this.data = data; 00027 }
void HouseOver.THARM.RealtyManager.Run | ( | ) |
Starts displaying the userinterface. Blocks.
Definition at line 32 of file RealtyManager.cs.
Referenced by HouseOver.StartUp.Main().
00033 { 00034 ShowMainMenu(); 00035 }
Here is the caller graph for this function:
IList<Customer> HouseOver.THARM.RealtyManager.GetAllCustomersByEarliestSale | ( | ) |
Gets all Customers selling items, sorted by the earliest date the items were put for sale.
Definition at line 43 of file RealtyManager.cs.
00044 { 00045 List<Customer> results = data.CustomersWithSales; 00046 results.Sort(new SalePutUpDateComparer(data)); 00047 00048 return results; 00049 }
IList<Customer> HouseOver.THARM.RealtyManager.GetAllCustomersByPriciestProfile | ( | ) |
Gets all Customers buying items, sorted by how much they are willing to pay for the items.
Definition at line 55 of file RealtyManager.cs.
00056 { 00057 List<Customer> results = data.CustomersWithProfiles; 00058 results.Sort(new ProfileMaxPriceComparer(data)); 00059 return results; 00060 }
List<Sale> HouseOver.THARM.RealtyManager.GetAllSalesWithinMaxPrice | ( | int | maxPrice | ) |
Returns a list of all sales which matches a specified max price.
maxPrice | The max price. An integer. |
Definition at line 68 of file RealtyManager.cs.
00069 { 00070 List<Sale> results = new List<Sale>(); 00071 00072 foreach (Sale sale in data.Sales) 00073 { 00074 if (sale.Price <= maxPrice) results.Add(sale); 00075 } 00076 00077 return results; 00078 }
Returns a list of items which matches a specified profile.
p | The profile to match. |
Definition at line 85 of file RealtyManager.cs.
References HouseOver.THARM.Profile.SaleWithinParameters().
00086 { 00087 List<Sale> potentialSales = new List<Sale>(); 00088 foreach (Sale s in data.Sales) 00089 { 00090 if (p.SaleWithinParameters(s)) 00091 potentialSales.Add(s); 00092 } 00093 return potentialSales; 00094 }
Here is the call graph for this function:
Finds all profiles that matches a Sale.
s | A Sale |
Definition at line 100 of file RealtyManager.cs.
00101 { 00102 List<Profile> potentialBuyers = new List<Profile>(); 00103 foreach (Profile p in data.Profiles) 00104 { 00105 if (p.SaleWithinParameters(s)) 00106 { 00107 potentialBuyers.Add(p); 00108 } 00109 } 00110 potentialBuyers.Sort(SortProfileByPrice); 00111 return potentialBuyers; 00112 }
A Comparison delegate that sorts a list of profiles descending by MaxPrice.
Definition at line 119 of file RealtyManager.cs.
References HouseOver.THARM.Profile.MaxPrice.
void HouseOver.THARM.RealtyManager.ShowMainMenu | ( | ) | [private] |
Draws the Main Menu.
Definition at line 131 of file RealtyManager.cs.
00132 { 00133 string mainMenu = " W e l c o m e t o T H A R M ! "; 00134 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00135 menuItems.Add("customers", "Customers"); 00136 menuItems.Add("search", "Find all sales within a maximum price"); 00137 menuItems.Add("listbuyers", "Show a list of customers with profiles sorted by offer amount"); 00138 menuItems.Add("listsellers", "Show a list of customers with sales sorted by earliest added"); 00139 00140 object theChoice; 00141 while (ui.DrawMenu(mainMenu, menuItems, true, out theChoice)) 00142 { 00143 switch (theChoice.ToString()) 00144 { 00145 case "customers": 00146 ShowCustomerMenu(); 00147 break; 00148 case "search": 00149 int maxPrice = ui.DrawInt("How much do you wish to pay?"); 00150 ShowMaxPriceSales(maxPrice); 00151 break; 00152 case "listbuyers": 00153 ShowCustomersByBid(); 00154 break; 00155 case "listsellers": 00156 ShowCustomersByOldestSale(); 00157 break; 00158 default: 00159 ui.Draw("Show a list of customers with property for sale"); 00160 break; 00161 } 00162 } 00163 }
void HouseOver.THARM.RealtyManager.ShowMaxPriceSales | ( | int | maxPrice | ) | [private] |
Draws all sales whose prices are lower or equal to maxPrice.
maxPrice | Highest price an item can cost on returned list |
Definition at line 169 of file RealtyManager.cs.
00170 { 00171 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00172 Sale selectedSale; 00173 00174 foreach (Sale sale in GetAllSalesWithinMaxPrice(maxPrice)) 00175 { 00176 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00177 } 00178 while (ui.DrawMenu("Find Sales by max price", menuItems, true, out selectedSale)) 00179 { 00180 ShowSale(selectedSale); 00181 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00182 if (menuItems.Count != GetAllSalesWithinMaxPrice(maxPrice).Count) 00183 { 00184 menuItems.Clear(); 00185 foreach (Sale sale in GetAllSalesWithinMaxPrice(maxPrice)) 00186 { 00187 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00188 } 00189 } 00190 00191 } 00192 }
void HouseOver.THARM.RealtyManager.ShowCustomersByPotentialSales | ( | Sale | s | ) | [private] |
Shows highest bidding customers who have a profile that matches with a specific sale.
Definition at line 197 of file RealtyManager.cs.
00198 { 00199 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00200 Customer selectedCustomer; 00201 00202 foreach (Profile cust in FindPotentialBuyers(s)) 00203 { 00204 if (menuItems.ContainsKey(cust.Owner) || cust.Owner == s.Seller) 00205 continue; 00206 menuItems.Add(cust.Owner, cust.Owner.Name + " (max price:" + cust.MaxPrice + ")"); 00207 } 00208 while (ui.DrawMenu("Potential Buyers - Sorted by Max Price", menuItems, true, out selectedCustomer)) 00209 { 00210 ShowCustomer(selectedCustomer); 00211 menuItems.Clear(); 00212 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00213 { 00214 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00215 } 00216 } 00217 }
void HouseOver.THARM.RealtyManager.ShowCustomersByOldestSale | ( | ) | [private] |
Shows all customers sorted by the ones that have the oldest existing sales.
Definition at line 222 of file RealtyManager.cs.
00223 { 00224 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00225 Customer selectedCustomer; 00226 00227 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00228 { 00229 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00230 } 00231 while (ui.DrawMenu("Customers - Sorted by oldest existing sale", menuItems, true, out selectedCustomer)) 00232 { 00233 ShowCustomer(selectedCustomer); 00234 menuItems.Clear(); 00235 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00236 { 00237 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00238 } 00239 } 00240 }
void HouseOver.THARM.RealtyManager.ShowCustomersByBid | ( | ) | [private] |
Shows all Customers buying items sorted by the amount they are willing to pay for said items.
Definition at line 245 of file RealtyManager.cs.
00246 { 00247 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00248 Customer selectedCustomer; 00249 00250 foreach (Customer cust in GetAllCustomersByPriciestProfile()) 00251 { 00252 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00253 } 00254 while (ui.DrawMenu("Customers - Sorted by highest bid on item", menuItems, true, out selectedCustomer)) 00255 { 00256 ShowCustomer(selectedCustomer); 00257 menuItems.Clear(); 00258 foreach (Customer cust in GetAllCustomersByPriciestProfile()) 00259 { 00260 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00261 } 00262 } 00263 }
void HouseOver.THARM.RealtyManager.ShowCustomerMenu | ( | ) | [private] |
Shows the Customer menu, where users are deleted or listed.
Definition at line 268 of file RealtyManager.cs.
00269 { 00270 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00271 string selection; 00272 00273 menuItems.Add("list", "List Customers (" + data.Count + ")"); 00274 menuItems.Add("add", "Add New Customer"); 00275 00276 while (ui.DrawMenu("Customers", menuItems, true, out selection)) 00277 { 00278 switch(selection) 00279 { 00280 case "list": 00281 ShowCustomerList(); 00282 break; 00283 case "add": 00284 AddCustomer(); 00285 break; 00286 } 00287 menuItems["list"] = "List Customers (" + data.Count + ")"; 00288 } 00289 }
void HouseOver.THARM.RealtyManager.ShowCustomerList | ( | ) | [private] |
Shows a list of all customers.
Definition at line 294 of file RealtyManager.cs.
00295 { 00296 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00297 Customer selectedCustomer; 00298 00299 foreach (Customer cust in data) 00300 { 00301 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00302 } 00303 while (ui.DrawMenu("Customers - List", menuItems, true, out selectedCustomer)) 00304 { 00305 ShowCustomer(selectedCustomer); 00306 menuItems.Clear(); 00307 foreach (Customer cust in data) 00308 { 00309 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00310 } 00311 } 00312 }
void HouseOver.THARM.RealtyManager.ShowCustomer | ( | Customer | customer | ) | [private] |
Shows a Customers information and allows creation of Sales and Profiles for the customer. Also allows search by all the users profiles.
customer | The Customer to show |
Definition at line 318 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name, and HouseOver.THARM.Customer.Postalcode.
00319 { 00320 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00321 string selection; 00322 00323 menuItems.Add("postal", "Change Postal Code (" + customer.Postalcode + ")"); 00324 menuItems.Add("find", "Find all potential sales"); 00325 menuItems.Add("addSale", "Add Sale"); 00326 menuItems.Add("addProfile", "Add Profile"); 00327 menuItems.Add("sales", "Show Sales (" + data.GetSales(customer).Count + ")"); 00328 menuItems.Add("profiles", "Show Profiles (" + data.GetProfiles(customer).Count + ")"); 00329 menuItems.Add("delete", "Delete customer"); 00330 00331 while (ui.DrawMenu("Customer (" +customer.Name+ ") ", menuItems, true, out selection)) 00332 { 00333 switch (selection) 00334 { 00335 case "postal": 00336 string r = ui.Draw("Input new Postal Code:"); 00337 try 00338 { 00339 int i = Int32.Parse(r); 00340 customer.Postalcode = i; 00341 menuItems["postal"] = "Change Postal Code (" + customer.Postalcode + ")"; 00342 } 00343 catch { } 00344 break; 00345 case "addProfile": 00346 ShowAddProfile(customer); 00347 menuItems["profiles"] = "Show Profiles (" + data.GetProfiles(customer).Count + ")"; 00348 break; 00349 case "find": 00350 ShowMatchingSales(customer); 00351 break; 00352 case "addSale": 00353 ShowAddSale(customer); 00354 menuItems["sales"] = "Show Sales (" + data.GetSales(customer).Count + ")"; 00355 break; 00356 case "sales": 00357 ShowSales(customer); 00358 menuItems["sales"] = "Show Sales (" + data.GetSales(customer).Count + ")"; 00359 break; 00360 case "profiles": 00361 ShowProfiles(customer); 00362 menuItems["profiles"] = "Show Profiles (" + data.GetProfiles(customer).Count + ")"; 00363 break; 00364 } 00365 if (selection == "delete") 00366 { 00367 string delete = ui.Draw("Are you certain you want to delete this customer? (Type \"YES\" to confirm)"); 00368 if (delete.ToLower() == "yes") 00369 data.Remove(customer); 00370 break; 00371 } 00372 } 00373 }
void HouseOver.THARM.RealtyManager.ShowSales | ( | Customer | customer | ) | [private] |
Show all a Customers sales.
customer | The Customer whose Sales needs showing |
Definition at line 379 of file RealtyManager.cs.
00380 { 00381 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00382 Sale selectedSale; 00383 00384 foreach (Sale sale in data.GetSales(customer)) 00385 { 00386 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00387 } 00388 while (ui.DrawMenu("Customer (" + customer.Name + ") - Sales", menuItems, true, out selectedSale)) 00389 { 00390 ShowSale(selectedSale); 00391 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00392 if (menuItems.Count != data.GetSales(customer).Count) 00393 { 00394 menuItems.Clear(); 00395 foreach (Sale sale in data.GetSales(customer)) 00396 { 00397 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00398 } 00399 } 00400 00401 } 00402 }
void HouseOver.THARM.RealtyManager.ShowSale | ( | Sale | sale | ) | [private] |
Show options for a Sale.
sale | A Sale object |
Definition at line 408 of file RealtyManager.cs.
References HouseOver.THARM.Sale.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Sale.PutUpForSale, and HouseOver.THARM.Sale.Seller.
00409 { 00410 string selectedItem = null; 00411 string header = "Customer (" + sale.Seller.Name + ") - Sale (" + sale.Item.GetType().Name + " @ " + sale.PutUpForSale.ToShortDateString() + ")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00412 00413 00414 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00415 menuItems.Add("find", "Find Potential Buyers"); 00416 menuItems.Add("details", "Change Item Details"); 00417 menuItems.Add("delete", "Delete Sale"); 00418 00419 while (ui.DrawMenu(header + "Select an item:", menuItems, true, out selectedItem)) 00420 { 00421 if (selectedItem == "delete") 00422 { 00423 string confirm = ui.Draw("Are you sure you want to delete this sale? (type \"YES\")"); 00424 if (confirm.ToLower() == "yes") 00425 { 00426 data.Remove(sale); 00427 break; 00428 } 00429 } 00430 else if (selectedItem == "details") 00431 { 00432 ShowSaleDetails(sale); 00433 } 00434 else if (selectedItem == "find") 00435 { 00436 ShowCustomersByPotentialSales(sale); 00437 } 00438 } 00439 }
void HouseOver.THARM.RealtyManager.ShowSaleDetails | ( | Sale | sale | ) | [private] |
Show details about a sale and allows user to change the details.
sale | A Sale |
Definition at line 445 of file RealtyManager.cs.
References HouseOver.THARM.Attributes.SaleCriteria.HumanReadableName, HouseOver.THARM.Sale.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Sale.Price, HouseOver.THARM.Sale.PutUpForSale, and HouseOver.THARM.Sale.Seller.
00446 { 00447 object selectedItem = null; 00448 string header = "Customer (" + sale.Seller.Name + ") - Sale Details ("+sale.Item.GetType().Name+" @ "+sale.PutUpForSale.ToShortDateString()+")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00449 00450 00451 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00452 menuItems.Add("price", "Set price (" + sale.Price + ")"); 00453 PropertyInfo[] pis = sale.Item.GetType().GetProperties(); 00454 foreach (PropertyInfo pi in pis) 00455 { 00456 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(pi, typeof(SaleCriteria)); 00457 if (sc == null) 00458 continue; 00459 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : pi.Name; 00460 00461 string value = pi.GetValue(sale.Item, new object[]{}).ToString(); 00462 menuItems.Add(pi, "Set " + propertyName + " (" + value + ")"); 00463 } 00464 00465 00466 00467 while (ui.DrawMenu(header + "Select an item to change its value:", menuItems, true, out selectedItem)) 00468 { 00469 if (selectedItem is PropertyInfo) 00470 { 00471 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(selectedItem as PropertyInfo, typeof(SaleCriteria)); 00472 if (sc == null) 00473 continue; 00474 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : ((PropertyInfo)selectedItem).Name; 00475 00476 SetValueOfProperty(selectedItem as PropertyInfo, propertyName, sale.Item, header); 00477 menuItems[selectedItem] = "Set " + propertyName + " (" + ((PropertyInfo)selectedItem).GetValue(sale.Item, new object[] { }).ToString() + ")"; 00478 } 00479 else if (selectedItem is string && ((string)selectedItem) == "price") 00480 { 00481 sale.Price = ui.DrawInt(header + "Input new price for item:"); 00482 menuItems["price"] = "Set price (" + sale.Price + ")"; 00483 } 00484 } 00485 }
void HouseOver.THARM.RealtyManager.ShowAddSale | ( | Customer | customer | ) | [private] |
Shows a wizard for adding a new Sale.
Definition at line 491 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name.
00492 { 00493 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00494 00495 List<Type> types = Item.GetSearchableItems(); 00496 foreach (Type t in types) 00497 { 00498 menuItems.Add(t, t.Name); 00499 } 00500 00501 string header = "Customer (" + customer.Name + ") - Add Sale" + System.Environment.NewLine + System.Environment.NewLine + " "; 00502 00503 Type selected; 00504 if (!ui.DrawMenu(header + "Select the type of item you are selling:", menuItems, true, out selected)) 00505 return; 00506 00507 int price = ui.DrawInt(header + "Input selling price:"); 00508 DateTime date = DateTime.Now; 00509 00510 object instance = ShowMakeItem(header, selected); 00511 Sale sale = new Sale(price, date, (Item)instance, customer); 00512 data.Add(sale); 00513 }
object HouseOver.THARM.RealtyManager.ShowMakeItem | ( | string | header, | |
Type | type | |||
) | [private] |
Shows a wizard for creation of Items. Takes a Type of Item to be created.
header | A heading to show when creating the item | |
type | The Type of item to create. (Any class marked by the SearchItems attribute) |
Definition at line 521 of file RealtyManager.cs.
References HouseOver.THARM.Attributes.SaleCriteria.HumanReadableName.
00522 { 00523 ConstructorInfo ci = type.GetConstructor(Type.EmptyTypes); 00524 object instance = ci.Invoke(new object[] { }); 00525 00526 00527 PropertyInfo[] pis = type.GetProperties(); 00528 foreach (PropertyInfo pi in pis) 00529 { 00530 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(pi, typeof(SaleCriteria)); 00531 if (sc == null) 00532 continue; 00533 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : pi.Name; 00534 00535 SetValueOfProperty(pi, propertyName, instance, header); 00536 } 00537 return instance; 00538 }
void HouseOver.THARM.RealtyManager.SetValueOfProperty | ( | PropertyInfo | pi, | |
string | propertyName, | |||
object | instance, | |||
string | header | |||
) | [private] |
Shows a screen that allows for a arbitrary Property's value to be set. Provided it is marked by the SaleCriteria Attribute.
pi | Information about the Property to be set | |
propertyName | A humanreadable name of the property | |
instance | The instance whose Property is to be set | |
header | A heading to show while setting the parameter |
Definition at line 547 of file RealtyManager.cs.
00548 { 00549 if (pi.PropertyType.IsEnum) 00550 { 00551 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00552 Enum selectedEnum; 00553 00554 foreach (Enum e in Enum.GetValues(pi.PropertyType)) 00555 { 00556 menuItems.Add(e, e.ToString()); 00557 } 00558 00559 if (menuItems.Count > 0 && ui.DrawMenu(header + "Select " + propertyName, menuItems, false, out selectedEnum)) 00560 pi.SetValue(instance, selectedEnum, null); 00561 } 00562 else if (pi.PropertyType.FindInterfaces(Profile.MyInterfaceFilter, "System.IComparable").Length > 0) 00563 { 00564 string s = ui.Draw(header + "Input " + propertyName + ":"); 00565 try 00566 { 00567 pi.SetValue(instance, Convert.ChangeType(s, pi.PropertyType), null); 00568 } 00569 catch 00570 { 00571 // darnit 00572 } 00573 } 00574 }
void HouseOver.THARM.RealtyManager.ShowProfiles | ( | Customer | customer | ) | [private] |
Lists a Customers profile.
customer | a Customer |
Definition at line 580 of file RealtyManager.cs.
00581 { 00582 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00583 Profile selectedProfile; 00584 00585 foreach (Profile profile in data.GetProfiles(customer)) 00586 { 00587 menuItems.Add(profile, profile.Item.Name + " with a max price of " + profile.MaxPrice); 00588 } 00589 while (ui.DrawMenu("Customer (" + customer.Name + ") - Profiles", menuItems, true, out selectedProfile)) 00590 { 00591 ShowProfile(selectedProfile); 00592 menuItems[selectedProfile] = selectedProfile.Item.Name + " with a max price of " + selectedProfile.MaxPrice; 00593 if (menuItems.Count != data.GetProfiles(customer).Count) 00594 { 00595 menuItems.Clear(); 00596 foreach (Profile profile in data.GetProfiles(customer)) 00597 { 00598 menuItems.Add(profile, profile.Item.Name + " with a max price of " + profile.MaxPrice); 00599 } 00600 } 00601 } 00602 }
void HouseOver.THARM.RealtyManager.AddCustomer | ( | ) | [private] |
Shows a wizard to create a new Customer.
Definition at line 607 of file RealtyManager.cs.
References HouseOver.UserInterface.Draw(), and HouseOver.UserInterface.DrawInt().
00608 { 00609 UserInterface ui = new UserInterface(); 00610 string name; 00611 int postalcode; 00612 string step1 = "Customers - Add" + System.Environment.NewLine + System.Environment.NewLine + " Please enter the customer's name:"; 00613 string step2 = "Customers - Add" + System.Environment.NewLine + System.Environment.NewLine + " Please enter the customer's postal code:"; 00614 00615 name = ui.Draw(step1); 00616 if (string.IsNullOrEmpty(name)) 00617 return; 00618 postalcode = ui.DrawInt(step2); 00619 00620 Customer theCustomer = new Customer(postalcode, name); 00621 data.Add(theCustomer); 00622 }
Here is the call graph for this function:
void HouseOver.THARM.RealtyManager.ShowAddProfile | ( | Customer | c | ) | [private] |
Shows a Wizard to create a new Profile for a Customer.
c | a Customer |
Definition at line 628 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name.
00629 { 00630 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00631 00632 List<Type> types = Item.GetSearchableItems(); 00633 foreach (Type t in types) 00634 { 00635 menuItems.Add(t, t.Name); 00636 } 00637 Type selected; 00638 if (!ui.DrawMenu("Customer ("+c.Name+") - Add Profile" + System.Environment.NewLine + System.Environment.NewLine + " Select the type of item you are searching for:", menuItems, true, out selected)) 00639 return; 00640 00641 int maxPrice = ui.DrawInt("Customer (" + c.Name + ") - Add Profile" + System.Environment.NewLine + System.Environment.NewLine + " What is the maximum price you're willing to pay for this " + selected.Name + ":"); 00642 Profile p = new Profile(c, maxPrice, selected); 00643 data.Add(p); 00644 ShowProfile(p); 00645 }
void HouseOver.THARM.RealtyManager.ShowProfile | ( | Profile | profile | ) | [private] |
Displays a options for a Profile. Options are: Find Matching Sales, Set Profile Search Criteria and Delete Profile.
profile | a Profile |
Definition at line 651 of file RealtyManager.cs.
References HouseOver.THARM.Profile.Item, HouseOver.THARM.Customer.Name, and HouseOver.THARM.Profile.Owner.
00652 { 00653 string selectedItem = null; 00654 string header = "Customer (" + profile.Owner.Name + ") - Profile (" + profile.Item.Name + ")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00655 00656 00657 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00658 menuItems.Add("find", "Find Matching Sales"); 00659 menuItems.Add("details", "Set Profile Search Criteria"); 00660 menuItems.Add("delete", "Delete Profile"); 00661 00662 while (ui.DrawMenu(header + "Select an item:", menuItems, true, out selectedItem)) 00663 { 00664 if (selectedItem == "delete") 00665 { 00666 string confirm = ui.Draw("Are you sure you want to delete this profile? (type \"YES\")"); 00667 if (confirm.ToLower() == "yes") 00668 { 00669 data.Remove(profile); 00670 break; 00671 } 00672 } 00673 else if (selectedItem == "details") 00674 { 00675 ShowProfileDetails(profile); 00676 } 00677 else if (selectedItem == "find") 00678 { 00679 ShowMatchingSales(profile); 00680 } 00681 } 00682 }
void HouseOver.THARM.RealtyManager.ShowMatchingSales | ( | Customer | c | ) | [private] |
Show all sales that matches a Customers Profiles.
c | A Customer |
Definition at line 687 of file RealtyManager.cs.
00688 { 00689 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00690 Sale selectedSale; 00691 00692 foreach(Profile profile in data.GetProfiles(c)) 00693 foreach (Sale sale in FindPotentialItems(profile)) 00694 { 00695 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00696 } 00697 while (ui.DrawMenu("Customer (" + c.Name + ") - Matching Sales", menuItems, true, out selectedSale)) 00698 { 00699 ShowSale(selectedSale); 00700 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00701 } 00702 }
void HouseOver.THARM.RealtyManager.ShowMatchingSales | ( | Profile | c | ) | [private] |
Shows all sales that match a single Profile.
c | A Profile |
Definition at line 707 of file RealtyManager.cs.
00708 { 00709 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00710 Sale selectedSale; 00711 00712 foreach (Sale sale in FindPotentialItems(c)) 00713 { 00714 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00715 } 00716 while (ui.DrawMenu("Customer (" + c.Owner.Name + ") - Matching Sales", menuItems, true, out selectedSale)) 00717 { 00718 ShowSale(selectedSale); 00719 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00720 } 00721 }
void HouseOver.THARM.RealtyManager.ShowProfileDetails | ( | Profile | p | ) | [private] |
Shows details of a Profile, and allows for the details to be changed.
p | A Profile |
Definition at line 726 of file RealtyManager.cs.
References HouseOver.THARM.Profile.Checks, HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Profile.MaxPrice, HouseOver.THARM.Search.ComparableCheck.MaxValue, HouseOver.THARM.Search.ComparableCheck.MinValue, HouseOver.THARM.Customer.Name, HouseOver.THARM.Profile.Owner, and HouseOver.THARM.Search.EnumCheck.Value.
00727 { 00728 object check = null; 00729 00730 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00731 menuItems.Add("price", "Max paying price (" + p.MaxPrice + ")"); 00732 foreach (Check c in p.Checks.Values) 00733 { 00734 ComparableCheck comparableCheck = c as ComparableCheck; 00735 EnumCheck enumCheck = c as EnumCheck; 00736 00737 if (comparableCheck != null && comparableCheck.MinValue != null && comparableCheck.MaxValue != null && comparableCheck.FieldRequired) 00738 { 00739 menuItems.Add(c, comparableCheck.HumanReadableName + " (" + comparableCheck.MinValue + "-" + comparableCheck.MaxValue + ")"); 00740 } 00741 else if (enumCheck != null && enumCheck.FieldRequired) 00742 { 00743 menuItems.Add(c, enumCheck.HumanReadableName + " (" + enumCheck.Value + ")"); 00744 } 00745 else 00746 menuItems.Add(c, c.HumanReadableName); 00747 } 00748 00749 while (ui.DrawMenu("Customer (" + p.Owner.Name + ") - Profile Details (" + p.Item.Name + ")" + System.Environment.NewLine + System.Environment.NewLine + " Select a criteria to set your preference:", menuItems, true, out check)) 00750 { 00751 Check cc; 00752 if ((cc = check as ComparableCheck) != null) 00753 { 00754 SetComparableCheck(p, (ComparableCheck)check); 00755 menuItems[check] = cc.FieldRequired ? cc.HumanReadableName + " (" + ((ComparableCheck)cc).MinValue + "-" + ((ComparableCheck)cc).MaxValue + ")" : cc.HumanReadableName; 00756 } 00757 else if ((cc = check as EnumCheck) != null) 00758 { 00759 SetEnumCheck(p, (EnumCheck)check); 00760 menuItems[check] = cc.FieldRequired ? cc.HumanReadableName + " (" + ((EnumCheck)check).Value + ")" : cc.HumanReadableName; 00761 } 00762 else if (check is string && check.ToString() == "price") 00763 { 00764 p.MaxPrice = ui.DrawInt("Customer ({0}) - Profile ({1}) - Max paying price" + System.Environment.NewLine + System.Environment.NewLine + " Enter maximum paying price:", p.Owner.Name, p.Item.Name); 00765 menuItems["price"] = "Max paying price (" + p.MaxPrice + ")"; 00766 } 00767 } 00768 }
void HouseOver.THARM.RealtyManager.SetComparableCheck | ( | Profile | p, | |
ComparableCheck | check | |||
) | [private] |
Shows a screen that sets the minimum and maximum values of a ComparableCheck.
p | The check's Profile | |
check | A Check |
Definition at line 775 of file RealtyManager.cs.
References HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Search.ComparableCheck.MaxValue, HouseOver.THARM.Search.ComparableCheck.MinValue, HouseOver.THARM.Customer.Name, and HouseOver.THARM.Profile.Owner.
00776 { 00777 string s = ui.Draw("Customer ({0}) - Profile ({1}) - Check ({2})" + System.Environment.NewLine + System.Environment.NewLine + " Enter minimum value (if empty, this criteria is ignored):", p.Owner.Name, p.Item.Name, check.HumanReadableName); 00778 if (!string.IsNullOrEmpty(s)) 00779 { 00780 check.MinValue = s; 00781 check.MaxValue = ui.Draw("Customer ({0}) - Profile ({1}) - Check ({2})" + System.Environment.NewLine + System.Environment.NewLine + " Enter maximum value:", p.Owner.Name, p.Item.Name, check.HumanReadableName); 00782 } 00783 else 00784 check.MinValue = null; 00785 if (check.MinValue == null || check.MaxValue == null) 00786 check.FieldRequired = false; 00787 else 00788 check.FieldRequired = true; 00789 }
Shows a menu that allows selection of an enum value for an EnumCheck.
p | The EnumCheck's Profile | |
check | An EnumCheck |
Definition at line 796 of file RealtyManager.cs.
References HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.FieldType, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Profile.Owner, and HouseOver.THARM.Search.EnumCheck.Value.
00797 { 00798 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00799 Enum selectedEnum; 00800 00801 foreach (Enum e in Enum.GetValues(check.FieldType)) 00802 { 00803 menuItems.Add(e, e.ToString()); 00804 } 00805 00806 if (ui.DrawMenu("Customer ("+p.Owner.Name+") - Profile ("+p.Item.Name+") - Check ("+check.HumanReadableName+")", menuItems, true, out selectedEnum)) 00807 { 00808 check.Value = selectedEnum; 00809 check.FieldRequired = true; 00810 } else 00811 check.FieldRequired = false; 00812 }
void HouseOver.THARM.RealtyManager.Run | ( | ) |
Starts displaying the userinterface. Blocks.
Definition at line 32 of file RealtyManager.cs.
00033 { 00034 ShowMainMenu(); 00035 }
IList<Customer> HouseOver.THARM.RealtyManager.GetAllCustomersByEarliestSale | ( | ) |
Gets all Customers selling items, sorted by the earliest date the items were put for sale.
Definition at line 43 of file RealtyManager.cs.
00044 { 00045 List<Customer> results = data.CustomersWithSales; 00046 results.Sort(new SalePutUpDateComparer(data)); 00047 00048 return results; 00049 }
IList<Customer> HouseOver.THARM.RealtyManager.GetAllCustomersByPriciestProfile | ( | ) |
Gets all Customers buying items, sorted by how much they are willing to pay for the items.
Definition at line 55 of file RealtyManager.cs.
00056 { 00057 List<Customer> results = data.CustomersWithProfiles; 00058 results.Sort(new ProfileMaxPriceComparer(data)); 00059 return results; 00060 }
List<Sale> HouseOver.THARM.RealtyManager.GetAllSalesWithinMaxPrice | ( | int | maxPrice | ) |
Returns a list of all sales which matches a specified max price.
maxPrice | The max price. An integer. |
Definition at line 68 of file RealtyManager.cs.
00069 { 00070 List<Sale> results = new List<Sale>(); 00071 00072 foreach (Sale sale in data.Sales) 00073 { 00074 if (sale.Price <= maxPrice) results.Add(sale); 00075 } 00076 00077 return results; 00078 }
Returns a list of items which matches a specified profile.
p | The profile to match. |
Definition at line 85 of file RealtyManager.cs.
References HouseOver.THARM.Profile.SaleWithinParameters().
00086 { 00087 List<Sale> potentialSales = new List<Sale>(); 00088 foreach (Sale s in data.Sales) 00089 { 00090 if (p.SaleWithinParameters(s)) 00091 potentialSales.Add(s); 00092 } 00093 return potentialSales; 00094 }
Here is the call graph for this function:
Finds all profiles that matches a Sale.
s | A Sale |
Definition at line 100 of file RealtyManager.cs.
00101 { 00102 List<Profile> potentialBuyers = new List<Profile>(); 00103 foreach (Profile p in data.Profiles) 00104 { 00105 if (p.SaleWithinParameters(s)) 00106 { 00107 potentialBuyers.Add(p); 00108 } 00109 } 00110 potentialBuyers.Sort(SortProfileByPrice); 00111 return potentialBuyers; 00112 }
A Comparison delegate that sorts a list of profiles descending by MaxPrice.
Definition at line 119 of file RealtyManager.cs.
References HouseOver.THARM.Profile.MaxPrice.
void HouseOver.THARM.RealtyManager.ShowMainMenu | ( | ) | [private] |
Draws the Main Menu.
Definition at line 131 of file RealtyManager.cs.
00132 { 00133 string mainMenu = " W e l c o m e t o T H A R M ! "; 00134 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00135 menuItems.Add("customers", "Customers"); 00136 menuItems.Add("search", "Find all sales within a maximum price"); 00137 menuItems.Add("listbuyers", "Show a list of customers with profiles sorted by offer amount"); 00138 menuItems.Add("listsellers", "Show a list of customers with sales sorted by earliest added"); 00139 00140 object theChoice; 00141 while (ui.DrawMenu(mainMenu, menuItems, true, out theChoice)) 00142 { 00143 switch (theChoice.ToString()) 00144 { 00145 case "customers": 00146 ShowCustomerMenu(); 00147 break; 00148 case "search": 00149 int maxPrice = ui.DrawInt("How much do you wish to pay?"); 00150 ShowMaxPriceSales(maxPrice); 00151 break; 00152 case "listbuyers": 00153 ShowCustomersByBid(); 00154 break; 00155 case "listsellers": 00156 ShowCustomersByOldestSale(); 00157 break; 00158 default: 00159 ui.Draw("Show a list of customers with property for sale"); 00160 break; 00161 } 00162 } 00163 }
void HouseOver.THARM.RealtyManager.ShowMaxPriceSales | ( | int | maxPrice | ) | [private] |
Draws all sales whose prices are lower or equal to maxPrice.
maxPrice | Highest price an item can cost on returned list |
Definition at line 169 of file RealtyManager.cs.
00170 { 00171 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00172 Sale selectedSale; 00173 00174 foreach (Sale sale in GetAllSalesWithinMaxPrice(maxPrice)) 00175 { 00176 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00177 } 00178 while (ui.DrawMenu("Find Sales by max price", menuItems, true, out selectedSale)) 00179 { 00180 ShowSale(selectedSale); 00181 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00182 if (menuItems.Count != GetAllSalesWithinMaxPrice(maxPrice).Count) 00183 { 00184 menuItems.Clear(); 00185 foreach (Sale sale in GetAllSalesWithinMaxPrice(maxPrice)) 00186 { 00187 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00188 } 00189 } 00190 00191 } 00192 }
void HouseOver.THARM.RealtyManager.ShowCustomersByPotentialSales | ( | Sale | s | ) | [private] |
Shows highest bidding customers who have a profile that matches with a specific sale.
Definition at line 197 of file RealtyManager.cs.
00198 { 00199 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00200 Customer selectedCustomer; 00201 00202 foreach (Profile cust in FindPotentialBuyers(s)) 00203 { 00204 if (menuItems.ContainsKey(cust.Owner) || cust.Owner == s.Seller) 00205 continue; 00206 menuItems.Add(cust.Owner, cust.Owner.Name + " (max price:" + cust.MaxPrice + ")"); 00207 } 00208 while (ui.DrawMenu("Potential Buyers - Sorted by Max Price", menuItems, true, out selectedCustomer)) 00209 { 00210 ShowCustomer(selectedCustomer); 00211 menuItems.Clear(); 00212 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00213 { 00214 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00215 } 00216 } 00217 }
void HouseOver.THARM.RealtyManager.ShowCustomersByOldestSale | ( | ) | [private] |
Shows all customers sorted by the ones that have the oldest existing sales.
Definition at line 222 of file RealtyManager.cs.
00223 { 00224 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00225 Customer selectedCustomer; 00226 00227 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00228 { 00229 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00230 } 00231 while (ui.DrawMenu("Customers - Sorted by oldest existing sale", menuItems, true, out selectedCustomer)) 00232 { 00233 ShowCustomer(selectedCustomer); 00234 menuItems.Clear(); 00235 foreach (Customer cust in GetAllCustomersByEarliestSale()) 00236 { 00237 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00238 } 00239 } 00240 }
void HouseOver.THARM.RealtyManager.ShowCustomersByBid | ( | ) | [private] |
Shows all Customers buying items sorted by the amount they are willing to pay for said items.
Definition at line 245 of file RealtyManager.cs.
00246 { 00247 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00248 Customer selectedCustomer; 00249 00250 foreach (Customer cust in GetAllCustomersByPriciestProfile()) 00251 { 00252 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00253 } 00254 while (ui.DrawMenu("Customers - Sorted by highest bid on item", menuItems, true, out selectedCustomer)) 00255 { 00256 ShowCustomer(selectedCustomer); 00257 menuItems.Clear(); 00258 foreach (Customer cust in GetAllCustomersByPriciestProfile()) 00259 { 00260 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00261 } 00262 } 00263 }
void HouseOver.THARM.RealtyManager.ShowCustomerMenu | ( | ) | [private] |
Shows the Customer menu, where users are deleted or listed.
Definition at line 268 of file RealtyManager.cs.
00269 { 00270 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00271 string selection; 00272 00273 menuItems.Add("list", "List Customers (" + data.Count + ")"); 00274 menuItems.Add("add", "Add New Customer"); 00275 00276 while (ui.DrawMenu("Customers", menuItems, true, out selection)) 00277 { 00278 switch(selection) 00279 { 00280 case "list": 00281 ShowCustomerList(); 00282 break; 00283 case "add": 00284 AddCustomer(); 00285 break; 00286 } 00287 menuItems["list"] = "List Customers (" + data.Count + ")"; 00288 } 00289 }
void HouseOver.THARM.RealtyManager.ShowCustomerList | ( | ) | [private] |
Shows a list of all customers.
Definition at line 294 of file RealtyManager.cs.
00295 { 00296 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00297 Customer selectedCustomer; 00298 00299 foreach (Customer cust in data) 00300 { 00301 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00302 } 00303 while (ui.DrawMenu("Customers - List", menuItems, true, out selectedCustomer)) 00304 { 00305 ShowCustomer(selectedCustomer); 00306 menuItems.Clear(); 00307 foreach (Customer cust in data) 00308 { 00309 menuItems.Add(cust, cust.Name + " (id:" + cust.ID + ")"); 00310 } 00311 } 00312 }
void HouseOver.THARM.RealtyManager.ShowCustomer | ( | Customer | customer | ) | [private] |
Shows a Customers information and allows creation of Sales and Profiles for the customer. Also allows search by all the users profiles.
customer | The Customer to show |
Definition at line 318 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name, and HouseOver.THARM.Customer.Postalcode.
00319 { 00320 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00321 string selection; 00322 00323 menuItems.Add("postal", "Change Postal Code (" + customer.Postalcode + ")"); 00324 menuItems.Add("find", "Find all potential sales"); 00325 menuItems.Add("addSale", "Add Sale"); 00326 menuItems.Add("addProfile", "Add Profile"); 00327 menuItems.Add("sales", "Show Sales (" + data.GetSales(customer).Count + ")"); 00328 menuItems.Add("profiles", "Show Profiles (" + data.GetProfiles(customer).Count + ")"); 00329 menuItems.Add("delete", "Delete customer"); 00330 00331 while (ui.DrawMenu("Customer (" +customer.Name+ ") ", menuItems, true, out selection)) 00332 { 00333 switch (selection) 00334 { 00335 case "postal": 00336 string r = ui.Draw("Input new Postal Code:"); 00337 try 00338 { 00339 int i = Int32.Parse(r); 00340 customer.Postalcode = i; 00341 menuItems["postal"] = "Change Postal Code (" + customer.Postalcode + ")"; 00342 } 00343 catch { } 00344 break; 00345 case "addProfile": 00346 ShowAddProfile(customer); 00347 menuItems["profiles"] = "Show Profiles (" + data.GetProfiles(customer).Count + ")"; 00348 break; 00349 case "find": 00350 ShowMatchingSales(customer); 00351 break; 00352 case "addSale": 00353 ShowAddSale(customer); 00354 menuItems["sales"] = "Show Sales (" + data.GetSales(customer).Count + ")"; 00355 break; 00356 case "sales": 00357 ShowSales(customer); 00358 menuItems["sales"] = "Show Sales (" + data.GetSales(customer).Count + ")"; 00359 break; 00360 case "profiles": 00361 ShowProfiles(customer); 00362 menuItems["profiles"] = "Show Profiles (" + data.GetProfiles(customer).Count + ")"; 00363 break; 00364 } 00365 if (selection == "delete") 00366 { 00367 string delete = ui.Draw("Are you certain you want to delete this customer? (Type \"YES\" to confirm)"); 00368 if (delete.ToLower() == "yes") 00369 data.Remove(customer); 00370 break; 00371 } 00372 } 00373 }
void HouseOver.THARM.RealtyManager.ShowSales | ( | Customer | customer | ) | [private] |
Show all a Customers sales.
customer | The Customer whose Sales needs showing |
Definition at line 379 of file RealtyManager.cs.
00380 { 00381 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00382 Sale selectedSale; 00383 00384 foreach (Sale sale in data.GetSales(customer)) 00385 { 00386 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00387 } 00388 while (ui.DrawMenu("Customer (" + customer.Name + ") - Sales", menuItems, true, out selectedSale)) 00389 { 00390 ShowSale(selectedSale); 00391 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00392 if (menuItems.Count != data.GetSales(customer).Count) 00393 { 00394 menuItems.Clear(); 00395 foreach (Sale sale in data.GetSales(customer)) 00396 { 00397 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00398 } 00399 } 00400 00401 } 00402 }
void HouseOver.THARM.RealtyManager.ShowSale | ( | Sale | sale | ) | [private] |
Show options for a Sale.
sale | A Sale object |
Definition at line 408 of file RealtyManager.cs.
References HouseOver.THARM.Sale.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Sale.PutUpForSale, and HouseOver.THARM.Sale.Seller.
00409 { 00410 string selectedItem = null; 00411 string header = "Customer (" + sale.Seller.Name + ") - Sale (" + sale.Item.GetType().Name + " @ " + sale.PutUpForSale.ToShortDateString() + ")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00412 00413 00414 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00415 menuItems.Add("find", "Find Potential Buyers"); 00416 menuItems.Add("details", "Change Item Details"); 00417 menuItems.Add("delete", "Delete Sale"); 00418 00419 while (ui.DrawMenu(header + "Select an item:", menuItems, true, out selectedItem)) 00420 { 00421 if (selectedItem == "delete") 00422 { 00423 string confirm = ui.Draw("Are you sure you want to delete this sale? (type \"YES\")"); 00424 if (confirm.ToLower() == "yes") 00425 { 00426 data.Remove(sale); 00427 break; 00428 } 00429 } 00430 else if (selectedItem == "details") 00431 { 00432 ShowSaleDetails(sale); 00433 } 00434 else if (selectedItem == "find") 00435 { 00436 ShowCustomersByPotentialSales(sale); 00437 } 00438 } 00439 }
void HouseOver.THARM.RealtyManager.ShowSaleDetails | ( | Sale | sale | ) | [private] |
Show details about a sale and allows user to change the details.
sale | A Sale |
Definition at line 445 of file RealtyManager.cs.
References HouseOver.THARM.Attributes.SaleCriteria.HumanReadableName, HouseOver.THARM.Sale.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Sale.Price, HouseOver.THARM.Sale.PutUpForSale, and HouseOver.THARM.Sale.Seller.
00446 { 00447 object selectedItem = null; 00448 string header = "Customer (" + sale.Seller.Name + ") - Sale Details ("+sale.Item.GetType().Name+" @ "+sale.PutUpForSale.ToShortDateString()+")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00449 00450 00451 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00452 menuItems.Add("price", "Set price (" + sale.Price + ")"); 00453 PropertyInfo[] pis = sale.Item.GetType().GetProperties(); 00454 foreach (PropertyInfo pi in pis) 00455 { 00456 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(pi, typeof(SaleCriteria)); 00457 if (sc == null) 00458 continue; 00459 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : pi.Name; 00460 00461 string value = pi.GetValue(sale.Item, new object[]{}).ToString(); 00462 menuItems.Add(pi, "Set " + propertyName + " (" + value + ")"); 00463 } 00464 00465 00466 00467 while (ui.DrawMenu(header + "Select an item to change its value:", menuItems, true, out selectedItem)) 00468 { 00469 if (selectedItem is PropertyInfo) 00470 { 00471 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(selectedItem as PropertyInfo, typeof(SaleCriteria)); 00472 if (sc == null) 00473 continue; 00474 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : ((PropertyInfo)selectedItem).Name; 00475 00476 SetValueOfProperty(selectedItem as PropertyInfo, propertyName, sale.Item, header); 00477 menuItems[selectedItem] = "Set " + propertyName + " (" + ((PropertyInfo)selectedItem).GetValue(sale.Item, new object[] { }).ToString() + ")"; 00478 } 00479 else if (selectedItem is string && ((string)selectedItem) == "price") 00480 { 00481 sale.Price = ui.DrawInt(header + "Input new price for item:"); 00482 menuItems["price"] = "Set price (" + sale.Price + ")"; 00483 } 00484 } 00485 }
void HouseOver.THARM.RealtyManager.ShowAddSale | ( | Customer | customer | ) | [private] |
Shows a wizard for adding a new Sale.
Definition at line 491 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name.
00492 { 00493 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00494 00495 List<Type> types = Item.GetSearchableItems(); 00496 foreach (Type t in types) 00497 { 00498 menuItems.Add(t, t.Name); 00499 } 00500 00501 string header = "Customer (" + customer.Name + ") - Add Sale" + System.Environment.NewLine + System.Environment.NewLine + " "; 00502 00503 Type selected; 00504 if (!ui.DrawMenu(header + "Select the type of item you are selling:", menuItems, true, out selected)) 00505 return; 00506 00507 int price = ui.DrawInt(header + "Input selling price:"); 00508 DateTime date = DateTime.Now; 00509 00510 object instance = ShowMakeItem(header, selected); 00511 Sale sale = new Sale(price, date, (Item)instance, customer); 00512 data.Add(sale); 00513 }
object HouseOver.THARM.RealtyManager.ShowMakeItem | ( | string | header, | |
Type | type | |||
) | [private] |
Shows a wizard for creation of Items. Takes a Type of Item to be created.
header | A heading to show when creating the item | |
type | The Type of item to create. (Any class marked by the SearchItems attribute) |
Definition at line 521 of file RealtyManager.cs.
References HouseOver.THARM.Attributes.SaleCriteria.HumanReadableName.
00522 { 00523 ConstructorInfo ci = type.GetConstructor(Type.EmptyTypes); 00524 object instance = ci.Invoke(new object[] { }); 00525 00526 00527 PropertyInfo[] pis = type.GetProperties(); 00528 foreach (PropertyInfo pi in pis) 00529 { 00530 SaleCriteria sc = (SaleCriteria)Attribute.GetCustomAttribute(pi, typeof(SaleCriteria)); 00531 if (sc == null) 00532 continue; 00533 string propertyName = sc.HumanReadableName != null ? sc.HumanReadableName : pi.Name; 00534 00535 SetValueOfProperty(pi, propertyName, instance, header); 00536 } 00537 return instance; 00538 }
void HouseOver.THARM.RealtyManager.SetValueOfProperty | ( | PropertyInfo | pi, | |
string | propertyName, | |||
object | instance, | |||
string | header | |||
) | [private] |
Shows a screen that allows for a arbitrary Property's value to be set. Provided it is marked by the SaleCriteria Attribute.
pi | Information about the Property to be set | |
propertyName | A humanreadable name of the property | |
instance | The instance whose Property is to be set | |
header | A heading to show while setting the parameter |
Definition at line 547 of file RealtyManager.cs.
00548 { 00549 if (pi.PropertyType.IsEnum) 00550 { 00551 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00552 Enum selectedEnum; 00553 00554 foreach (Enum e in Enum.GetValues(pi.PropertyType)) 00555 { 00556 menuItems.Add(e, e.ToString()); 00557 } 00558 00559 if (menuItems.Count > 0 && ui.DrawMenu(header + "Select " + propertyName, menuItems, false, out selectedEnum)) 00560 pi.SetValue(instance, selectedEnum, null); 00561 } 00562 else if (pi.PropertyType.FindInterfaces(Profile.MyInterfaceFilter, "System.IComparable").Length > 0) 00563 { 00564 string s = ui.Draw(header + "Input " + propertyName + ":"); 00565 try 00566 { 00567 pi.SetValue(instance, Convert.ChangeType(s, pi.PropertyType), null); 00568 } 00569 catch 00570 { 00571 // darnit 00572 } 00573 } 00574 }
void HouseOver.THARM.RealtyManager.ShowProfiles | ( | Customer | customer | ) | [private] |
Lists a Customers profile.
customer | a Customer |
Definition at line 580 of file RealtyManager.cs.
00581 { 00582 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00583 Profile selectedProfile; 00584 00585 foreach (Profile profile in data.GetProfiles(customer)) 00586 { 00587 menuItems.Add(profile, profile.Item.Name + " with a max price of " + profile.MaxPrice); 00588 } 00589 while (ui.DrawMenu("Customer (" + customer.Name + ") - Profiles", menuItems, true, out selectedProfile)) 00590 { 00591 ShowProfile(selectedProfile); 00592 menuItems[selectedProfile] = selectedProfile.Item.Name + " with a max price of " + selectedProfile.MaxPrice; 00593 if (menuItems.Count != data.GetProfiles(customer).Count) 00594 { 00595 menuItems.Clear(); 00596 foreach (Profile profile in data.GetProfiles(customer)) 00597 { 00598 menuItems.Add(profile, profile.Item.Name + " with a max price of " + profile.MaxPrice); 00599 } 00600 } 00601 } 00602 }
void HouseOver.THARM.RealtyManager.AddCustomer | ( | ) | [private] |
Shows a wizard to create a new Customer.
Definition at line 607 of file RealtyManager.cs.
References HouseOver.UserInterface.Draw(), and HouseOver.UserInterface.DrawInt().
00608 { 00609 UserInterface ui = new UserInterface(); 00610 string name; 00611 int postalcode; 00612 string step1 = "Customers - Add" + System.Environment.NewLine + System.Environment.NewLine + " Please enter the customer's name:"; 00613 string step2 = "Customers - Add" + System.Environment.NewLine + System.Environment.NewLine + " Please enter the customer's postal code:"; 00614 00615 name = ui.Draw(step1); 00616 if (string.IsNullOrEmpty(name)) 00617 return; 00618 postalcode = ui.DrawInt(step2); 00619 00620 Customer theCustomer = new Customer(postalcode, name); 00621 data.Add(theCustomer); 00622 }
Here is the call graph for this function:
void HouseOver.THARM.RealtyManager.ShowAddProfile | ( | Customer | c | ) | [private] |
Shows a Wizard to create a new Profile for a Customer.
c | a Customer |
Definition at line 628 of file RealtyManager.cs.
References HouseOver.THARM.Customer.Name.
00629 { 00630 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00631 00632 List<Type> types = Item.GetSearchableItems(); 00633 foreach (Type t in types) 00634 { 00635 menuItems.Add(t, t.Name); 00636 } 00637 Type selected; 00638 if (!ui.DrawMenu("Customer ("+c.Name+") - Add Profile" + System.Environment.NewLine + System.Environment.NewLine + " Select the type of item you are searching for:", menuItems, true, out selected)) 00639 return; 00640 00641 int maxPrice = ui.DrawInt("Customer (" + c.Name + ") - Add Profile" + System.Environment.NewLine + System.Environment.NewLine + " What is the maximum price you're willing to pay for this " + selected.Name + ":"); 00642 Profile p = new Profile(c, maxPrice, selected); 00643 data.Add(p); 00644 ShowProfile(p); 00645 }
void HouseOver.THARM.RealtyManager.ShowProfile | ( | Profile | profile | ) | [private] |
Displays a options for a Profile. Options are: Find Matching Sales, Set Profile Search Criteria and Delete Profile.
profile | a Profile |
Definition at line 651 of file RealtyManager.cs.
References HouseOver.THARM.Profile.Item, HouseOver.THARM.Customer.Name, and HouseOver.THARM.Profile.Owner.
00652 { 00653 string selectedItem = null; 00654 string header = "Customer (" + profile.Owner.Name + ") - Profile (" + profile.Item.Name + ")" + System.Environment.NewLine + System.Environment.NewLine + " "; 00655 00656 00657 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00658 menuItems.Add("find", "Find Matching Sales"); 00659 menuItems.Add("details", "Set Profile Search Criteria"); 00660 menuItems.Add("delete", "Delete Profile"); 00661 00662 while (ui.DrawMenu(header + "Select an item:", menuItems, true, out selectedItem)) 00663 { 00664 if (selectedItem == "delete") 00665 { 00666 string confirm = ui.Draw("Are you sure you want to delete this profile? (type \"YES\")"); 00667 if (confirm.ToLower() == "yes") 00668 { 00669 data.Remove(profile); 00670 break; 00671 } 00672 } 00673 else if (selectedItem == "details") 00674 { 00675 ShowProfileDetails(profile); 00676 } 00677 else if (selectedItem == "find") 00678 { 00679 ShowMatchingSales(profile); 00680 } 00681 } 00682 }
void HouseOver.THARM.RealtyManager.ShowMatchingSales | ( | Customer | c | ) | [private] |
Show all sales that matches a Customers Profiles.
c | A Customer |
Definition at line 687 of file RealtyManager.cs.
00688 { 00689 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00690 Sale selectedSale; 00691 00692 foreach(Profile profile in data.GetProfiles(c)) 00693 foreach (Sale sale in FindPotentialItems(profile)) 00694 { 00695 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00696 } 00697 while (ui.DrawMenu("Customer (" + c.Name + ") - Matching Sales", menuItems, true, out selectedSale)) 00698 { 00699 ShowSale(selectedSale); 00700 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00701 } 00702 }
void HouseOver.THARM.RealtyManager.ShowMatchingSales | ( | Profile | c | ) | [private] |
Shows all sales that match a single Profile.
c | A Profile |
Definition at line 707 of file RealtyManager.cs.
00708 { 00709 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00710 Sale selectedSale; 00711 00712 foreach (Sale sale in FindPotentialItems(c)) 00713 { 00714 menuItems.Add(sale, sale.Item.GetType().Name + " for " + sale.Price + " at " + sale.PutUpForSale.ToLongDateString()); 00715 } 00716 while (ui.DrawMenu("Customer (" + c.Owner.Name + ") - Matching Sales", menuItems, true, out selectedSale)) 00717 { 00718 ShowSale(selectedSale); 00719 menuItems[selectedSale] = selectedSale.Item.GetType().Name + " for " + selectedSale.Price + " at " + selectedSale.PutUpForSale.ToLongDateString(); 00720 } 00721 }
void HouseOver.THARM.RealtyManager.ShowProfileDetails | ( | Profile | p | ) | [private] |
Shows details of a Profile, and allows for the details to be changed.
p | A Profile |
Definition at line 726 of file RealtyManager.cs.
References HouseOver.THARM.Profile.Checks, HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Profile.MaxPrice, HouseOver.THARM.Search.ComparableCheck.MaxValue, HouseOver.THARM.Search.ComparableCheck.MinValue, HouseOver.THARM.Customer.Name, HouseOver.THARM.Profile.Owner, and HouseOver.THARM.Search.EnumCheck.Value.
00727 { 00728 object check = null; 00729 00730 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00731 menuItems.Add("price", "Max paying price (" + p.MaxPrice + ")"); 00732 foreach (Check c in p.Checks.Values) 00733 { 00734 ComparableCheck comparableCheck = c as ComparableCheck; 00735 EnumCheck enumCheck = c as EnumCheck; 00736 00737 if (comparableCheck != null && comparableCheck.MinValue != null && comparableCheck.MaxValue != null && comparableCheck.FieldRequired) 00738 { 00739 menuItems.Add(c, comparableCheck.HumanReadableName + " (" + comparableCheck.MinValue + "-" + comparableCheck.MaxValue + ")"); 00740 } 00741 else if (enumCheck != null && enumCheck.FieldRequired) 00742 { 00743 menuItems.Add(c, enumCheck.HumanReadableName + " (" + enumCheck.Value + ")"); 00744 } 00745 else 00746 menuItems.Add(c, c.HumanReadableName); 00747 } 00748 00749 while (ui.DrawMenu("Customer (" + p.Owner.Name + ") - Profile Details (" + p.Item.Name + ")" + System.Environment.NewLine + System.Environment.NewLine + " Select a criteria to set your preference:", menuItems, true, out check)) 00750 { 00751 Check cc; 00752 if ((cc = check as ComparableCheck) != null) 00753 { 00754 SetComparableCheck(p, (ComparableCheck)check); 00755 menuItems[check] = cc.FieldRequired ? cc.HumanReadableName + " (" + ((ComparableCheck)cc).MinValue + "-" + ((ComparableCheck)cc).MaxValue + ")" : cc.HumanReadableName; 00756 } 00757 else if ((cc = check as EnumCheck) != null) 00758 { 00759 SetEnumCheck(p, (EnumCheck)check); 00760 menuItems[check] = cc.FieldRequired ? cc.HumanReadableName + " (" + ((EnumCheck)check).Value + ")" : cc.HumanReadableName; 00761 } 00762 else if (check is string && check.ToString() == "price") 00763 { 00764 p.MaxPrice = ui.DrawInt("Customer ({0}) - Profile ({1}) - Max paying price" + System.Environment.NewLine + System.Environment.NewLine + " Enter maximum paying price:", p.Owner.Name, p.Item.Name); 00765 menuItems["price"] = "Max paying price (" + p.MaxPrice + ")"; 00766 } 00767 } 00768 }
void HouseOver.THARM.RealtyManager.SetComparableCheck | ( | Profile | p, | |
ComparableCheck | check | |||
) | [private] |
Shows a screen that sets the minimum and maximum values of a ComparableCheck.
p | The check's Profile | |
check | A Check |
Definition at line 775 of file RealtyManager.cs.
References HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Search.ComparableCheck.MaxValue, HouseOver.THARM.Search.ComparableCheck.MinValue, HouseOver.THARM.Customer.Name, and HouseOver.THARM.Profile.Owner.
00776 { 00777 string s = ui.Draw("Customer ({0}) - Profile ({1}) - Check ({2})" + System.Environment.NewLine + System.Environment.NewLine + " Enter minimum value (if empty, this criteria is ignored):", p.Owner.Name, p.Item.Name, check.HumanReadableName); 00778 if (!string.IsNullOrEmpty(s)) 00779 { 00780 check.MinValue = s; 00781 check.MaxValue = ui.Draw("Customer ({0}) - Profile ({1}) - Check ({2})" + System.Environment.NewLine + System.Environment.NewLine + " Enter maximum value:", p.Owner.Name, p.Item.Name, check.HumanReadableName); 00782 } 00783 else 00784 check.MinValue = null; 00785 if (check.MinValue == null || check.MaxValue == null) 00786 check.FieldRequired = false; 00787 else 00788 check.FieldRequired = true; 00789 }
Shows a menu that allows selection of an enum value for an EnumCheck.
p | The EnumCheck's Profile | |
check | An EnumCheck |
Definition at line 796 of file RealtyManager.cs.
References HouseOver.THARM.Search.Check.FieldRequired, HouseOver.THARM.Search.Check.FieldType, HouseOver.THARM.Search.Check.HumanReadableName, HouseOver.THARM.Profile.Item, HouseOver.THARM.Customer.Name, HouseOver.THARM.Profile.Owner, and HouseOver.THARM.Search.EnumCheck.Value.
00797 { 00798 Dictionary<object, string> menuItems = new Dictionary<object, string>(); 00799 Enum selectedEnum; 00800 00801 foreach (Enum e in Enum.GetValues(check.FieldType)) 00802 { 00803 menuItems.Add(e, e.ToString()); 00804 } 00805 00806 if (ui.DrawMenu("Customer ("+p.Owner.Name+") - Profile ("+p.Item.Name+") - Check ("+check.HumanReadableName+")", menuItems, true, out selectedEnum)) 00807 { 00808 check.Value = selectedEnum; 00809 check.FieldRequired = true; 00810 } else 00811 check.FieldRequired = false; 00812 }
UserInterface HouseOver::THARM.RealtyManager::ui = new UserInterface() [private] |
Definition at line 17 of file RealtyManager.cs.
Definition at line 18 of file RealtyManager.cs.