)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
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:     /// </remarks> 
   15:     public static class Index
   16:     {
   17:         ////////////////////////////////////////////////////////////////////////////
   18:  
   19:         /// <summary>
   20:         ///
   21:         /// </summary>
   22:         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)
   23:         {
   24:             int withinLastNMinute = 30;
   25:  
   26:             systemMonitorPanelVisible = false;
   27:             licPanelVisible = false;
   28:             reportPanelVisible = false;
   29:  
   30:             alertPanelVisible = false;
   31:  
   32:             text = string.Empty;
   33:             systemMonitorPanelVisible = false;
   34:  
   35:             licText = string.Empty;
   36:             staffName2Text = string.Empty;
   37:             licPanelVisible = false;
   38:  
   39:             systemMonitorAlertPanelVisible = false;
   40:             licAlertPanelVisible = false;
   41:             reportAlertPanelVisible = false;
   42:  
   43:             staffNameText = string.Empty;
   44:  
   45:             if (staffIdentityUser != null)
   46:             {
   47:                 systemMonitorPanelVisible = false;
   48:                 licPanelVisible = false;
   49:                 reportPanelVisible = false;
   50:  
   51:                 alertPanelVisible = false;
   52:  
   53:                 if (name == "systemMonitor")
   54:                 {
   55:                     SystemMonitor(withinLastNMinute, out text, out systemMonitorPanelVisible);
   56:                 }
   57:                 else if (name == "lic")
   58:                 {
   59:                     Lic(staffIdentityUser, out licText, out staffName2Text, out licPanelVisible);
   60:                 }
   61:                 else if (name == "report")
   62:                 {
   63:                     staffNameText = staffIdentityUser.FullName;
   64:                     reportPanelVisible = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityReport(staffIdentityUser);
   65:                 }
   66:                 else if (name == "alertPanel")
   67:                 {
   68:                     var dictionary = Ia.Ftn.Wa.Models.Business.Default.HeartbeatAssemblyNameToCreatedDateTimeDictionary;
   69:                     var s = Ia.Ftn.Cl.Models.Business.Heartbeat.MissingOrInactiveWithinLastNMinuteApplicationNameListText(dictionary, withinLastNMinute);
   70:                     var has1 = !string.IsNullOrEmpty(s);
   71:  
   72:                     var has2 = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityLic(staffIdentityUser);
   73:  
   74:                     var has3 = Ia.Ftn.Cl.Models.Business.Report.StaffHasResponsibilityReport(staffIdentityUser);
   75:  
   76:                     alertPanelVisible = has1 || has2 || has3;
   77:  
   78:                     systemMonitorAlertPanelVisible = has1;
   79:                     licAlertPanelVisible = has2;
   80:                     reportAlertPanelVisible = has3;
   81:                 }
   82:                 else
   83:                 {
   84:                 }
   85:             }
   86:             else
   87:             {
   88:             }
   89:         }
   90:  
   91:         ////////////////////////////////////////////////////////////////////////////
   92:  
   93:         /// <summary>
   94:         ///
   95:         /// </summary>
   96:         private static void SystemMonitor(int withinLastNMinute, out string text, out bool systemMonitorPanelVisible)
   97:         {
   98:             var dictionary = Ia.Ftn.Wa.Models.Business.Default.HeartbeatAssemblyNameToCreatedDateTimeDictionary;
   99:  
  100:             var s = Ia.Ftn.Cl.Models.Business.Heartbeat.MissingOrInactiveWithinLastNMinuteApplicationNameListText(dictionary, withinLastNMinute);
  101:  
  102:             if (!string.IsNullOrEmpty(s))
  103:             {
  104:                 text = s;
  105:                 systemMonitorPanelVisible = true;
  106:             }
  107:             else
  108:             {
  109:                 text = string.Empty;
  110:                 systemMonitorPanelVisible = false;
  111:             }
  112:         }
  113:  
  114:         ////////////////////////////////////////////////////////////////////////////
  115:  
  116:         /// <summary>
  117:         ///
  118:         /// </summary>
  119:         private static void Lic(Ia.Ftn.Cl.Models.StaffIdentityUser staffIdentityUser, out string licText, out string staffName2Text, out bool licPanelVisible)
  120:         {
  121:             string s;
  122:  
  123:             var list = Ia.Ftn.Cl.Models.Data.Report.LicResponsibilityByStaff(staffIdentityUser);
  124:  
  125:             if (list.Count > 0)
  126:             {
  127:                 list.Sort();
  128:  
  129:                 var stringBuilder = new StringBuilder(list.Count * 32);
  130:  
  131:                 foreach (var service in list)
  132:                 {
  133:                     s = @"<a href=""/maintenance/find?input=" + service + @""">" + service + "</a>";
  134:                     stringBuilder.AppendLine(s);
  135:                 }
  136:  
  137:                 licText = stringBuilder.ToString().Trim();
  138:  
  139:                 staffName2Text = staffIdentityUser.FirstAndMiddleName;
  140:  
  141:                 licPanelVisible = true;
  142:             }
  143:             else
  144:             {
  145:                 licText = staffName2Text = string.Empty;
  146:  
  147:                 licPanelVisible = false;
  148:             }
  149:         }
  150:  
  151:         ////////////////////////////////////////////////////////////////////////////
  152:         ////////////////////////////////////////////////////////////////////////////
  153:     }
  154:  
  155:     ////////////////////////////////////////////////////////////////////////////
  156:     ////////////////////////////////////////////////////////////////////////////
  157: }