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

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

Administration support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.

    1:  
    2: using System.Threading.Tasks;
    3:  
    4: namespace Ia.Ftn.Wa.Models.Business
    5: {
    6:     ////////////////////////////////////////////////////////////////////////////
    7:  
    8:     /// <summary publish="true">
    9:     /// Administration support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.
   10:     /// </summary>
   11:     /// 
   12:     /// <remarks> 
   13:     /// Copyright © 2006-2024 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   14:     /// </remarks> 
   15:     public class Default
   16:     {
   17:         private static readonly string key = "HeartbeatAssemblyNameToCreatedDateTimeDictionary";
   18:  
   19:         /// <summary/>
   20:         public static Dictionary<string, DateTime> HeartbeatAssemblyNameToCreatedDateTimeDictionary
   21:         {
   22:             get
   23:             {
   24:                 var dictionary = (Dictionary<string, DateTime>)Ia.Cl.Models.Cache.Instance.Get(key);
   25:  
   26:                 if (dictionary == null) dictionary = new Dictionary<string, DateTime>();
   27:  
   28:                 return dictionary;
   29:             }
   30:             set
   31:             {
   32:                 Ia.Cl.Models.Cache.Instance.Set(key, value);
   33:             }
   34:         }
   35:  
   36:         ////////////////////////////////////////////////////////////////////////////
   37:  
   38:         /// <summary>
   39:         ///
   40:         /// </summary>
   41:         public Default()
   42:         {
   43:         }
   44:  
   45:         ////////////////////////////////////////////////////////////////////////////
   46:  
   47:         /// <summary>
   48:         ///
   49:         /// </summary>
   50:         public static void ManageEnqueueHeartbeat()
   51:         {
   52:             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.Heartbeat);
   53:         }
   54:  
   55:         ////////////////////////////////////////////////////////////////////////////
   56:  
   57:         /// <summary>
   58:         ///
   59:         /// </summary>
   60:         public static async Task ManageMessageQueue()
   61:         {
   62:             var count = await Ia.Ftn.Cl.Models.Data.MessageQueue.FtnApplication.CountAsync;
   63:  
   64:             if (count > 0)
   65:             {
   66:                 var message = await Ia.Ftn.Cl.Models.Data.MessageQueue.FtnApplication.DequeueAsync;
   67:  
   68:                 if (message != null)
   69:                 {
   70:                     if (message.Process == Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadService)
   71:                     {
   72:  
   73:                     }
   74:                     else if (message.Process == Ia.Ftn.Cl.Models.Business.MessageQueue.Process.Message)
   75:                     {
   76:                         HeartbeatAssemblyNameToCreatedDateTimeDictionary = message.DeserializePayload<Dictionary<string, DateTime>>();
   77:                     }
   78:                     else if (message.Process == Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ActiveApplicationRunningPermissionState)
   79:                     {
   80:                         //Ia.Ftn.Cl.Model.Business.Default.PermitActiveApplicationsToRun = message.State;
   81:  
   82:                         //r.AddSuccess("PermitActiveApplicationsToRun: " + message.State);
   83:                     }
   84:                     else
   85:                     {
   86:                         throw new ArgumentOutOfRangeException("MessageQueue process " + message.Process.ToString() + " is undefined");
   87:                     }
   88:                 }
   89:             }
   90:         }
   91:  
   92:         ////////////////////////////////////////////////////////////////////////////
   93:         ////////////////////////////////////////////////////////////////////////////   
   94:     }
   95:  
   96:     ////////////////////////////////////////////////////////////////////////////
   97:     ////////////////////////////////////////////////////////////////////////////   
   98: }