)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Report (Ia.Ftn.Cl.Model.Ui)

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

Report support class for Fixed Telecommunications Network (FTN) ui model.

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