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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Report

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

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

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.ComponentModel.DataAnnotations.Schema;
   4:  using System.Linq;
   5:   
   6:  namespace Ia.Ngn.Cl.Model
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// Report Entity Framework class for Next Generation Network (NGN) entity model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      public partial class Report
  28:      {
  29:          /// <summary/>
  30:          public Report()
  31:          {
  32:              // this.ReportHistories = new List<ReportHistory>();
  33:          }
  34:   
  35:          /// <summary/>
  36:          public int Id { get; set; }
  37:   
  38:          /// <summary/>
  39:          public string Service { get; set; }
  40:   
  41:          /// <summary/>
  42:          public int ServiceType { get; set; }
  43:   
  44:          /// <summary/>
  45:          public int State { get; set; }
  46:   
  47:          /// <summary/>
  48:          public int Status { get; set; }
  49:   
  50:          /// <summary/>
  51:          public int Category { get; set; }
  52:   
  53:          /// <summary/>
  54:          public int Area { get; set; }
  55:   
  56:          /// <summary/>
  57:          public int Priority { get; set; }
  58:   
  59:          /// <summary/>
  60:          public int Severity { get; set; }
  61:   
  62:          /// <summary/>
  63:          public string Detail { get; set; }
  64:   
  65:          /// <summary/>
  66:          public string Contact { get; set; }
  67:   
  68:          /// <summary/>
  69:          public string Note { get; set; }
  70:   
  71:          /// <summary/>
  72:          public DateTime Created { get; set; }
  73:   
  74:          /// <summary/>
  75:          public DateTime Updated { get; set; }
  76:   
  77:          /// <summary/>
  78:          public System.Guid UserId { get; set; }
  79:   
  80:          /// <summary/>
  81:          public virtual ICollection<ReportHistory> ReportHistories { get; set; }
  82:   
  83:          ////////////////////////////////////////////////////////////////////////////
  84:   
  85:          /// <summary>
  86:          ///
  87:          /// </summary>
  88:          [NotMapped]
  89:          public bool StatusIsOpen
  90:          {
  91:              get
  92:              {
  93:                  return this.Status == (int)Ia.Ngn.Cl.Model.Business.Report.Status.Open;
  94:              }
  95:          }
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:   
  99:          /// <summary>
 100:          ///
 101:          /// </summary>
 102:          [NotMapped]
 103:          public ReportHistory LastReportHistory
 104:          {
 105:              get
 106:              {
 107:                  ReportHistory reportHistory;
 108:   
 109:                  reportHistory = null;
 110:   
 111:                  if (this.ReportHistories != null)
 112:                  {
 113:                      if (this.ReportHistories.Count > 0)
 114:                      {
 115:                          reportHistory = this.ReportHistories.Skip(this.ReportHistories.Count - 1).FirstOrDefault();
 116:                      }
 117:                      else reportHistory = null;
 118:                  }
 119:                  else reportHistory = null;
 120:   
 121:                  return reportHistory;
 122:              }
 123:          }
 124:   
 125:          ////////////////////////////////////////////////////////////////////////////
 126:   
 127:          /// <summary>
 128:          ///
 129:          /// </summary>
 130:          [NotMapped]
 131:          public ReportHistory SecondToLastReportHistory
 132:          {
 133:              get
 134:              {
 135:                  ReportHistory reportHistory;
 136:   
 137:                  reportHistory = null;
 138:   
 139:                  if (this.ReportHistories != null)
 140:                  {
 141:                      if (this.ReportHistories.Count > 1)
 142:                      {
 143:                          reportHistory = this.ReportHistories.Skip(this.ReportHistories.Count - 2).FirstOrDefault();
 144:                      }
 145:                      else reportHistory = null;
 146:                  }
 147:                  else reportHistory = null;
 148:   
 149:                  return reportHistory;
 150:              }
 151:          }
 152:   
 153:          ////////////////////////////////////////////////////////////////////////////
 154:   
 155:          /// <summary>
 156:          ///
 157:          /// </summary>
 158:          public bool UpdateMigrated(Report updatedReport)
 159:          {
 160:              // below: this will not update Id, Created
 161:              bool updated;
 162:   
 163:              updated = false;
 164:   
 165:              if (this.Area != updatedReport.Area) { this.Area = updatedReport.Area; updated = true; }
 166:              if (this.Category != updatedReport.Category) { this.Category = updatedReport.Category; updated = true; }
 167:              if (this.Contact != updatedReport.Contact) { this.Contact = updatedReport.Contact; updated = true; }
 168:              if (this.Detail != updatedReport.Detail) { this.Detail = updatedReport.Detail; updated = true; }
 169:              if (this.Note != updatedReport.Note) { this.Note = updatedReport.Note; updated = true; }
 170:              if (this.Priority != updatedReport.Priority) { this.Priority = updatedReport.Priority; updated = true; }
 171:              if (this.Service != updatedReport.Service) { this.Service = updatedReport.Service; updated = true; }
 172:   
 173:              if (this.ServiceType != updatedReport.ServiceType) { this.ServiceType = updatedReport.ServiceType; updated = true; }
 174:              if (this.ReportHistories != updatedReport.ReportHistories) { this.ReportHistories = updatedReport.ReportHistories; updated = true; }
 175:              if (this.Severity != updatedReport.Severity) { this.Severity = updatedReport.Severity; updated = true; }
 176:              if (this.State != updatedReport.State) { this.State = updatedReport.State; updated = true; }
 177:              if (this.Status != updatedReport.Status) { this.Status = updatedReport.Status; updated = true; }
 178:   
 179:              if (this.UserId != updatedReport.UserId) { this.UserId = updatedReport.UserId; updated = true; }
 180:   
 181:              // below: this is an update of migrated data
 182:              if (this.Created != updatedReport.Created) { this.Created = updatedReport.Created; updated = true; }
 183:              if (this.Updated != updatedReport.Updated) { this.Updated = updatedReport.Updated; updated = true; }
 184:   
 185:              //if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 186:   
 187:              return updated;
 188:          }
 189:   
 190:          ////////////////////////////////////////////////////////////////////////////
 191:          ////////////////////////////////////////////////////////////////////////////
 192:      }
 193:  }