شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Main

Public general use code classes and xml files that we've compiled and used over the years:

General base class for life entities. Make it link through delegates to create and update database objects.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Globalization;
   4:  using System.Xml.Linq;
   5:   
   6:  namespace Ia.Cl.Model.Life
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// General base class for life entities. Make it link through delegates to create and update database objects.
  12:      /// </summary>
  13:      /// <remarks> 
  14:      /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public class Main
  27:      {
  28:          ////////////////////////////////////////////////////////////////////////////
  29:   
  30:          /// <summary>
  31:          ///
  32:          /// </summary>
  33:          public Main() { }
  34:   
  35:          ////////////////////////////////////////////////////////////////////////////
  36:          ////////////////////////////////////////////////////////////////////////////
  37:      }
  38:   
  39:      ////////////////////////////////////////////////////////////////////////////
  40:   
  41:      /// <summary>
  42:      ///
  43:      /// </summary>
  44:      public sealed class Area
  45:      {
  46:          private static TextInfo textInfo;
  47:          private static XDocument countryArea;
  48:   
  49:          /// <summary/>
  50:          public Area() { }
  51:   
  52:          /// <summary/>
  53:          public static List<Area> Initialize(City city)
  54:          {
  55:              countryArea = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\country_area.xml");
  56:              Area area;
  57:              List<Area> areas;
  58:   
  59:              areas = new List<Area>();
  60:   
  61:              textInfo = new CultureInfo("en-US", false).TextInfo;
  62:              // create a TextInfo based on the "en-US" culture.
  63:   
  64:              foreach (XElement xe in countryArea.Descendants("city").Descendants("area"))
  65:              {
  66:                  if (city.XmlId == int.Parse(xe.Parent.Attribute("id").Value))
  67:                  {
  68:                      area = new Area();
  69:   
  70:                      area.City = city;
  71:   
  72:                      area.XmlId = int.Parse(xe.Attribute("id").Value);
  73:   
  74:                      // convert that name to a nice title case format
  75:                      area.Name = xe.Attribute("name").Value;
  76:                      area.Name = textInfo.ToTitleCase(area.Name.ToLower());
  77:   
  78:                      //area.NameInArabic = xe.Attribute("name_ar").Value;
  79:   
  80:                      areas.Add(area);
  81:                  }
  82:              }
  83:   
  84:              return areas;
  85:          }
  86:   
  87:          /// <summary/>
  88:          public int Id { get; set; }
  89:   
  90:          /// <summary/>
  91:          public int XmlId { get; set; }
  92:   
  93:          /// <summary/>
  94:          public string Name { get; set; }
  95:   
  96:          /// <summary/>
  97:          public City City { get; set; }
  98:      }
  99:   
 100:      ////////////////////////////////////////////////////////////////////////////
 101:   
 102:      /// <summary>
 103:      ///
 104:      /// </summary>
 105:      public sealed class City
 106:      {
 107:          private static TextInfo textInfo;
 108:          private static XDocument countryArea;
 109:   
 110:          /// <summary/>
 111:          public City() { }
 112:   
 113:          /// <summary/>
 114:          public static List<City> Initialize(Province province)
 115:          {
 116:              countryArea = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\country_area.xml");
 117:              City city;
 118:              List<City> cities;
 119:   
 120:              cities = new List<City>();
 121:   
 122:              textInfo = new CultureInfo("en-US", false).TextInfo;
 123:              // create a TextInfo based on the "en-US" culture.
 124:   
 125:              foreach (XElement xe in countryArea.Descendants("city"))
 126:              {
 127:                  if (province.XmlId == int.Parse(xe.Parent.Attribute("id").Value))
 128:                  {
 129:                      city = new City();
 130:   
 131:                      city.Province = province;
 132:   
 133:                      city.XmlId = int.Parse(xe.Attribute("id").Value);
 134:   
 135:                      // convert that name to a nice title case format
 136:                      city.Name = xe.Attribute("name").Value;
 137:                      city.Name = textInfo.ToTitleCase(city.Name.ToLower());
 138:   
 139:                      //city.NameInArabic = xe.Attribute("name_ar").Value;
 140:   
 141:                      cities.Add(city);
 142:                  }
 143:              }
 144:   
 145:              return cities;
 146:          }
 147:   
 148:          /// <summary/>
 149:          public int Id { get; set; }
 150:   
 151:          /// <summary/>
 152:          public int XmlId { get; set; }
 153:   
 154:          /// <summary/>
 155:          public string Name { get; set; }
 156:   
 157:          /// <summary/>
 158:          public Province Province { get; set; }
 159:      }
 160:   
 161:      ////////////////////////////////////////////////////////////////////////////
 162:   
 163:      /// <summary>
 164:      ///
 165:      /// </summary>
 166:      public sealed class Province
 167:      {
 168:          private static TextInfo textInfo;
 169:          private static XDocument countryArea;
 170:   
 171:          /// <summary/>
 172:          public Province() { }
 173:   
 174:          /// <summary/>
 175:          public static List<Province> Initialize(Country country)
 176:          {
 177:              countryArea = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\country_area.xml");
 178:              Province province;
 179:              List<Province> provinces;
 180:   
 181:              provinces = new List<Province>();
 182:   
 183:              textInfo = new CultureInfo("en-US", false).TextInfo;
 184:              // create a TextInfo based on the "en-US" culture.
 185:   
 186:              foreach (XElement xe in countryArea.Descendants("province"))
 187:              {
 188:                  if (country.XmlId == int.Parse(xe.Parent.Attribute("id").Value))
 189:                  {
 190:                      province = new Province();
 191:   
 192:                      province.Country = country;
 193:   
 194:                      province.XmlId = int.Parse(xe.Attribute("id").Value);
 195:   
 196:                      // convert that name to a nice title case format
 197:                      province.Name = xe.Attribute("name").Value;
 198:                      province.Name = textInfo.ToTitleCase(province.Name.ToLower());
 199:   
 200:                      //province.NameInArabic = xe.Attribute("name_ar").Value;
 201:   
 202:                      provinces.Add(province);
 203:                  }
 204:              }
 205:   
 206:              return provinces;
 207:          }
 208:   
 209:          /// <summary/>
 210:          public int Id { get; set; }
 211:   
 212:          /// <summary/>
 213:          public int XmlId { get; set; }
 214:   
 215:          /// <summary/>
 216:          public string Name { get; set; }
 217:   
 218:          /// <summary/>
 219:          public Country Country { get; set; }
 220:      }
 221:   
 222:      ////////////////////////////////////////////////////////////////////////////
 223:   
 224:      /// <summary>
 225:      ///
 226:      /// </summary>
 227:      public sealed class Country
 228:      {
 229:          private static TextInfo textInfo;
 230:          private static XDocument countryArea;
 231:   
 232:          /// <summary/>
 233:          public Country() { }
 234:   
 235:          /// <summary/>
 236:          public static List<Country> Initialize()
 237:          {
 238:              countryArea = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\country_area.xml");
 239:              Country country;
 240:              List<Country> countries;
 241:   
 242:              countries = new List<Country>();
 243:   
 244:              textInfo = new CultureInfo("en-US", false).TextInfo;
 245:              // create a TextInfo based on the "en-US" culture.
 246:   
 247:              foreach (XElement xe in countryArea.Descendants("country"))
 248:              {
 249:                  country = new Country();
 250:   
 251:                  country.XmlId = int.Parse(xe.Attribute("id").Value);
 252:   
 253:                  // convert that name to a nice title case format
 254:                  country.Name = xe.Attribute("name").Value;
 255:                  country.Name = textInfo.ToTitleCase(country.Name.ToLower());
 256:   
 257:                  country.NameInArabic = xe.Attribute("name_ar").Value;
 258:                  country.Iso2 = xe.Attribute("iso2").Value;
 259:                  country.Iso3 = xe.Attribute("iso3").Value;
 260:                  country.Iana = xe.Attribute("iana").Value;
 261:                  country.Un = xe.Attribute("un").Value;
 262:                  country.Ioc = xe.Attribute("ioc").Value;
 263:                  country.Itu = xe.Attribute("itu").Value;
 264:   
 265:                  countries.Add(country);
 266:              }
 267:   
 268:              return countries;
 269:          }
 270:   
 271:          /// <summary/>
 272:          //[System.Data.Linq.Mapping.Column(Name = "Id", IsPrimaryKey = true, IsDbGenerated = false))]
 273:          public int Id { get; set; }
 274:   
 275:          /// <summary/>
 276:          public int XmlId { get; set; }
 277:   
 278:          /// <summary/>
 279:          public string Name { get; set; }
 280:   
 281:          /// <summary/>
 282:          public string NameInArabic { get; set; }
 283:   
 284:          /// <summary/>
 285:          public string Iso2 { get; set; }
 286:   
 287:          /// <summary/>
 288:          public string Iso3 { get; set; }
 289:   
 290:          /// <summary/>
 291:          public string Iana { get; set; }
 292:   
 293:          /// <summary/>
 294:          public string Un { get; set; }
 295:   
 296:          /// <summary/>
 297:          public string Ioc { get; set; }
 298:   
 299:          /// <summary/>
 300:          public string Itu { get; set; }
 301:      }
 302:   
 303:      ////////////////////////////////////////////////////////////////////////////
 304:   
 305:      /// <summary>
 306:      /// Address
 307:      /// </summary>
 308:      public class Address
 309:      {
 310:          // address format varies depending of country
 311:   
 312:          /// <summary/>
 313:          public Address() { }
 314:   
 315:          /// <summary/>
 316:          public int Id { get; set; }
 317:   
 318:          /// <summary/>
 319:          public Country Country { get; set; }
 320:   
 321:          /// <summary/>
 322:          public Province Province { get; set; }
 323:   
 324:          /// <summary/>
 325:          public City City { get; set; }
 326:   
 327:          /// <summary/>
 328:          public Area Area { get; set; }
 329:   
 330:          /// <summary/>
 331:          public string PostalCode { get; set; }
 332:   
 333:          /// <summary/>
 334:          public string Line { get; set; }
 335:      }
 336:   
 337:      ////////////////////////////////////////////////////////////////////////////
 338:   
 339:      /// <summary>
 340:      ///
 341:      /// </summary>
 342:      public class ContactType
 343:      {
 344:          private static XDocument xd;
 345:   
 346:          /// <summary/>
 347:          public ContactType() { }
 348:   
 349:          /// <summary/>
 350:          public static List<ContactType> Initialize()
 351:          {
 352:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 353:              ContactType contactType;
 354:              List<ContactType> contactTypes;
 355:   
 356:              contactTypes = new List<ContactType>();
 357:   
 358:              foreach (XElement xe in xd.Descendants("contact").Descendants("type"))
 359:              {
 360:                  contactType = new ContactType();
 361:   
 362:                  contactType.XmlId = int.Parse(xe.Attribute("id").Value);
 363:   
 364:                  // convert that name to a nice title case format
 365:                  contactType.Name = xe.Attribute("name").Value;
 366:                  contactType.NameInArabic = xe.Attribute("name_ar").Value;
 367:   
 368:                  contactTypes.Add(contactType);
 369:              }
 370:   
 371:              return contactTypes;
 372:          }
 373:   
 374:          /// <summary/>
 375:          public int Id { get; set; }
 376:   
 377:          /// <summary/>
 378:          public int XmlId { get; set; }
 379:   
 380:          /// <summary/>
 381:          public string Name { get; set; }
 382:   
 383:          /// <summary/>
 384:          public string NameInArabic { get; set; }
 385:      }
 386:   
 387:      ////////////////////////////////////////////////////////////////////////////
 388:   
 389:      /// <summary>
 390:      ///
 391:      /// </summary>
 392:      public class CorrespondenceType
 393:      {
 394:          private static XDocument xd;
 395:   
 396:          /// <summary/>
 397:          public CorrespondenceType() { }
 398:   
 399:          /// <summary/>
 400:          public static List<CorrespondenceType> Initialize()
 401:          {
 402:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 403:              CorrespondenceType correspondenceType;
 404:              List<CorrespondenceType> correspondenceTypes;
 405:   
 406:              correspondenceTypes = new List<CorrespondenceType>();
 407:   
 408:              foreach (XElement xe in xd.Descendants("correspondence").Descendants("type"))
 409:              {
 410:                  correspondenceType = new CorrespondenceType();
 411:   
 412:                  correspondenceType.XmlId = int.Parse(xe.Attribute("id").Value);
 413:   
 414:                  // convert that name to a nice title case format
 415:                  correspondenceType.Name = xe.Attribute("name").Value;
 416:                  correspondenceType.NameInArabic = xe.Attribute("name_ar").Value;
 417:   
 418:                  correspondenceTypes.Add(correspondenceType);
 419:              }
 420:   
 421:              return correspondenceTypes;
 422:          }
 423:   
 424:          /// <summary/>
 425:          public int Id { get; set; }
 426:   
 427:          /// <summary/>
 428:          public int XmlId { get; set; }
 429:   
 430:          /// <summary/>
 431:          public string Name { get; set; }
 432:   
 433:          /// <summary/>
 434:          public string NameInArabic { get; set; }
 435:      }
 436:   
 437:      ////////////////////////////////////////////////////////////////////////////
 438:   
 439:      /// <summary>
 440:      ///
 441:      /// </summary>
 442:      public class CorrespondenceState
 443:      {
 444:          private static XDocument xd;
 445:   
 446:          /// <summary/>
 447:          public CorrespondenceState() { }
 448:   
 449:          /// <summary/>
 450:          public static List<CorrespondenceState> Initialize()
 451:          {
 452:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 453:              CorrespondenceState correspondenceState;
 454:              List<CorrespondenceState> correspondenceStates;
 455:   
 456:              correspondenceStates = new List<CorrespondenceState>();
 457:   
 458:              foreach (XElement xe in xd.Descendants("correspondence").Descendants("state"))
 459:              {
 460:                  correspondenceState = new CorrespondenceState();
 461:   
 462:                  correspondenceState.XmlId = int.Parse(xe.Attribute("id").Value);
 463:   
 464:                  // convert that name to a nice title case format
 465:                  correspondenceState.Name = xe.Attribute("name").Value;
 466:                  correspondenceState.NameInArabic = xe.Attribute("name_ar").Value;
 467:   
 468:                  correspondenceStates.Add(correspondenceState);
 469:              }
 470:   
 471:              return correspondenceStates;
 472:          }
 473:   
 474:          /// <summary/>
 475:          public int Id { get; set; }
 476:   
 477:          /// <summary/>
 478:          public int XmlId { get; set; }
 479:   
 480:          /// <summary/>
 481:          public string Name { get; set; }
 482:   
 483:          /// <summary/>
 484:          public string NameInArabic { get; set; }
 485:      }
 486:   
 487:      ////////////////////////////////////////////////////////////////////////////
 488:   
 489:      /// <summary>
 490:      ///
 491:      /// </summary>
 492:      public class CorrespondenceDirection
 493:      {
 494:          private static XDocument xd;
 495:   
 496:          /// <summary/>
 497:          public CorrespondenceDirection() { }
 498:   
 499:          /// <summary/>
 500:          public static List<CorrespondenceDirection> Initialize()
 501:          {
 502:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 503:              CorrespondenceDirection correspondenceDirection;
 504:              List<CorrespondenceDirection> correspondenceDirections;
 505:   
 506:              correspondenceDirections = new List<CorrespondenceDirection>();
 507:   
 508:              foreach (XElement xe in xd.Descendants("correspondence").Descendants("direction"))
 509:              {
 510:                  correspondenceDirection = new CorrespondenceDirection();
 511:   
 512:                  correspondenceDirection.XmlId = int.Parse(xe.Attribute("id").Value);
 513:   
 514:                  // convert that name to a nice title case format
 515:                  correspondenceDirection.Name = xe.Attribute("name").Value;
 516:                  correspondenceDirection.NameInArabic = xe.Attribute("name_ar").Value;
 517:   
 518:                  correspondenceDirections.Add(correspondenceDirection);
 519:              }
 520:   
 521:              return correspondenceDirections;
 522:          }
 523:   
 524:          /// <summary/>
 525:          public int Id { get; set; }
 526:   
 527:          /// <summary/>
 528:          public int XmlId { get; set; }
 529:   
 530:          /// <summary/>
 531:          public string Name { get; set; }
 532:   
 533:          /// <summary/>
 534:          public string NameInArabic { get; set; }
 535:      }
 536:   
 537:      ////////////////////////////////////////////////////////////////////////////
 538:   
 539:      /// <summary>
 540:      ///
 541:      /// </summary>
 542:      public class Correspondence
 543:      {
 544:          /// <summary/>
 545:          public Correspondence() { }
 546:   
 547:          /// <summary/>
 548:          public int Id { get; set; }
 549:   
 550:          /// <summary/>
 551:          public CorrespondenceType Type { get; set; }
 552:   
 553:          /// <summary/>
 554:          public CorrespondenceState State { get; set; }
 555:   
 556:          /// <summary/>
 557:          public CorrespondenceDirection Direction { get; set; }
 558:   
 559:          /// <summary/>
 560:          public Correspondence CorrespondenceId { get; set; }
 561:   
 562:          //public Contact ContactId { get; set; }
 563:   
 564:          /// <summary/>
 565:          public Advertisement AdvertisementId { get; set; }
 566:   
 567:          /// <summary/>
 568:          public Request RequestId { get; set; }
 569:   
 570:          /// <summary/>
 571:          public string Subject { get; set; }
 572:   
 573:          /// <summary/>
 574:          public string Content { get; set; }
 575:   
 576:          /// <summary/>
 577:          public string Note { get; set; }
 578:   
 579:          /// <summary/>
 580:          public DateTime Created { get; set; }
 581:   
 582:          /// <summary/>
 583:          public DateTime Updated { get; set; }
 584:   
 585:      }
 586:   
 587:      ////////////////////////////////////////////////////////////////////////////
 588:   
 589:      /// <summary>
 590:      ///
 591:      /// </summary>
 592:      public class PropertyType
 593:      {
 594:          private static XDocument xd;
 595:   
 596:          /// <summary/>
 597:          public PropertyType() { }
 598:   
 599:          /// <summary/>
 600:          public static List<PropertyType> Initialize()
 601:          {
 602:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 603:              PropertyType propertyType;
 604:              List<PropertyType> propertyTypes;
 605:   
 606:              propertyTypes = new List<PropertyType>();
 607:   
 608:              foreach (XElement xe in xd.Descendants("property").Descendants("type"))
 609:              {
 610:                  propertyType = new PropertyType();
 611:   
 612:                  propertyType.XmlId = int.Parse(xe.Attribute("id").Value);
 613:   
 614:                  // convert that name to a nice title case format
 615:                  propertyType.Name = xe.Attribute("name").Value;
 616:                  propertyType.NameInArabic = xe.Attribute("name_ar").Value;
 617:   
 618:                  propertyTypes.Add(propertyType);
 619:              }
 620:   
 621:              return propertyTypes;
 622:          }
 623:   
 624:          /// <summary/>
 625:          public int Id { get; set; }
 626:   
 627:          /// <summary/>
 628:          public int XmlId { get; set; }
 629:   
 630:          /// <summary/>
 631:          public string Name { get; set; }
 632:   
 633:          /// <summary/>
 634:          public string NameInArabic { get; set; }
 635:      }
 636:   
 637:      ////////////////////////////////////////////////////////////////////////////
 638:   
 639:      /// <summary>
 640:      ///
 641:      /// </summary>
 642:      public class PropertyState
 643:      {
 644:          private static XDocument xd;
 645:   
 646:          /// <summary/>
 647:          public PropertyState() { }
 648:   
 649:          /// <summary/>
 650:          public static List<PropertyState> Initialize()
 651:          {
 652:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 653:              PropertyState propertyState;
 654:              List<PropertyState> propertyStates;
 655:   
 656:              propertyStates = new List<PropertyState>();
 657:   
 658:              foreach (XElement xe in xd.Descendants("property").Descendants("state"))
 659:              {
 660:                  propertyState = new PropertyState();
 661:   
 662:                  propertyState.XmlId = int.Parse(xe.Attribute("id").Value);
 663:   
 664:                  // convert that name to a nice title case format
 665:                  propertyState.Name = xe.Attribute("name").Value;
 666:                  propertyState.NameInArabic = xe.Attribute("name_ar").Value;
 667:   
 668:                  propertyStates.Add(propertyState);
 669:              }
 670:   
 671:              return propertyStates;
 672:          }
 673:   
 674:          /// <summary/>
 675:          public int Id { get; set; }
 676:   
 677:          /// <summary/>
 678:          public int XmlId { get; set; }
 679:   
 680:          /// <summary/>
 681:          public string Name { get; set; }
 682:   
 683:          /// <summary/>
 684:          public string NameInArabic { get; set; }
 685:      }
 686:   
 687:      ////////////////////////////////////////////////////////////////////////////
 688:   
 689:      /// <summary>
 690:      /// Property
 691:      /// </summary>
 692:      public class Property
 693:      {
 694:          /// <summary/>
 695:          public Property() { }
 696:   
 697:          /// <summary/>
 698:          public int Id { get; set; }
 699:   
 700:          /// <summary/>
 701:          public PropertyType Type { get; set; }
 702:   
 703:          /// <summary/>
 704:          public PropertyState State { get; set; }
 705:   
 706:          /// <summary/>
 707:          public string Name { get; set; }
 708:   
 709:          /// <summary/>
 710:          public Address Address { get; set; }
 711:   
 712:          /// <summary/>
 713:          public string Summary { get; set; }
 714:   
 715:          /// <summary/>
 716:          public string SummaryInArabic { get; set; }
 717:   
 718:          /// <summary/>
 719:          public string Detail { get; set; }
 720:   
 721:          /// <summary/>
 722:          public string DetailInArabic { get; set; }
 723:   
 724:          //public Contact Contact { get; set; }
 725:   
 726:          /// <summary/>
 727:          public bool Approved { get; set; }
 728:   
 729:          /// <summary/>
 730:          public string Note { get; set; }
 731:   
 732:          /// <summary/>
 733:          public DateTime Created { get; set; }
 734:   
 735:          /// <summary/>
 736:          public DateTime Updated { get; set; }
 737:      }
 738:   
 739:      ////////////////////////////////////////////////////////////////////////////
 740:   
 741:      /// <summary>
 742:      ///
 743:      /// </summary>
 744:      public class PriceType
 745:      {
 746:          private static XDocument xd;
 747:   
 748:          /// <summary/>
 749:          public PriceType() { }
 750:   
 751:          /// <summary/>
 752:          public static List<PriceType> Initialize()
 753:          {
 754:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 755:              PriceType priceType;
 756:              List<PriceType> priceTypes;
 757:   
 758:              priceTypes = new List<PriceType>();
 759:   
 760:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("price").Descendants("type"))
 761:              {
 762:                  priceType = new PriceType();
 763:   
 764:                  priceType.XmlId = int.Parse(xe.Attribute("id").Value);
 765:   
 766:                  // convert that name to a nice title case format
 767:                  priceType.Name = xe.Attribute("name").Value;
 768:                  priceType.NameInArabic = xe.Attribute("name_ar").Value;
 769:   
 770:                  priceTypes.Add(priceType);
 771:              }
 772:   
 773:              return priceTypes;
 774:          }
 775:   
 776:          /// <summary/>
 777:          public int Id { get; set; }
 778:   
 779:          /// <summary/>
 780:          public int XmlId { get; set; }
 781:   
 782:          /// <summary/>
 783:          public string Name { get; set; }
 784:   
 785:          /// <summary/>
 786:          public string NameInArabic { get; set; }
 787:      }
 788:   
 789:      ////////////////////////////////////////////////////////////////////////////
 790:   
 791:      /// <summary>
 792:      ///
 793:      /// </summary>
 794:      public class AdvertisementType
 795:      {
 796:          private static XDocument xd;
 797:   
 798:          /// <summary/>
 799:          public AdvertisementType() { }
 800:   
 801:          /// <summary/>
 802:          public static List<AdvertisementType> Initialize()
 803:          {
 804:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 805:              AdvertisementType advertisementType;
 806:              List<AdvertisementType> advertisementTypes;
 807:   
 808:              advertisementTypes = new List<AdvertisementType>();
 809:   
 810:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("type"))
 811:              {
 812:                  advertisementType = new AdvertisementType();
 813:   
 814:                  advertisementType.XmlId = int.Parse(xe.Attribute("id").Value);
 815:   
 816:                  // convert that name to a nice title case format
 817:                  advertisementType.Name = xe.Attribute("name").Value;
 818:                  advertisementType.NameInArabic = xe.Attribute("name_ar").Value;
 819:   
 820:                  advertisementTypes.Add(advertisementType);
 821:              }
 822:   
 823:              return advertisementTypes;
 824:          }
 825:   
 826:          /// <summary/>
 827:          public int Id { get; set; }
 828:   
 829:          /// <summary/>
 830:          public int XmlId { get; set; }
 831:   
 832:          /// <summary/>
 833:          public string Name { get; set; }
 834:   
 835:          /// <summary/>
 836:          public string NameInArabic { get; set; }
 837:      }
 838:   
 839:      ////////////////////////////////////////////////////////////////////////////
 840:   
 841:      /// <summary>
 842:      ///
 843:      /// </summary>
 844:      public class AdvertisementState
 845:      {
 846:          private static XDocument xd;
 847:   
 848:          /// <summary/>
 849:          public AdvertisementState() { }
 850:   
 851:          /// <summary/>
 852:          public static List<AdvertisementState> Initialize()
 853:          {
 854:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 855:              AdvertisementState advertisementState;
 856:              List<AdvertisementState> advertisementStates;
 857:   
 858:              advertisementStates = new List<AdvertisementState>();
 859:   
 860:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("state"))
 861:              {
 862:                  advertisementState = new AdvertisementState();
 863:   
 864:                  advertisementState.XmlId = int.Parse(xe.Attribute("id").Value);
 865:   
 866:                  // convert that name to a nice title case format
 867:                  advertisementState.Name = xe.Attribute("name").Value;
 868:                  advertisementState.NameInArabic = xe.Attribute("name_ar").Value;
 869:   
 870:                  advertisementStates.Add(advertisementState);
 871:              }
 872:   
 873:              return advertisementStates;
 874:          }
 875:   
 876:          /// <summary/>
 877:          public int Id { get; set; }
 878:   
 879:          /// <summary/>
 880:          public int XmlId { get; set; }
 881:   
 882:          /// <summary/>
 883:          public string Name { get; set; }
 884:   
 885:          /// <summary/>
 886:          public string NameInArabic { get; set; }
 887:      }
 888:   
 889:      ////////////////////////////////////////////////////////////////////////////
 890:   
 891:      /// <summary>
 892:      /// Advertisement
 893:      /// </summary>
 894:      public class Advertisement
 895:      {
 896:          /// <summary/>
 897:          public Advertisement() { }
 898:   
 899:          /// <summary/>
 900:          public int Id { get; set; }
 901:   
 902:          /// <summary/>
 903:          public AdvertisementType Type { get; set; }
 904:   
 905:          /// <summary/>
 906:          public AdvertisementState State { get; set; }
 907:   
 908:          /// <summary/>
 909:          public string Name { get; set; }
 910:   
 911:          /// <summary/>
 912:          public Property Property { get; set; }
 913:   
 914:          /// <summary/>
 915:          public Language Language { get; set; }
 916:   
 917:          /// <summary/>
 918:          public string Price { get; set; }
 919:   
 920:          /// <summary/>
 921:          public PriceType PriceType { get; set; }
 922:   
 923:          /// <summary/>
 924:          public string Summary { get; set; }
 925:   
 926:          /// <summary/>
 927:          public string Detail { get; set; }
 928:   
 929:          /// <summary/>
 930:          public bool Approved { get; set; }
 931:   
 932:          /// <summary/>
 933:          public bool Show { get; set; }
 934:   
 935:          /// <summary/>
 936:          public string Note { get; set; }
 937:   
 938:          /// <summary/>
 939:          public string User { get; set; }
 940:   
 941:          /// <summary/>
 942:          public DateTime Created { get; set; }
 943:   
 944:          /// <summary/>
 945:          public DateTime Updated { get; set; }
 946:      }
 947:   
 948:      ////////////////////////////////////////////////////////////////////////////
 949:   
 950:      /// <summary>
 951:      ///
 952:      /// </summary>
 953:      public class RequestType
 954:      {
 955:          private static XDocument xd;
 956:   
 957:          /// <summary/>
 958:          public RequestType() { }
 959:   
 960:          /// <summary/>
 961:          public static List<RequestType> Initialize()
 962:          {
 963:              xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 964:              RequestType requestType;
 965:              List<RequestType> requestTypes;
 966:   
 967:              requestTypes = new List<RequestType>();
 968:   
 969:              foreach (XElement xe in xd.Descendants("property").Descendants("request").Descendants("type"))
 970:              {
 971:                  requestType = new RequestType();
 972:   
 973:                  requestType.XmlId = int.Parse(xe.Attribute("id").Value);
 974:   
 975:                  // convert that name to a nice title case format
 976:                  requestType.Name = xe.Attribute("name").Value;
 977:                  requestType.NameInArabic = xe.Attribute("name_ar").Value;
 978:   
 979:                  requestTypes.Add(requestType);
 980:              }
 981:   
 982:              return requestTypes;
 983:          }
 984:   
 985:          /// <summary/>
 986:          public int Id { get; set; }
 987:   
 988:          /// <summary/>
 989:          public int XmlId { get; set; }
 990:   
 991:          /// <summary/>
 992:          public string Name { get; set; }
 993:   
 994:          /// <summary/>
 995:          public string NameInArabic { get; set; }
 996:      }
 997:   
 998:      ////////////////////////////////////////////////////////////////////////////
 999:   
    /// <summary>
    ///
    /// </summary>
    public class RequestState
    {
        private static XDocument xd;
 
        /// <summary/>
        public RequestState() { }
 
        /// <summary/>
        public static List<RequestState> Initialize()
        {
            xd = XDocument.Load(Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
            RequestState requestState;
            List<RequestState> requestStates;
 
            requestStates = new List<RequestState>();
 
            foreach (XElement xe in xd.Descendants("property").Descendants("request").Descendants("state"))
            {
                requestState = new RequestState();
 
                requestState.XmlId = int.Parse(xe.Attribute("id").Value);
 
                // convert that name to a nice title case format
                requestState.Name = xe.Attribute("name").Value;
                requestState.NameInArabic = xe.Attribute("name_ar").Value;
 
                requestStates.Add(requestState);
            }
 
            return requestStates;
        }
 
        /// <summary/>
        public int Id { get; set; }
 
        /// <summary/>
        public int XmlId { get; set; }
 
        /// <summary/>
        public string Name { get; set; }
 
        /// <summary/>
        public string NameInArabic { get; set; }
    }
 
    ////////////////////////////////////////////////////////////////////////////
 
    /// <summary>
    /// Request
    /// </summary>
    public class Request
    {
        /// <summary/>
        public Request() { }
 
        /// <summary/>
        public int Id { get; set; }
 
        /// <summary/>
        public RequestType Type { get; set; }
 
        /// <summary/>
        public RequestState State { get; set; }
 
        /// <summary/>
        public string Name { get; set; }
 
        /// <summary/>
        public Address Address { get; set; }
 
        /// <summary/>
        public string Summary { get; set; }
 
        /// <summary/>
        public string Detail { get; set; }
 
        /// <summary/>
        public string Price { get; set; }
 
        //public Contact Contact { get; set; }
 
        /// <summary/>
        public bool Approved { get; set; }
 
        /// <summary/>
        public bool Show { get; set; }
 
        /// <summary/>
        public string Note { get; set; }
 
        /// <summary/>
        public string User { get; set; }
 
        /// <summary/>
        public DateTime Created { get; set; }
 
        /// <summary/>
        public DateTime Updated { get; set; }
    }
 
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
 
    #region enum
 
    ////////////////////////////////////////////////////////////////////////////
 
    /// <summary>
    /// O+     A+     B+    AB+     O-     A-     B-    AB-
    /// </summary>
    public enum Blood
    {
        /// <summary/>
        O_positive = 1,
 
        /// <summary/>
        A_positive = 2,
 
        /// <summary/>
        B_positive = 3,
 
        /// <summary/>
        AB_positive = 4,
 
        /// <summary/>
        O_negative = 5,
 
        /// <summary/>
        A_negative = 6,
 
        /// <summary/>
        B_negative = 7,
 
        /// <summary/>
        AB_negative = 8
    }
 
    ////////////////////////////////////////////////////////////////////////////
 
    /// <summary>
    ///
    /// </summary>
    public enum Social_State
    {
        /// <summary/>
        Single = 1,
 
        /// <summary/>
        Married = 2
    }
 
    ////////////////////////////////////////////////////////////////////////////
 
    /// <summary>
    ///
    /// </summary>
    public enum Educational_State
    {
        /// <summary/>
        High_School = 9,
 
        /// <summary/>
        University = 10
    }
 
    ////////////////////////////////////////////////////////////////////////////
 
    /// <summary>
    ///
    /// </summary>
    public enum Passport_Type
    {
        /// <summary/>
        Standard = 1,
 
        /// <summary/>
        Diplomatic = 2
    }
 
    #endregion
 
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
}