Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
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 DataTable ReadSpecificUserIdAndAreaIdReportWithReportOpenStatusListDataTable(Guid userId, int areaId)
  43:          {
  44:              // below:
  45:              DataRow dr;
  46:              DataTable dt;
  47:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  48:   
  49:              dt = new DataTable("");
  50:              dt.Columns.Add("Service");
  51:              dt.Columns.Add("FlatTermID");
  52:              dt.Columns.Add("Action");
  53:              dt.Columns.Add("Access/ONT Name");
  54:              dt.Columns.Add("Address");
  55:              dt.Columns.Add("Contact");
  56:   
  57:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Data.Report.ReadSpecificUserIdAndAreaIdReportWithReportOpenStatusList(userId, areaId);
  58:   
  59:              reportAccessServiceRequestList = reportAccessServiceRequestList.OrderBy(u => u.Access.AreaId).ThenBy(u => u.Access.Block).ThenBy(u => u.Access.Street).ThenBy(u => u.Access.PremisesOld).ToList();
  60:   
  61:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
  62:              {
  63:                  dr = dt.NewRow();
  64:   
  65:                  try
  66:                  {
  67:                      dr["Service"] = Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType);
  68:                  }
  69:                  catch (Exception)
  70:                  {
  71:   
  72:                  }
  73:   
  74:                  try
  75:                  {
  76:                      dr["FlatTermID"] = reportAccessServiceRequest.FlatTermId.ToString();
  77:                  }
  78:                  catch (Exception)
  79:                  {
  80:   
  81:                  }
  82:   
  83:                  try
  84:                  {
  85:                      dr["Action"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary()[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : "";
  86:                  }
  87:                  catch (Exception)
  88:                  {
  89:   
  90:                  }
  91:   
  92:                  try
  93:                  {
  94:                      dr["Access/ONT Name"] = reportAccessServiceRequest.Access.Name;
  95:                  }
  96:                  catch (Exception)
  97:                  {
  98:   
  99:                  }
 100:   
 101:                  try
 102:                  {
 103:                      dr["Address"] = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address);
 104:                  }
 105:                  catch (Exception)
 106:                  {
 107:   
 108:                  }
 109:   
 110:                  try
 111:                  {
 112:                      dr["Contact"] = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact);
 113:                  }
 114:                  catch (Exception)
 115:                  {
 116:   
 117:                  }
 118:   
 119:                  dt.Rows.Add(dr);
 120:              }
 121:   
 122:              return dt;
 123:          }
 124:   
 125:          ////////////////////////////////////////////////////////////////////////////
 126:          ////////////////////////////////////////////////////////////////////////////
 127:   
 128:          /// <summary>
 129:          ///
 130:          /// </summary>
 131:          public static string ToSimpleTextString(Guid userId, int areaId)
 132:          {
 133:              StringBuilder sb;
 134:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
 135:   
 136:              sb = new StringBuilder();
 137:   
 138:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Data.Report.ReadSpecificUserIdAndAreaIdReportWithReportOpenStatusList(userId, areaId);
 139:   
 140:              reportAccessServiceRequestList = reportAccessServiceRequestList.OrderBy(u => u.Access.AreaId).ThenBy(u => u.Access.Block).ThenBy(u => u.Access.Street).ThenBy(u => u.Access.PremisesOld).ToList();
 141:   
 142:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
 143:              {
 144:                  sb.AppendLine("Service: " + Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType));
 145:                  sb.AppendLine("FlatTermID: " + reportAccessServiceRequest.FlatTermId.ToString());
 146:                  sb.AppendLine("Action: " + ((reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary()[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : ""));
 147:                  sb.AppendLine("Access/ONT Name: " + reportAccessServiceRequest.Access.Name);
 148:                  sb.AppendLine("Address: " + Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address));
 149:                  sb.AppendLine("Contact: " + Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact));
 150:              }
 151:   
 152:              return sb.ToString();
 153:          }
 154:   
 155:          ////////////////////////////////////////////////////////////////////////////
 156:          ////////////////////////////////////////////////////////////////////////////   
 157:   
 158:      }
 159:   
 160:      ////////////////////////////////////////////////////////////////////////////
 161:      ////////////////////////////////////////////////////////////////////////////   
 162:  }