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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Contact

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

Contact Entity Framework class for Next Generation Network (NGN) entity model.

   1:  using System;
   2:  using System.ComponentModel.DataAnnotations.Schema;
   3:   
   4:  namespace Ia.Ngn.Cl.Model
   5:  {
   6:      ////////////////////////////////////////////////////////////////////////////
   7:   
   8:      /// <summary publish="true">
   9:      /// Contact Entity Framework class for Next Generation Network (NGN) entity model.
  10:      /// </summary>
  11:      /// 
  12:      /// <remarks> 
  13:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  14:      ///
  15:      /// 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
  16:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  17:      ///
  18:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  19:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  20:      /// 
  21:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  22:      /// 
  23:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  24:      /// </remarks> 
  25:      public partial class Contact
  26:      {
  27:          /// <summary/>
  28:          public Contact() { }
  29:   
  30:          /// <summary/>
  31:          public int Id { get; set; }
  32:   
  33:          /// <summary/>
  34:          public string FirstName { get; set; }
  35:   
  36:          /// <summary/>
  37:          public string MiddleName { get; set; }
  38:   
  39:          /// <summary/>
  40:          public string LastName { get; set; }
  41:   
  42:          /// <summary/>
  43:          public string Company { get; set; }
  44:   
  45:          /// <summary/>
  46:          public string Email { get; set; }
  47:   
  48:          /// <summary/>
  49:          public string Phone { get; set; }
  50:   
  51:          /// <summary/>
  52:          public string Address { get; set; }
  53:   
  54:          /// <summary/>
  55:          public int CountryId { get; set; }
  56:   
  57:          /// <summary/>
  58:          public string Url { get; set; }
  59:   
  60:          /// <summary/>
  61:          public bool IsApproved { get; set; }
  62:   
  63:          /// <summary/>
  64:          public string Note { get; set; }
  65:   
  66:          /// <summary/>
  67:          public DateTime Created { get; set; }
  68:   
  69:          /// <summary/>
  70:          public DateTime Updated { get; set; }
  71:   
  72:          /// <summary/>
  73:          public System.Guid UserId { get; set; }
  74:   
  75:          /// <summary/>
  76:          [NotMapped]
  77:          public string FullName
  78:          {
  79:              get
  80:              {
  81:                  string fullName;
  82:   
  83:                  fullName = FirstName + " " + MiddleName + " " + LastName;
  84:   
  85:                  fullName = fullName.Replace("  ", " ");
  86:   
  87:                  return fullName;
  88:              }
  89:          }
  90:   
  91:          /// <summary/>
  92:          [NotMapped]
  93:          public string FirstAndMiddleName
  94:          {
  95:              get
  96:              {
  97:                  string firstAndMiddleName;
  98:   
  99:                  firstAndMiddleName = FirstName + " " + MiddleName;
 100:   
 101:                  firstAndMiddleName = firstAndMiddleName.Replace("  ", " ");
 102:   
 103:                  return firstAndMiddleName;
 104:              }
 105:          }
 106:   
 107:          ////////////////////////////////////////////////////////////////////////////
 108:   
 109:          /// <summary>
 110:          ///
 111:          /// </summary>
 112:          public bool Update(Contact updatedContact)
 113:          {
 114:              // below: this will not update Id, Created
 115:              bool updated;
 116:   
 117:              updated = false;
 118:   
 119:              if (this.Address != updatedContact.Address) { this.Address = updatedContact.Address; updated = true; }
 120:              if (this.Company != updatedContact.Company) { this.Company = updatedContact.Company; updated = true; }
 121:              if (this.CountryId != updatedContact.CountryId) { this.CountryId = updatedContact.CountryId; updated = true; }
 122:              if (this.Email != updatedContact.Email) { this.Email = updatedContact.Email; updated = true; }
 123:              if (this.FirstName != updatedContact.FirstName) { this.FirstName = updatedContact.FirstName; updated = true; }
 124:              if (this.IsApproved != updatedContact.IsApproved) { this.IsApproved = updatedContact.IsApproved; updated = true; }
 125:              if (this.LastName != updatedContact.LastName) { this.LastName = updatedContact.LastName; updated = true; }
 126:              if (this.MiddleName != updatedContact.MiddleName) { this.MiddleName = updatedContact.MiddleName; updated = true; }
 127:              if (this.Note != updatedContact.Note) { this.Note = updatedContact.Note; updated = true; }
 128:              if (this.Phone != updatedContact.Phone) { this.Phone = updatedContact.Phone; updated = true; }
 129:              if (this.Url != updatedContact.Url) { this.Url = updatedContact.Url; updated = true; }
 130:              if (this.UserId != updatedContact.UserId) { this.UserId = updatedContact.UserId; updated = true; }
 131:   
 132:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 133:   
 134:              return updated;
 135:          }
 136:   
 137:          ////////////////////////////////////////////////////////////////////////////
 138:          ////////////////////////////////////////////////////////////////////////////
 139:      }
 140:   
 141:      ////////////////////////////////////////////////////////////////////////////
 142:      ////////////////////////////////////////////////////////////////////////////
 143:  }