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

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

    1: using Microsoft.AspNetCore.Identity;
    2: using Microsoft.AspNetCore.Mvc.Rendering;
    3: using System.Net;
    4:  
    5: namespace Ia.Ftn.Wa.Models.Maintenance
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     ///
   11:     /// </summary>
   12:     /// 
   13:     /// <remarks> 
   14:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   15:     ///
   16:     /// 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
   17:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   18:     ///
   19:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   20:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   21:     /// 
   22:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   23:     /// 
   24:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   25:     /// </remarks> 
   26:     public static class Access
   27:     {
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public static void ViewModel(ref Ia.Ftn.Wa.Models.Maintenance.AccessViewModel accessViewModel, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
   34:         {
   35:             accessViewModel.ButtenEnabled = Ia.Ftn.Cl.Models.Business.Authority.StaffCanExecuteAccessTasks(currentStaffIdentityUser);
   36:  
   37:             var selectList = new List<SelectListItem>();
   38:             selectList.Add(new SelectListItem("Enqueue Reset Access Task (أرسل مهمة إعادة تشغيل جهاز)", ((int)(Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ResetAccess)).ToString()));
   39:             selectList.Add(new SelectListItem("Enqueue Read Access Task (أرسل مهمة قراءة جهاز)", ((int)(Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess)).ToString()));
   40:  
   41:             accessViewModel.AccessTaskSelectList = new SelectList(selectList, "Value", "Text");
   42:         }
   43:  
   44:         ////////////////////////////////////////////////////////////////////////////
   45:  
   46:         /// <summary>
   47:         ///
   48:         /// </summary>
   49:         public static void Post(ref Ia.Ftn.Wa.Models.Maintenance.AccessViewModel accessViewModel, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
   50:         {
   51:             var processId = accessViewModel.AccessTaskSelectedValue;
   52:             var rawInput = WebUtility.HtmlDecode(accessViewModel.TextInput);
   53:  
   54:             var result = new Ia.Cl.Models.Result();
   55:  
   56:             /*
   57:         staff = Ia.Ftn.Cl.Models.Data.Staff.MembershipUser;
   58: 
   59:         if (!IsPostBack)
   60:         {
   61:             // http://ftn/maintenance/access.aspx?accessName=HIT.12.1
   62: 
   63:             textBox.Text = Request.QueryString["accessName"] != null ? Server.HtmlDecode(Request.QueryString["accessName"].ToString()) : string.Empty;
   64: 
   65:             Page_DataBind(sender, e);
   66:         }
   67:         else
   68:         {
   69: 
   70:         }
   71:              */
   72:  
   73:             if (!string.IsNullOrEmpty(rawInput))
   74:             {
   75:                 var input = rawInput.Trim();
   76:  
   77:                 if (Ia.Ftn.Cl.Models.Business.Access.AccessNameIsInAValidFormat(input))
   78:                 {
   79:                     var nddOnt = Ia.Ftn.Cl.Models.Business.Default.NddOntUsingExtractedAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
   80:  
   81:                     if (nddOnt != null)
   82:                     {
   83:                         Ia.Ftn.Cl.Models.Business.Maintenance.Task.AccessTask(processId, nddOnt.Access.Name, currentStaffIdentityUser, out result);
   84:                     }
   85:                     else
   86:                     {
   87:                         result.AddError("The ONT/Access \"" + input + "\" does not belong to the network (الجهاز لا ينتمي للشبكة).");
   88:                     }
   89:                 }
   90:                 else
   91:                 {
   92:                     result.AddError("Input format is unknown (قيمة غير مفهومة).");
   93:                 }
   94:             }
   95:             else
   96:             {
   97:                 result.AddError("No ONT/Access was entered (لم يتم إدخال جهاز).");
   98:             }
   99:  
  100:             accessViewModel.Result = result;
  101:         }
  102:  
  103:         ////////////////////////////////////////////////////////////////////////////
  104:         ////////////////////////////////////////////////////////////////////////////
  105:     }
  106:  
  107:     ////////////////////////////////////////////////////////////////////////////
  108:     ////////////////////////////////////////////////////////////////////////////
  109: }