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