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

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

    1: using Microsoft.AspNetCore.Identity;
    2: using System.Text;
    3:  
    4: namespace Ia.Ftn.Wa.Models.Alarm
    5: {
    6:     ////////////////////////////////////////////////////////////////////////////
    7:  
    8:     /// <summary publish="true">
    9:     ///
   10:     /// </summary>
   11:     /// 
   12:     /// <remarks> 
   13:     /// Copyright � 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   14:     ///
   15:     /// 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
   16:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   17:     ///
   18:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   19:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   20:     /// 
   21:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   22:     /// 
   23:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   24:     /// </remarks> 
   25:     public static class Index
   26:     {
   27:         ////////////////////////////////////////////////////////////////////////////
   28:  
   29:         /// <summary>
   30:         ///
   31:         /// </summary>
   32:         public static void Process(string name, Ia.Ftn.Cl.Models.StaffIdentityUser staffIdentityUser, out bool systemMonitorPanelVisible, out bool licPanelVisible, out bool reportPanelVisible, out bool alertPanelVisible, out bool systemMonitorAlertPanelVisible, out bool licAlertPanelVisible, out bool reportAlertPanelVisible, out string text, out string licText, out string staffName2Text, out string staffNameText)
   33:         {
   34:             int withinLastNMinute = 30;
   35:  
   36:             systemMonitorPanelVisible = false;
   37:             licPanelVisible = false;
   38:             reportPanelVisible = false;
   39:  
   40:             alertPanelVisible = false;
   41:  
   42:             text = string.Empty;
   43:             systemMonitorPanelVisible = false;
   44:  
   45:             licText = string.Empty;
   46:             staffName2Text = string.Empty;
   47:             licPanelVisible = false;
   48:  
   49:             systemMonitorAlertPanelVisible = false;
   50:             licAlertPanelVisible = false;
   51:             reportAlertPanelVisible = false;
   52:  
   53:             staffNameText = string.Empty;
   54:  
   55:             if (staffIdentityUser != null)
   56:             {
   57:                 systemMonitorPanelVisible = false;
   58:                 licPanelVisible = false;
   59:                 reportPanelVisible = false;
   60:  
   61:                 alertPanelVisible = false;
   62:  
   63:                 if (name == "systemMonitor")
   64:                 {
   65:                     SystemMonitor(withinLastNMinute, out text, out systemMonitorPanelVisible);
   66:                 }
   67:                 else if (name == "lic")
   68:                 {
   69:                     Lic(staffIdentityUser, out licText, out staffName2Text, out licPanelVisible);
   70:                 }
   71:                 else if (name == "report")
   72:                 {
   73:                     staffNameText = staffIdentityUser.FullName;
   74:                     reportPanelVisible = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityReport(staffIdentityUser);
   75:                 }
   76:                 else if (name == "alertPanel")
   77:                 {
   78:                     var dictionary = Ia.Ftn.Wa.Models.Business.Default.HeartbeatAssemblyNameToCreatedDateTimeDictionary;
   79:                     var s = Ia.Ftn.Cl.Models.Business.Heartbeat.MissingOrInactiveWithinLastNMinuteApplicationNameListText(dictionary, withinLastNMinute);
   80:                     var has1 = !string.IsNullOrEmpty(s);
   81:  
   82:                     var has2 = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityLic(staffIdentityUser);
   83:  
   84:                     var has3 = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityReport(staffIdentityUser);
   85:  
   86:                     alertPanelVisible = has1 || has2 || has3;
   87:  
   88:                     systemMonitorAlertPanelVisible = has1;
   89:                     licAlertPanelVisible = has2;
   90:                     reportAlertPanelVisible = has3;
   91:                 }
   92:                 else
   93:                 {
   94:                 }
   95:             }
   96:             else
   97:             {
   98:             }
   99:         }
  100:  
  101:         ////////////////////////////////////////////////////////////////////////////
  102:  
  103:         /// <summary>
  104:         ///
  105:         /// </summary>
  106:         private static void SystemMonitor(int withinLastNMinute, out string text, out bool systemMonitorPanelVisible)
  107:         {
  108:             var dictionary = Ia.Ftn.Wa.Models.Business.Default.HeartbeatAssemblyNameToCreatedDateTimeDictionary;
  109:  
  110:             var s = Ia.Ftn.Cl.Models.Business.Heartbeat.MissingOrInactiveWithinLastNMinuteApplicationNameListText(dictionary, withinLastNMinute);
  111:  
  112:             if (!string.IsNullOrEmpty(s))
  113:             {
  114:                 text = s;
  115:                 systemMonitorPanelVisible = true;
  116:             }
  117:             else
  118:             {
  119:                 text = string.Empty;
  120:                 systemMonitorPanelVisible = false;
  121:             }
  122:         }
  123:  
  124:         ////////////////////////////////////////////////////////////////////////////
  125:  
  126:         /// <summary>
  127:         ///
  128:         /// </summary>
  129:         private static void Lic(Ia.Ftn.Cl.Models.StaffIdentityUser staffIdentityUser, out string licText, out string staffName2Text, out bool licPanelVisible)
  130:         {
  131:             string s;
  132:  
  133:             var list = Ia.Ftn.Cl.Models.Data.Report.LicResponsibilityByStaff(staffIdentityUser);
  134:  
  135:             if (list.Count > 0)
  136:             {
  137:                 list.Sort();
  138:  
  139:                 var stringBuilder = new StringBuilder(list.Count * 32);
  140:  
  141:                 foreach (var service in list)
  142:                 {
  143:                     s = @"<a href=""/maintenance/find?input=" + service + @""">" + service + "</a>";
  144:                     stringBuilder.AppendLine(s);
  145:                 }
  146:  
  147:                 licText = stringBuilder.ToString().Trim();
  148:  
  149:                 staffName2Text = staffIdentityUser.FirstAndMiddleName;
  150:  
  151:                 licPanelVisible = true;
  152:             }
  153:             else
  154:             {
  155:                 licText = staffName2Text = string.Empty;
  156:  
  157:                 licPanelVisible = false;
  158:             }
  159:         }
  160:  
  161:         ////////////////////////////////////////////////////////////////////////////
  162:         ////////////////////////////////////////////////////////////////////////////
  163:     }
  164:  
  165:     ////////////////////////////////////////////////////////////////////////////
  166:     ////////////////////////////////////////////////////////////////////////////
  167: }