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