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

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(global::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(global::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(global::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(global::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(global::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(global::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(global::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(global::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:          /// <summary/>
 563:          //public Contact ContactId { get; set; }
 564:   
 565:          /// <summary/>
 566:          public Advertisement AdvertisementId { get; set; }
 567:   
 568:          /// <summary/>
 569:          public Request RequestId { get; set; }
 570:   
 571:          /// <summary/>
 572:          public string Subject { get; set; }
 573:   
 574:          /// <summary/>
 575:          public string Content { get; set; }
 576:   
 577:          /// <summary/>
 578:          public string Note { get; set; }
 579:   
 580:          /// <summary/>
 581:          public DateTime Created { get; set; }
 582:   
 583:          /// <summary/>
 584:          public DateTime Updated { get; set; }
 585:   
 586:      }
 587:   
 588:      ////////////////////////////////////////////////////////////////////////////
 589:   
 590:      /// <summary>
 591:      ///
 592:      /// </summary>
 593:      public class PropertyType
 594:      {
 595:          private static XDocument xd;
 596:   
 597:          /// <summary/>
 598:          public PropertyType() { }
 599:   
 600:          /// <summary/>
 601:          public static List<PropertyType> Initialize()
 602:          {
 603:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 604:              PropertyType propertyType;
 605:              List<PropertyType> propertyTypes;
 606:   
 607:              propertyTypes = new List<PropertyType>();
 608:   
 609:              foreach (XElement xe in xd.Descendants("property").Descendants("type"))
 610:              {
 611:                  propertyType = new PropertyType();
 612:   
 613:                  propertyType.XmlId = int.Parse(xe.Attribute("id").Value);
 614:   
 615:                  // convert that name to a nice title case format
 616:                  propertyType.Name = xe.Attribute("name").Value;
 617:                  propertyType.NameInArabic = xe.Attribute("name_ar").Value;
 618:   
 619:                  propertyTypes.Add(propertyType);
 620:              }
 621:   
 622:              return propertyTypes;
 623:          }
 624:   
 625:          /// <summary/>
 626:          public int Id { get; set; }
 627:   
 628:          /// <summary/>
 629:          public int XmlId { get; set; }
 630:   
 631:          /// <summary/>
 632:          public string Name { get; set; }
 633:   
 634:          /// <summary/>
 635:          public string NameInArabic { get; set; }
 636:      }
 637:   
 638:      ////////////////////////////////////////////////////////////////////////////
 639:   
 640:      /// <summary>
 641:      ///
 642:      /// </summary>
 643:      public class PropertyState
 644:      {
 645:          private static XDocument xd;
 646:   
 647:          /// <summary/>
 648:          public PropertyState() { }
 649:   
 650:          /// <summary/>
 651:          public static List<PropertyState> Initialize()
 652:          {
 653:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 654:              PropertyState propertyState;
 655:              List<PropertyState> propertyStates;
 656:   
 657:              propertyStates = new List<PropertyState>();
 658:   
 659:              foreach (XElement xe in xd.Descendants("property").Descendants("state"))
 660:              {
 661:                  propertyState = new PropertyState();
 662:   
 663:                  propertyState.XmlId = int.Parse(xe.Attribute("id").Value);
 664:   
 665:                  // convert that name to a nice title case format
 666:                  propertyState.Name = xe.Attribute("name").Value;
 667:                  propertyState.NameInArabic = xe.Attribute("name_ar").Value;
 668:   
 669:                  propertyStates.Add(propertyState);
 670:              }
 671:   
 672:              return propertyStates;
 673:          }
 674:   
 675:          /// <summary/>
 676:          public int Id { get; set; }
 677:   
 678:          /// <summary/>
 679:          public int XmlId { get; set; }
 680:   
 681:          /// <summary/>
 682:          public string Name { get; set; }
 683:   
 684:          /// <summary/>
 685:          public string NameInArabic { get; set; }
 686:      }
 687:   
 688:      ////////////////////////////////////////////////////////////////////////////
 689:   
 690:      /// <summary>
 691:      /// Property
 692:      /// </summary>
 693:      public class Property
 694:      {
 695:          /// <summary/>
 696:          public Property() { }
 697:   
 698:          /// <summary/>
 699:          public int Id { get; set; }
 700:   
 701:          /// <summary/>
 702:          public PropertyType Type { get; set; }
 703:   
 704:          /// <summary/>
 705:          public PropertyState State { get; set; }
 706:   
 707:          /// <summary/>
 708:          public string Name { get; set; }
 709:   
 710:          /// <summary/>
 711:          public Address Address { get; set; }
 712:   
 713:          /// <summary/>
 714:          public string Summary { get; set; }
 715:   
 716:          /// <summary/>
 717:          public string SummaryInArabic { get; set; }
 718:   
 719:          /// <summary/>
 720:          public string Detail { get; set; }
 721:   
 722:          /// <summary/>
 723:          public string DetailInArabic { get; set; }
 724:   
 725:          /// <summary/>
 726:          //public Contact Contact { get; set; }
 727:   
 728:          /// <summary/>
 729:          public bool Approved { get; set; }
 730:   
 731:          /// <summary/>
 732:          public string Note { get; set; }
 733:   
 734:          /// <summary/>
 735:          public DateTime Created { get; set; }
 736:   
 737:          /// <summary/>
 738:          public DateTime Updated { get; set; }
 739:      }
 740:   
 741:      ////////////////////////////////////////////////////////////////////////////
 742:   
 743:      /// <summary>
 744:      ///
 745:      /// </summary>
 746:      public class PriceType
 747:      {
 748:          private static XDocument xd;
 749:   
 750:          /// <summary/>
 751:          public PriceType() { }
 752:   
 753:          /// <summary/>
 754:          public static List<PriceType> Initialize()
 755:          {
 756:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 757:              PriceType priceType;
 758:              List<PriceType> priceTypes;
 759:   
 760:              priceTypes = new List<PriceType>();
 761:   
 762:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("price").Descendants("type"))
 763:              {
 764:                  priceType = new PriceType();
 765:   
 766:                  priceType.XmlId = int.Parse(xe.Attribute("id").Value);
 767:   
 768:                  // convert that name to a nice title case format
 769:                  priceType.Name = xe.Attribute("name").Value;
 770:                  priceType.NameInArabic = xe.Attribute("name_ar").Value;
 771:   
 772:                  priceTypes.Add(priceType);
 773:              }
 774:   
 775:              return priceTypes;
 776:          }
 777:   
 778:          /// <summary/>
 779:          public int Id { get; set; }
 780:   
 781:          /// <summary/>
 782:          public int XmlId { get; set; }
 783:   
 784:          /// <summary/>
 785:          public string Name { get; set; }
 786:   
 787:          /// <summary/>
 788:          public string NameInArabic { get; set; }
 789:      }
 790:   
 791:      ////////////////////////////////////////////////////////////////////////////
 792:   
 793:      /// <summary>
 794:      ///
 795:      /// </summary>
 796:      public class AdvertisementType
 797:      {
 798:          private static XDocument xd;
 799:   
 800:          /// <summary/>
 801:          public AdvertisementType() { }
 802:   
 803:          /// <summary/>
 804:          public static List<AdvertisementType> Initialize()
 805:          {
 806:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 807:              AdvertisementType advertisementType;
 808:              List<AdvertisementType> advertisementTypes;
 809:   
 810:              advertisementTypes = new List<AdvertisementType>();
 811:   
 812:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("type"))
 813:              {
 814:                  advertisementType = new AdvertisementType();
 815:   
 816:                  advertisementType.XmlId = int.Parse(xe.Attribute("id").Value);
 817:   
 818:                  // convert that name to a nice title case format
 819:                  advertisementType.Name = xe.Attribute("name").Value;
 820:                  advertisementType.NameInArabic = xe.Attribute("name_ar").Value;
 821:   
 822:                  advertisementTypes.Add(advertisementType);
 823:              }
 824:   
 825:              return advertisementTypes;
 826:          }
 827:   
 828:          /// <summary/>
 829:          public int Id { get; set; }
 830:   
 831:          /// <summary/>
 832:          public int XmlId { get; set; }
 833:   
 834:          /// <summary/>
 835:          public string Name { get; set; }
 836:   
 837:          /// <summary/>
 838:          public string NameInArabic { get; set; }
 839:      }
 840:   
 841:      ////////////////////////////////////////////////////////////////////////////
 842:   
 843:      /// <summary>
 844:      ///
 845:      /// </summary>
 846:      public class AdvertisementState
 847:      {
 848:          private static XDocument xd;
 849:   
 850:          /// <summary/>
 851:          public AdvertisementState() { }
 852:   
 853:          /// <summary/>
 854:          public static List<AdvertisementState> Initialize()
 855:          {
 856:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 857:              AdvertisementState advertisementState;
 858:              List<AdvertisementState> advertisementStates;
 859:   
 860:              advertisementStates = new List<AdvertisementState>();
 861:   
 862:              foreach (XElement xe in xd.Descendants("property").Descendants("advertisement").Descendants("state"))
 863:              {
 864:                  advertisementState = new AdvertisementState();
 865:   
 866:                  advertisementState.XmlId = int.Parse(xe.Attribute("id").Value);
 867:   
 868:                  // convert that name to a nice title case format
 869:                  advertisementState.Name = xe.Attribute("name").Value;
 870:                  advertisementState.NameInArabic = xe.Attribute("name_ar").Value;
 871:   
 872:                  advertisementStates.Add(advertisementState);
 873:              }
 874:   
 875:              return advertisementStates;
 876:          }
 877:   
 878:          /// <summary/>
 879:          public int Id { get; set; }
 880:   
 881:          /// <summary/>
 882:          public int XmlId { get; set; }
 883:   
 884:          /// <summary/>
 885:          public string Name { get; set; }
 886:   
 887:          /// <summary/>
 888:          public string NameInArabic { get; set; }
 889:      }
 890:   
 891:      ////////////////////////////////////////////////////////////////////////////
 892:   
 893:      /// <summary>
 894:      /// Advertisement
 895:      /// </summary>
 896:      public class Advertisement
 897:      {
 898:          /// <summary/>
 899:          public Advertisement() { }
 900:   
 901:          /// <summary/>
 902:          public int Id { get; set; }
 903:   
 904:          /// <summary/>
 905:          public AdvertisementType Type { get; set; }
 906:   
 907:          /// <summary/>
 908:          public AdvertisementState State { get; set; }
 909:   
 910:          /// <summary/>
 911:          public string Name { get; set; }
 912:   
 913:          /// <summary/>
 914:          public Property Property { get; set; }
 915:   
 916:          /// <summary/>
 917:          public Language Language { get; set; }
 918:   
 919:          /// <summary/>
 920:          public string Price { get; set; }
 921:   
 922:          /// <summary/>
 923:          public PriceType PriceType { get; set; }
 924:   
 925:          /// <summary/>
 926:          public string Summary { get; set; }
 927:   
 928:          /// <summary/>
 929:          public string Detail { get; set; }
 930:   
 931:          /// <summary/>
 932:          public bool Approved { get; set; }
 933:   
 934:          /// <summary/>
 935:          public bool Show { get; set; }
 936:   
 937:          /// <summary/>
 938:          public string Note { get; set; }
 939:   
 940:          /// <summary/>
 941:          public string User { get; set; }
 942:   
 943:          /// <summary/>
 944:          public DateTime Created { get; set; }
 945:   
 946:          /// <summary/>
 947:          public DateTime Updated { get; set; }
 948:      }
 949:   
 950:      ////////////////////////////////////////////////////////////////////////////
 951:   
 952:      /// <summary>
 953:      ///
 954:      /// </summary>
 955:      public class RequestType
 956:      {
 957:          private static XDocument xd;
 958:   
 959:          /// <summary/>
 960:          public RequestType() { }
 961:   
 962:          /// <summary/>
 963:          public static List<RequestType> Initialize()
 964:          {
 965:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
 966:              RequestType requestType;
 967:              List<RequestType> requestTypes;
 968:   
 969:              requestTypes = new List<RequestType>();
 970:   
 971:              foreach (XElement xe in xd.Descendants("property").Descendants("request").Descendants("type"))
 972:              {
 973:                  requestType = new RequestType();
 974:   
 975:                  requestType.XmlId = int.Parse(xe.Attribute("id").Value);
 976:   
 977:                  // convert that name to a nice title case format
 978:                  requestType.Name = xe.Attribute("name").Value;
 979:                  requestType.NameInArabic = xe.Attribute("name_ar").Value;
 980:   
 981:                  requestTypes.Add(requestType);
 982:              }
 983:   
 984:              return requestTypes;
 985:          }
 986:   
 987:          /// <summary/>
 988:          public int Id { get; set; }
 989:   
 990:          /// <summary/>
 991:          public int XmlId { get; set; }
 992:   
 993:          /// <summary/>
 994:          public string Name { get; set; }
 995:   
 996:          /// <summary/>
 997:          public string NameInArabic { get; set; }
 998:      }
 999:   
1000:      ////////////////////////////////////////////////////////////////////////////
1001:   
1002:      /// <summary>
1003:      ///
1004:      /// </summary>
1005:      public class RequestState
1006:      {
1007:          private static XDocument xd;
1008:   
1009:          /// <summary/>
1010:          public RequestState() { }
1011:   
1012:          /// <summary/>
1013:          public static List<RequestState> Initialize()
1014:          {
1015:              xd = XDocument.Load(global::Ia.Cl.Model.Default.AbsolutePath() + @"app_data\this.xml");
1016:              RequestState requestState;
1017:              List<RequestState> requestStates;
1018:   
1019:              requestStates = new List<RequestState>();
1020:   
1021:              foreach (XElement xe in xd.Descendants("property").Descendants("request").Descendants("state"))
1022:              {
1023:                  requestState = new RequestState();
1024:   
1025:                  requestState.XmlId = int.Parse(xe.Attribute("id").Value);
1026:   
1027:                  // convert that name to a nice title case format
1028:                  requestState.Name = xe.Attribute("name").Value;
1029:                  requestState.NameInArabic = xe.Attribute("name_ar").Value;
1030:   
1031:                  requestStates.Add(requestState);
1032:              }
1033:   
1034:              return requestStates;
1035:          }
1036:   
1037:          /// <summary/>
1038:          public int Id { get; set; }
1039:   
1040:          /// <summary/>
1041:          public int XmlId { get; set; }
1042:   
1043:          /// <summary/>
1044:          public string Name { get; set; }
1045:   
1046:          /// <summary/>
1047:          public string NameInArabic { get; set; }
1048:      }
1049:   
1050:      ////////////////////////////////////////////////////////////////////////////
1051:   
1052:      /// <summary>
1053:      /// Request
1054:      /// </summary>
1055:      public class Request
1056:      {
1057:          /// <summary/>
1058:          public Request() { }
1059:   
1060:          /// <summary/>
1061:          public int Id { get; set; }
1062:   
1063:          /// <summary/>
1064:          public RequestType Type { get; set; }
1065:   
1066:          /// <summary/>
1067:          public RequestState State { get; set; }
1068:   
1069:          /// <summary/>
1070:          public string Name { get; set; }
1071:   
1072:          /// <summary/>
1073:          public Address Address { get; set; }
1074:   
1075:          /// <summary/>
1076:          public string Summary { get; set; }
1077:   
1078:          /// <summary/>
1079:          public string Detail { get; set; }
1080:   
1081:          /// <summary/>
1082:          public string Price { get; set; }
1083:   
1084:          /// <summary/>
1085:          //public Contact Contact { get; set; }
1086:   
1087:          /// <summary/>
1088:          public bool Approved { get; set; }
1089:   
1090:          /// <summary/>
1091:          public bool Show { get; set; }
1092:   
1093:          /// <summary/>
1094:          public string Note { get; set; }
1095:   
1096:          /// <summary/>
1097:          public string User { get; set; }
1098:   
1099:          /// <summary/>
1100:          public DateTime Created { get; set; }
1101:   
1102:          /// <summary/>
1103:          public DateTime Updated { get; set; }
1104:      }
1105:   
1106:      ////////////////////////////////////////////////////////////////////////////
1107:      ////////////////////////////////////////////////////////////////////////////
1108:   
1109:      #region enum
1110:   
1111:      ////////////////////////////////////////////////////////////////////////////
1112:   
1113:      /// <summary>
1114:      /// O+     A+     B+    AB+     O-     A-     B-    AB-
1115:      /// </summary>
1116:      public enum Blood
1117:      {
1118:          /// <summary/>
1119:          O_positive = 1,
1120:   
1121:          /// <summary/>
1122:          A_positive = 2,
1123:   
1124:          /// <summary/>
1125:          B_positive = 3,
1126:   
1127:          /// <summary/>
1128:          AB_positive = 4,
1129:   
1130:          /// <summary/>
1131:          O_negative = 5,
1132:   
1133:          /// <summary/>
1134:          A_negative = 6,
1135:   
1136:          /// <summary/>
1137:          B_negative = 7,
1138:   
1139:          /// <summary/>
1140:          AB_negative = 8
1141:      }
1142:   
1143:      ////////////////////////////////////////////////////////////////////////////
1144:   
1145:      /// <summary>
1146:      ///
1147:      /// </summary>
1148:      public enum Social_State
1149:      {
1150:          /// <summary/>
1151:          Single = 1,
1152:   
1153:          /// <summary/>
1154:          Married = 2
1155:      }
1156:   
1157:      ////////////////////////////////////////////////////////////////////////////
1158:   
1159:      /// <summary>
1160:      ///
1161:      /// </summary>
1162:      public enum Educational_State
1163:      {
1164:          /// <summary/>
1165:          High_School = 9,
1166:   
1167:          /// <summary/>
1168:          University = 10
1169:      }
1170:   
1171:      ////////////////////////////////////////////////////////////////////////////
1172:   
1173:      /// <summary>
1174:      ///
1175:      /// </summary>
1176:      public enum Passport_Type
1177:      {
1178:          /// <summary/>
1179:          Standard = 1,
1180:   
1181:          /// <summary/>
1182:          Diplomatic = 2
1183:      }
1184:   
1185:      #endregion
1186:   
1187:      ////////////////////////////////////////////////////////////////////////////
1188:      ////////////////////////////////////////////////////////////////////////////
1189:  }