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

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.Collections.Generic;
   3:  using System.Data;
   4:  using System.Linq;
   5:  using System.Text;
   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), Integrated 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, List<int> siteIdList)
  43:          {
  44:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  45:   
  46:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Data.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteIdList);
  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 List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(List<Guid> userIdList, int siteId)
  68:          {
  69:              List<int> siteIdList;
  70:   
  71:              if (siteId == 0) siteIdList = new List<int> { };
  72:              else siteIdList = new List<int> { siteId };
  73:   
  74:              return ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteIdList);
  75:          }
  76:   
  77:          ////////////////////////////////////////////////////////////////////////////
  78:          ////////////////////////////////////////////////////////////////////////////
  79:   
  80:          /// <summary>
  81:          ///
  82:          /// </summary>
  83:          public static DataTable ToSimpleTextDataTable(List<Guid> userIdList, int siteId)
  84:          {
  85:              // below:
  86:              DataRow dr;
  87:              DataTable dt;
  88:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  89:   
  90:              dt = new DataTable("");
  91:              dt.Columns.Add("Service");
  92:              dt.Columns.Add("Port");
  93:              dt.Columns.Add("Action");
  94:              dt.Columns.Add("Access/ONT Name");
  95:              dt.Columns.Add("Address");
  96:              dt.Columns.Add("Detail");
  97:              dt.Columns.Add("Note");
  98:              dt.Columns.Add("Contact");
  99:   
 100:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteId);
 101:   
 102:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
 103:              {
 104:                  dr = dt.NewRow();
 105:   
 106:                  dr["Service"] = Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType);
 107:                  dr["Port"] = reportAccessServiceRequest.Port.ToString();
 108:                  dr["Action"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : string.Empty;
 109:                  dr["Access/ONT Name"] = ((reportAccessServiceRequest.Access != null) ? reportAccessServiceRequest.Access.Name : string.Empty);
 110:                  dr["Address"] = ((reportAccessServiceRequest.Access != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address) : string.Empty);
 111:                  dr["Detail"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Detail) : string.Empty;
 112:                  dr["Note"] = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Note) : string.Empty;
 113:                  dr["Contact"] = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact);
 114:   
 115:                  dt.Rows.Add(dr);
 116:              }
 117:   
 118:              return dt;
 119:          }
 120:   
 121:          ////////////////////////////////////////////////////////////////////////////
 122:          ////////////////////////////////////////////////////////////////////////////
 123:   
 124:          /// <summary>
 125:          ///
 126:          /// </summary>
 127:          public static string ToSimpleTextString(List<Guid> userIdList, int siteId)
 128:          {
 129:              StringBuilder sb;
 130:              List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
 131:   
 132:              sb = new StringBuilder();
 133:   
 134:              reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(userIdList, siteId);
 135:   
 136:              foreach (Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest in reportAccessServiceRequestList)
 137:              {
 138:                  sb.AppendLine("Service: " + Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType));
 139:                  sb.AppendLine("Port: " + reportAccessServiceRequest.Port.ToString());
 140:                  sb.AppendLine("Action: " + ((reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : string.Empty));
 141:                  sb.AppendLine("Access/ONT Name: " + ((reportAccessServiceRequest.Access != null) ? reportAccessServiceRequest.Access.Name : string.Empty));
 142:                  sb.AppendLine("Address: " + ((reportAccessServiceRequest.Access != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address) : string.Empty));
 143:                  sb.AppendLine("Detail: " + ((reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Detail) : string.Empty));
 144:                  sb.AppendLine("Note: " + ((reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Note) : string.Empty));
 145:                  sb.AppendLine("Contact: " + Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact));
 146:                  sb.AppendLine(" ");
 147:              }
 148:   
 149:              return sb.ToString();
 150:          }
 151:   
 152:          ////////////////////////////////////////////////////////////////////////////
 153:          ////////////////////////////////////////////////////////////////////////////   
 154:   
 155:      }
 156:   
 157:      ////////////////////////////////////////////////////////////////////////////
 158:      ////////////////////////////////////////////////////////////////////////////   
 159:  }