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

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 support class for Next Generation Network (NGN) ui model.

   1:  using System;
   2:  using System.Text;
   3:  using System.Data;
   4:  using System.Collections.Generic;
   5:  using System.Linq;
   6:   
   7:  namespace Ia.Ngn.Cl.Model.Ui
   8:  {
   9:      ////////////////////////////////////////////////////////////////////////////
  10:   
  11:      /// <summary publish="true">
  12:      /// Report support class for Next Generation Network (NGN) ui model.
  13:      /// </summary>
  14:      /// 
  15:      /// <remarks> 
  16:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  17:      ///
  18:      /// 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
  19:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  20:      ///
  21:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  22:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  23:      /// 
  24:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  25:      /// 
  26:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  27:      /// </remarks> 
  28:      public partial class Report
  29:      {
  30:          ////////////////////////////////////////////////////////////////////////////
  31:   
  32:          /// <summary>
  33:          ///
  34:          /// </summary>
  35:          public Report() { }
  36:   
  37:          ////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public static List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(List<Guid> userIdList, int siteId)
  43:          {
  44:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  45:   
  46:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Data.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteId);
  47:   
  48:              if (reportAccessServiceRequestList != null)
  49:              {
  50:                  reportAccessServiceRequestList = (from rasr in reportAccessServiceRequestList
  51:                                                    orderby (rasr.Access != null ? rasr.Access.AreaId : 0), (rasr.Access != null ? rasr.Access.Block : string.Empty), (rasr.Access != null ? rasr.Access.Street : string.Empty), (rasr.Access != null ? rasr.Access.PremisesOld : string.Empty) ascending
  52:                                                    select rasr).ToList();
  53:              }
  54:              else
  55:              {
  56:                  reportAccessServiceRequestList = new List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest>();
  57:              }
  58:   
  59:              return reportAccessServiceRequestList.ToList();
  60:          }
  61:   
  62:          ////////////////////////////////////////////////////////////////////////////
  63:   
  64:          /// <summary>
  65:          ///
  66:          /// </summary>
  67:          public static DataTable ReadSpecificUserIdAndAreaIdReportWithReportOpenStatusListDataTable(List<Guid> userIdList, int siteId)
  68:          {
  69:              // below:
  70:              DataRow dr;
  71:              DataTable dt;
  72:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  73:   
  74:              dt = new DataTable("");
  75:              dt.Columns.Add("Service");
  76:              dt.Columns.Add("FlatTermID");
  77:              dt.Columns.Add("Action");
  78:              dt.Columns.Add("Access/ONT Name");
  79:              dt.Columns.Add("Address");
  80:              dt.Columns.Add("Detail");
  81:              dt.Columns.Add("Note");
  82:              dt.Columns.Add("Contact");
  83:   
  84:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteId);
  85:   
  86:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
  87:              {
  88:                  dr = dt.NewRow();
  89:   
  90:                  try
  91:                  {
  92:                      dr["Service"] = Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType);
  93:                  }
  94:                  catch (Exception)
  95:                  {
  96:   
  97:                  }
  98:   
  99:                  try
 100:                  {
 101:                      dr["FlatTermID"] = reportAccessServiceRequest.FlatTermId.ToString();
 102:                  }
 103:                  catch (Exception)
 104:                  {
 105:   
 106:                  }
 107:   
 108:                  try
 109:                  {
 110:                      dr["Action"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : "";
 111:                  }
 112:                  catch (Exception)
 113:                  {
 114:   
 115:                  }
 116:   
 117:                  try
 118:                  {
 119:                      if (!string.IsNullOrEmpty(reportAccessServiceRequest.Access.Name)) dr["Access/ONT Name"] = reportAccessServiceRequest.Access.Name;
 120:                      //else if (!string.IsNullOrEmpty(reportAccessServiceRequest.Access.Name) dr["Access/ONT Name"] = reportAccessServiceRequest.Access.Name;
 121:                  }
 122:                  catch (Exception)
 123:                  {
 124:   
 125:                  }
 126:   
 127:                  try
 128:                  {
 129:                      dr["Address"] = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address);
 130:                  }
 131:                  catch (Exception)
 132:                  {
 133:   
 134:                  }
 135:   
 136:                  try
 137:                  {
 138:                      dr["Detail"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Detail) : "";
 139:                  }
 140:                  catch (Exception)
 141:                  {
 142:   
 143:                  }
 144:   
 145:                  try
 146:                  {
 147:                      dr["Note"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Note) : "";
 148:                  }
 149:                  catch (Exception)
 150:                  {
 151:   
 152:                  }
 153:   
 154:                  try
 155:                  {
 156:                      dr["Contact"] = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact);
 157:                  }
 158:                  catch (Exception)
 159:                  {
 160:   
 161:                  }
 162:   
 163:                  dt.Rows.Add(dr);
 164:              }
 165:   
 166:              return dt;
 167:          }
 168:   
 169:          ////////////////////////////////////////////////////////////////////////////
 170:          ////////////////////////////////////////////////////////////////////////////
 171:   
 172:          /// <summary>
 173:          ///
 174:          /// </summary>
 175:          public static string ToSimpleTextString(Guid userId, int siteId)
 176:          {
 177:              StringBuilder sb;
 178:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
 179:   
 180:              sb = new StringBuilder();
 181:   
 182:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(new List<Guid>() { userId }, siteId);
 183:   
 184:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
 185:              {
 186:                  sb.AppendLine("Service: " + Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType));
 187:                  sb.AppendLine("FlatTermID: " + reportAccessServiceRequest.FlatTermId.ToString());
 188:                  sb.AppendLine("Action: " + ((reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : ""));
 189:                  sb.AppendLine("Access/ONT Name: " + reportAccessServiceRequest.Access.Name);
 190:                  sb.AppendLine("Address: " + Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address));
 191:                  sb.AppendLine("Contact: " + Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact));
 192:              }
 193:   
 194:              return sb.ToString();
 195:          }
 196:   
 197:          ////////////////////////////////////////////////////////////////////////////
 198:          ////////////////////////////////////////////////////////////////////////////   
 199:   
 200:      }
 201:   
 202:      ////////////////////////////////////////////////////////////////////////////
 203:      ////////////////////////////////////////////////////////////////////////////   
 204:  }