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

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

Execute backend task support class for the Fixed Telecommunications Network business model

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Data;
    4: using System.Linq;
    5: using System.Text.RegularExpressions;
    6: using System.Web;
    7:  
    8: namespace Ia.Ftn.Cl.Model.Business.Maintenance
    9: {
   10:     ////////////////////////////////////////////////////////////////////////////
   11:  
   12:     /// <summary publish="true">
   13:     /// Execute backend task support class for the Fixed Telecommunications Network business model
   14:     /// </summary>
   15:     /// 
   16:     /// <remarks> 
   17:     /// Copyright © 2019-2021 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 Task
   30:     {
   31:         ////////////////////////////////////////////////////////////////////////////
   32:  
   33:         /// <summary>
   34:         ///
   35:         /// </summary>
   36:         public Task() { }
   37:  
   38:         ////////////////////////////////////////////////////////////////////////////
   39:  
   40:         /// <summary>
   41:         ///
   42:         /// </summary>
   43:         public static void AccessTask(string processItemValue, string accessName, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
   44:         {
   45:             string rawAccessName, input;
   46:  
   47:             result = new Ia.Cl.Models.Result();
   48:  
   49:             if (Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteAccessTasks(staff))
   50:             {
   51:                 if (!string.IsNullOrEmpty(accessName))
   52:                 {
   53:                     rawAccessName = accessName;
   54:  
   55:                     var process = (Ia.Ftn.Cl.Model.Business.Msmq.Process)int.Parse(processItemValue);
   56:  
   57:                     if (!string.IsNullOrEmpty(accessName))
   58:                     {
   59:                         accessName = accessName.Trim();
   60:                         input = accessName.ToUpper();
   61:  
   62:                         if (input.Length > 0)
   63:                         {
   64:                             if (Ia.Ftn.Cl.Model.Business.Access.AccessNameIsInAValidFormat(input))
   65:                             {
   66:                                 var nddOnt = Ia.Ftn.Cl.Model.Business.Default.NddOntUsingExtractedAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
   67:  
   68:                                 if (nddOnt != null)
   69:                                 {
   70:                                     if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.ReadAccess || process == Ia.Ftn.Cl.Model.Business.Msmq.Process.ResetAccess)
   71:                                     {
   72:                                         Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, input);
   73:                                     }
   74:                                     else
   75:                                     {
   76:  
   77:                                     }
   78:  
   79:                                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
   80:                                 }
   81:                                 else
   82:                                 {
   83:                                     result.AddError("The ONT \"" + rawAccessName + "\" does not belong to the network (الجهاز لا ينتمي للشبكة).");
   84:                                 }
   85:                             }
   86:                             else
   87:                             {
   88:                                 result.AddError("Input format is unknown (قيمة غير مفهومة).");
   89:                             }
   90:                         }
   91:                         else result.AddError("No input was entered (لم يتم إدخال أي شيء).");
   92:                     }
   93:                     else result.AddError("Input is null or empty (لم يتم إدخال أي شيء).");
   94:                 }
   95:                 else
   96:                 {
   97:                     //rawInput = null;
   98:                 }
   99:             }
  100:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  101:         }
  102:  
  103:         ////////////////////////////////////////////////////////////////////////////
  104:  
  105:         /// <summary>
  106:         ///
  107:         /// </summary>
  108:         public static void ServiceAccessTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string service, string accessName, bool overrideRouterDomainRestriction, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  109:         {
  110:             string userId;
  111:  
  112:             result = new Ia.Cl.Models.Result();
  113:  
  114:             var port = Ia.Ftn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
  115:  
  116:             if (staff == null || Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  117:             {
  118:                 userId = (staff != null) ? staff.Id : string.Empty;
  119:  
  120:                 if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.CreateReadServiceAccessPort || process == Ia.Ftn.Cl.Model.Business.Msmq.Process.DeleteReadServiceAccess)
  121:                 {
  122:                     Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, service, accessName, port, overrideRouterDomainRestriction, userId);
  123:  
  124:                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  125:                 }
  126:                 else
  127:                 {
  128:                     throw new ArgumentOutOfRangeException("MSMQ process " + process + " is undefined");
  129:                 }
  130:             }
  131:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  132:         }
  133:  
  134:         ////////////////////////////////////////////////////////////////////////////
  135:  
  136:         /// <summary>
  137:         ///
  138:         /// </summary>
  139:         public static void ServiceAccessPortTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string service, string accessName, int port, bool overrideRouterDomainRestriction, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  140:         {
  141:             string userId;
  142:  
  143:             result = new Ia.Cl.Models.Result();
  144:  
  145:             if (staff == null || Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  146:             {
  147:                 userId = (staff != null) ? staff.Id : string.Empty;
  148:  
  149:                 if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.CreateReadServiceAccessPort || process == Ia.Ftn.Cl.Model.Business.Msmq.Process.DeleteReadServiceAccess)
  150:                 {
  151:                     Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, service, accessName, port, overrideRouterDomainRestriction, userId);
  152:  
  153:                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  154:                 }
  155:                 else
  156:                 {
  157:                     throw new ArgumentOutOfRangeException("MSMQ process " + process + " is undefined");
  158:                 }
  159:             }
  160:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  161:         }
  162:  
  163:         ////////////////////////////////////////////////////////////////////////////
  164:  
  165:         /// <summary>
  166:         ///
  167:         /// </summary>
  168:         public static void ServiceAccessPortTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string service, string accessName, int port, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  169:         {
  170:             result = new Ia.Cl.Models.Result();
  171:  
  172:             if (staff == null || Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  173:             {
  174:                 if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.CreateReadNceOrAmsServiceAccessPort || process == Ia.Ftn.Cl.Model.Business.Msmq.Process.DeleteReadNceOrAmsServiceAccessPort)
  175:                 {
  176:                     Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, service, accessName, port);
  177:  
  178:                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  179:                 }
  180:                 else
  181:                 {
  182:                     throw new ArgumentOutOfRangeException("MSMQ process " + process.ToString() + " is undefined");
  183:                 }
  184:             }
  185:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  186:         }
  187:  
  188:         ////////////////////////////////////////////////////////////////////////////
  189:  
  190:         /// <summary>
  191:         ///
  192:         /// </summary>
  193:         public static void ServiceMsanTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string msanDevId, int cabinet, int frame, int fn, int sn, int pn, string service, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  194:         {
  195:             result = new Ia.Cl.Models.Result();
  196:  
  197:             if (Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  198:             {
  199:                 if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.CreateReadNceMsanServiceMsanCabinetFrameFnSnPn)
  200:                 {
  201:                     Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, msanDevId, fn, sn, pn, service);
  202:  
  203:                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  204:                 }
  205:                 else
  206:                 {
  207:                     throw new ArgumentOutOfRangeException("MSMQ process " + process + " is undefined");
  208:                 }
  209:             }
  210:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  211:         }
  212:  
  213:         ////////////////////////////////////////////////////////////////////////////
  214:  
  215:         /// <summary>
  216:         ///
  217:         /// </summary>
  218:         public static void ServiceMsanTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string service, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  219:         {
  220:             result = new Ia.Cl.Models.Result();
  221:  
  222:             if (Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  223:             {
  224:                 if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.DeleteReadNceMsanService)
  225:                 {
  226:                     Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, service);
  227:  
  228:                     result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  229:                 }
  230:                 else
  231:                 {
  232:                     throw new ArgumentOutOfRangeException("MSMQ process " + process.ToString() + " is undefined");
  233:                 }
  234:             }
  235:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  236:         }
  237:  
  238:         ////////////////////////////////////////////////////////////////////////////
  239:  
  240:         /// <summary>
  241:         ///
  242:         /// </summary>
  243:         public static void SupplementaryServiceTask(Ia.Ftn.Cl.Model.Business.Msmq.Process process, string service, string supplementaryServiceItemValue, bool supplementaryServiceState, Ia.Ftn.Cl.Model.Staff staff, out Ia.Cl.Models.Result result)
  244:         {
  245:             string userId;
  246:  
  247:             result = new Ia.Cl.Models.Result();
  248:  
  249:             if (staff == null || Ia.Ftn.Cl.Model.Business.Authority.StaffCanExecuteTasks(staff))
  250:             {
  251:                 userId = (staff != null) ? staff.Id : string.Empty;
  252:  
  253:                 result = new Ia.Cl.Models.Result();
  254:  
  255:                 var supplementaryService = (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService)Enum.Parse(typeof(Ia.Ftn.Cl.Model.Business.Service.SupplementaryService), supplementaryServiceItemValue);
  256:  
  257:                 if (Ia.Ftn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
  258:                 {
  259:                     if (process == Ia.Ftn.Cl.Model.Business.Msmq.Process.UpdateReadServiceSupplementaryService)
  260:                     {
  261:                         Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Model.Business.Msmq.Application.FtnApplication, process, service, supplementaryService, supplementaryServiceState, userId);
  262:  
  263:                         result.AddSuccess("Task Enqueued (تم إرسال المهمة).");
  264:                     }
  265:                     else
  266:                     {
  267:                         throw new ArgumentOutOfRangeException("MSMQ process " + process.ToString() + " is undefined");
  268:                     }
  269:                 }
  270:                 else result.AddError("Input format is unknown (قيمة غير مفهومة).");
  271:             }
  272:             else result.AddError("You are not authorized to execute tasks (لست مخولاً بتنفيذ وظائف).");
  273:         }
  274:  
  275:         ////////////////////////////////////////////////////////////////////////////
  276:         ////////////////////////////////////////////////////////////////////////////   
  277:     }
  278:  
  279:     ////////////////////////////////////////////////////////////////////////////
  280:     ////////////////////////////////////////////////////////////////////////////   
  281: }