)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Individual (Ia.Cl.Models.Life)

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

Individual object.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4:  
    5: namespace Ia.Cl.Models.Life
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Individual object.
   11:     /// </summary>
   12:     /// <remarks> 
   13:     /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated 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:  
   26:     public enum Gender
   27:     {
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         Male = 1,
   34:  
   35:         ////////////////////////////////////////////////////////////////////////////
   36:  
   37:         /// <summary>
   38:         ///
   39:         /// </summary>
   40:         Female = 2,
   41:  
   42:         ////////////////////////////////////////////////////////////////////////////
   43:  
   44:         /// <summary>
   45:         ///
   46:         /// </summary>
   47:         Unknown = 3,
   48:  
   49:         ////////////////////////////////////////////////////////////////////////////
   50:  
   51:         /// <summary>
   52:         ///
   53:         /// </summary>
   54:         PreferNotToSay = 4
   55:  
   56:         ////////////////////////////////////////////////////////////////////////////
   57:         ////////////////////////////////////////////////////////////////////////////
   58:     }
   59:  
   60:     ////////////////////////////////////////////////////////////////////////////
   61:  
   62:     /// <summary>
   63:     ///
   64:     /// </summary>
   65:     public partial class Individual
   66:     {
   67:         //private Social_State social_state;
   68:         //private Educational_State educational_state;
   69:         //private string religion;
   70:         //private Blood blood;
   71:         //private int civil_id_number;
   72:  
   73:         /// <summary/>
   74:         public Individual() { }
   75:  
   76:         /// <summary/>
   77:         public int Id { get; set; }
   78:         /// <summary/>
   79:         public int TypeId { get; set; }
   80:         /// <summary/>
   81:         public int[] LanguageId { get; set; }
   82:         /// <summary/>
   83:         public string FirstName { get; set; }
   84:         /// <summary/>
   85:         public string MiddleName { get; set; }
   86:         /// <summary/>
   87:         public string LastName { get; set; }
   88:         /// <summary/>
   89:         public string Description { get; set; }
   90:         /// <summary/>
   91:         public int? GenderId { get; set; }
   92:         /// <summary/>
   93:         public DateTime? DateOfBirth { get; set; }
   94:         /// <summary/>
   95:         public string Note { get; set; }
   96:         /// <summary/>
   97:         public DateTime Created { get; set; }
   98:         /// <summary/>
   99:         public DateTime Updated { get; set; }
  100:         /// <summary/>
  101:         public DateTime Inspected { get; set; }
  102:         /// <summary/>
  103:         public Guid Guid { get; set; }
  104:  
  105:         ////////////////////////////////////////////////////////////////////////////
  106:  
  107:         /// <summary>
  108:         ///
  109:         /// </summary>
  110:         public static bool Create(Authentication newItem, out string result)
  111:         {
  112:             bool b;
  113:  
  114:             b = false;
  115:             result = "";
  116:  
  117:             using (var db = new Ia.Cl.Models.IaDbContext())
  118:             {
  119:                 //db.Authentications.Add(newItem);
  120:                 //db.SaveChanges();
  121:  
  122:                 b = false; // true;
  123:             }
  124:  
  125:             return b;
  126:         }
  127:  
  128:         ////////////////////////////////////////////////////////////////////////////
  129:  
  130:         /// <summary>
  131:         ///
  132:         /// </summary>
  133:         public static void Create(string password, Uri url, Guid guid)
  134:         {
  135:             bool newItemCreated;
  136:             string result;
  137:             Authentication newItem;
  138:  
  139:             newItem = new Authentication();
  140:  
  141:             // insert new item
  142:             newItem.Password = password;
  143:             newItem.Host = Ia.Cl.Models.Default.BasicHost(url);
  144:             newItem.Created = DateTime.UtcNow.AddHours(3);
  145:  
  146:             newItemCreated = Authentication.Create(newItem, out result);
  147:         }
  148:  
  149:         ////////////////////////////////////////////////////////////////////////////
  150:  
  151:         /// <summary>
  152:         ///
  153:         /// </summary>
  154:         public static bool Validate(string password, Uri url)
  155:         {
  156:             bool validated;
  157:             string host;
  158:             //Authentication item;
  159:  
  160:             host = Ia.Cl.Models.Default.BasicHost(url);
  161:  
  162:             using (var db = new Ia.Cl.Models.IaDbContext())
  163:             {
  164:                 //item = (from q in db.Authentications where q.Password == password && q.Host == host select q).SingleOrDefault();
  165:  
  166:                 validated = false; // (item != null);
  167:             }
  168:  
  169:             return validated;
  170:         }
  171:  
  172:         ////////////////////////////////////////////////////////////////////////////
  173:  
  174:         /// <summary>
  175:         ///
  176:         /// </summary>
  177:         public static Authentication Read(int id)
  178:         {
  179:             Authentication item;
  180:  
  181:             using (var db = new Ia.Cl.Models.IaDbContext())
  182:             {
  183:                 item = null; // (from q in db.Authentications where q.Id == id select q).SingleOrDefault();
  184:             }
  185:  
  186:             return item;
  187:         }
  188:  
  189:         ////////////////////////////////////////////////////////////////////////////
  190:  
  191:         /// <summary>
  192:         ///
  193:         /// </summary>
  194:         public static List<Authentication> ReadList()
  195:         {
  196:             List<Authentication> list;
  197:  
  198:             using (var db = new Ia.Cl.Models.IaDbContext())
  199:             {
  200:                 list = null; // (from q in db.Authentications select q).ToList();
  201:             }
  202:  
  203:             return list;
  204:         }
  205:  
  206:         ////////////////////////////////////////////////////////////////////////////
  207:  
  208:         /// <summary>
  209:         ///
  210:         /// </summary>
  211:         public static bool Update(Authentication updatedItem, out string result)
  212:         {
  213:             bool b;
  214:  
  215:             b = false;
  216:             result = "";
  217:  
  218:             using (var db = new Ia.Cl.Models.IaDbContext())
  219:             {
  220:                 /*
  221:                 updatedItem = (from q in db.Authentications where q.Id == updatedItem.Id select q).SingleOrDefault();
  222: 
  223:                 updatedItem.Updated = DateTime.UtcNow.AddHours(3);
  224: 
  225:                 db.Authentications.Attach(updatedItem);
  226: 
  227:                 var v = db.Entry(updatedItem);
  228:                 v.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
  229:                 db.SaveChanges();
  230:                 */
  231:  
  232:                 b = false; // true;
  233:             }
  234:  
  235:             return b;
  236:         }
  237:  
  238:         ////////////////////////////////////////////////////////////////////////////
  239:  
  240:         /// <summary>
  241:         ///
  242:         /// </summary>
  243:         public static bool Delete(int id, out string result)
  244:         {
  245:             bool b;
  246:  
  247:             b = false;
  248:             result = "";
  249:  
  250:             using (var db = new Ia.Cl.Models.IaDbContext())
  251:             {
  252:                 /*
  253:                 var v = (from q in db.Authentications where q.Id == id select q).FirstOrDefault();
  254: 
  255:                 db.Authentications.Remove(v);
  256:                 db.SaveChanges();
  257:                 */
  258:  
  259:                 b = false; // true;
  260:             }
  261:  
  262:             return b;
  263:         }
  264:     }
  265:  
  266:     ////////////////////////////////////////////////////////////////////////////
  267:     ////////////////////////////////////////////////////////////////////////////
  268: }