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

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

    1: using Microsoft.AspNetCore.Authorization;
    2: using Microsoft.AspNetCore.Identity;
    3: using Microsoft.AspNetCore.Mvc;
    4: using System.Diagnostics;
    5: using System.Diagnostics.CodeAnalysis;
    6: using System.Text;
    7:  
    8: namespace Ia.Ftn.Wa.Controllers
    9: {
   10:     ////////////////////////////////////////////////////////////////////////////
   11:  
   12:     /// <summary publish="true">
   13:     ///
   14:     /// </summary>
   15:     /// 
   16:     /// <remarks> 
   17:     /// Copyright � 2006-2025 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:     [Authorize]
   30:     public class ProvisionController : Controller
   31:     {
   32:         private static Ia.Ftn.Wa.Models.Provision.LicViewModel currentLicViewModel = new Ia.Ftn.Wa.Models.Provision.LicViewModel();
   33:         private readonly UserManager<Ia.Ftn.Cl.Models.StaffIdentityUser> userManager;
   34:  
   35:         /////////////////////////////////////////////////////////////////////////////////
   36:  
   37:         /// <summary>
   38:         ///
   39:         /// </summary>
   40:         public ProvisionController(UserManager<Ia.Ftn.Cl.Models.StaffIdentityUser> _userManager)
   41:         {
   42:             userManager = _userManager;
   43:         }
   44:  
   45:         ////////////////////////////////////////////////////////////////////////////
   46:  
   47:         /// <summary>
   48:         ///
   49:         /// </summary>
   50:         public IActionResult Index()
   51:         {
   52:             return View();
   53:         }
   54:  
   55:         ////////////////////////////////////////////////////////////////////////////
   56:         ////////////////////////////////////////////////////////////////////////////
   57:  
   58:         /// <summary>
   59:         ///
   60:         /// </summary>
   61:         [HttpGet]
   62:         public IActionResult Lic()
   63:         {
   64:             var licViewModel = new Ia.Ftn.Wa.Models.Provision.LicViewModel();
   65:  
   66:             licViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
   67:  
   68:             Ia.Ftn.Wa.Models.Provision.Lic.ViewModel(ref currentLicViewModel, ref licViewModel);
   69:  
   70:             return View(licViewModel);
   71:         }
   72:  
   73:         ////////////////////////////////////////////////////////////////////////////
   74:  
   75:         /// <summary>
   76:         ///
   77:         /// </summary>
   78:         [HttpPost]
   79:         public IActionResult Lic(Ia.Ftn.Wa.Models.Provision.LicViewModel licViewModel, string commandName, string inputTextArea)
   80:         {
   81:             licViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
   82:  
   83:             Ia.Ftn.Wa.Models.Provision.Lic.Post(ref licViewModel, commandName, inputTextArea);
   84:  
   85:             Ia.Ftn.Wa.Models.Provision.Lic.ViewModel(ref currentLicViewModel, ref licViewModel);
   86:  
   87:             return View(licViewModel);
   88:         }
   89:  
   90:         ////////////////////////////////////////////////////////////////////////////
   91:         ////////////////////////////////////////////////////////////////////////////
   92:  
   93:         /// <summary>
   94:         ///
   95:         /// </summary>
   96:         [HttpGet]
   97:         public IActionResult List()
   98:         {
   99:             return View();
  100:         }
  101:  
  102:         ////////////////////////////////////////////////////////////////////////////
  103:         ////////////////////////////////////////////////////////////////////////////
  104:  
  105:         /// <summary>
  106:         ///
  107:         /// </summary>
  108:         [HttpGet]
  109:         [Route("provision/new-ont")]
  110:         public IActionResult NewOnt()
  111:         {
  112:  
  113:  
  114:  
  115:  
  116:             return View();
  117:         }
  118:  
  119:         ////////////////////////////////////////////////////////////////////////////
  120:         ////////////////////////////////////////////////////////////////////////////
  121:  
  122:         /// <summary>
  123:         ///
  124:         /// </summary>
  125:         [HttpGet]
  126:         public IActionResult Pbx()
  127:         {
  128:             string s;
  129:  
  130:             var dictionary = Ia.Ftn.Cl.Models.Data.ServiceRequest.PbxServiceKeyToPbxServiceBranchListDictionary();
  131:  
  132:             var stringBuilder = new StringBuilder();
  133:  
  134:             if (dictionary.Count > 0)
  135:             {
  136:                 foreach (var kvp in dictionary)
  137:                 {
  138:                     var key = kvp.Key;
  139:                     var branchList = string.Join(", ", kvp.Value.ToArray().OrderBy(u => u.ToString()));
  140:  
  141:                     s = @"<a href=""/maintenance/find?input=" + key + @""">" + key + "</a>: " + branchList;
  142:  
  143:                     stringBuilder.AppendLine(s + "<br/>");
  144:                 }
  145:             }
  146:             else
  147:             {
  148:                 stringBuilder.AppendLine(@"<label class=""warning"">There are no PBX services in database</label>");
  149:             }
  150:  
  151:             var model = stringBuilder.ToString().Trim();
  152:  
  153:             return View("Pbx", model);
  154:         }
  155:  
  156:         ////////////////////////////////////////////////////////////////////////////
  157:         ////////////////////////////////////////////////////////////////////////////
  158:  
  159:         /// <summary>
  160:         ///
  161:         /// </summary>
  162:         [HttpGet]
  163:         public IActionResult Service()
  164:         {
  165:             var licViewModel = new Ia.Ftn.Wa.Models.Provision.ServiceViewModel();
  166:  
  167:             licViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  168:  
  169:             Ia.Ftn.Wa.Models.Provision.Service.ViewModel(ref licViewModel);
  170:  
  171:             return View(licViewModel);
  172:         }
  173:  
  174:         ////////////////////////////////////////////////////////////////////////////
  175:  
  176:         /// <summary>
  177:         ///
  178:         /// </summary>
  179:         [HttpPost]
  180:         public IActionResult Service(Ia.Ftn.Wa.Models.Provision.ServiceViewModel licViewModel, string commandName, string inputTextArea)
  181:         {
  182:             licViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  183:  
  184:             Ia.Ftn.Wa.Models.Provision.Service.Post(ref licViewModel, commandName);
  185:  
  186:             Ia.Ftn.Wa.Models.Provision.Service.ViewModel(ref licViewModel);
  187:  
  188:             return View(licViewModel);
  189:         }
  190:  
  191:         ////////////////////////////////////////////////////////////////////////////
  192:         ////////////////////////////////////////////////////////////////////////////
  193:  
  194:         /// <summary>
  195:         ///
  196:         /// </summary>
  197:         [HttpGet]
  198:         [Route("provision/service-request")]
  199:         public IActionResult ServiceRequest()
  200:         {
  201:             var serviceRequestViewModel = new Ia.Ftn.Wa.Models.Provision.ServiceRequestViewModel();
  202:  
  203:             var nowDateTime = DateTime.UtcNow.AddHours(3);
  204:  
  205:             serviceRequestViewModel.YearSelectedValue = nowDateTime.Year;
  206:             serviceRequestViewModel.MonthSelectedValue = nowDateTime.Month;
  207:             serviceRequestViewModel.DaySelectedValue = nowDateTime.Day;
  208:  
  209:             Ia.Ftn.Wa.Models.Provision.ServiceRequest.Post(ref serviceRequestViewModel, null);
  210:  
  211:             Ia.Ftn.Wa.Models.Provision.ServiceRequest.ViewModel(ref serviceRequestViewModel);
  212:  
  213:             return View(serviceRequestViewModel);
  214:         }
  215:  
  216:         ////////////////////////////////////////////////////////////////////////////
  217:  
  218:         /// <summary>
  219:         ///
  220:         /// </summary>
  221:         [HttpPost]
  222:         [Route("provision/service-request")]
  223:         public IActionResult ServiceRequest(Ia.Ftn.Wa.Models.Provision.ServiceRequestViewModel serviceRequestViewModel, string commandName)
  224:         {
  225:             Ia.Ftn.Wa.Models.Provision.ServiceRequest.Post(ref serviceRequestViewModel, commandName);
  226:  
  227:             Ia.Ftn.Wa.Models.Provision.ServiceRequest.ViewModel(ref serviceRequestViewModel);
  228:  
  229:             return View(serviceRequestViewModel);
  230:         }
  231:  
  232:         ////////////////////////////////////////////////////////////////////////////
  233:         ////////////////////////////////////////////////////////////////////////////
  234:  
  235:         /// <summary>
  236:         ///
  237:         /// </summary>
  238:         [HttpGet]
  239:         [Route("provision/service-exemption")]
  240:         public IActionResult ServiceExemption()
  241:         {
  242:             var serviceExemptionViewModel = new Ia.Ftn.Wa.Models.Provision.ServiceExemptionViewModel();
  243:  
  244:             serviceExemptionViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  245:  
  246:             Ia.Ftn.Wa.Models.Provision.ServiceExemption.ViewModel(ref serviceExemptionViewModel);
  247:  
  248:             return View(serviceExemptionViewModel);
  249:         }
  250:  
  251:         ////////////////////////////////////////////////////////////////////////////
  252:  
  253:         /// <summary>
  254:         ///
  255:         /// </summary>
  256:         [HttpPost]
  257:         [Route("provision/service-exemption")]
  258:         public IActionResult ServiceExemption(Ia.Ftn.Wa.Models.Provision.ServiceExemptionViewModel serviceExemptionViewModel, string commandName, string serviceExemptionId)
  259:         {
  260:             serviceExemptionViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  261:  
  262:             Ia.Ftn.Wa.Models.Provision.ServiceExemption.Post(ref serviceExemptionViewModel, commandName, serviceExemptionId);
  263:  
  264:             Ia.Ftn.Wa.Models.Provision.ServiceExemption.ViewModel(ref serviceExemptionViewModel);
  265:  
  266:             return View(serviceExemptionViewModel);
  267:         }
  268:  
  269:         ////////////////////////////////////////////////////////////////////////////
  270:         ////////////////////////////////////////////////////////////////////////////
  271:  
  272:         /// <summary>
  273:         ///
  274:         /// </summary>
  275:         [HttpGet]
  276:         [Route("provision/service-request-service-access")]
  277:         public IActionResult ServiceRequestServiceAccess()
  278:         {
  279:             var serviceRequestServiceAccessViewModel = new Ia.Ftn.Wa.Models.Provision.ServiceRequestServiceAccessViewModel();
  280:  
  281:             serviceRequestServiceAccessViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  282:  
  283:             Ia.Ftn.Wa.Models.Provision.ServiceRequestServiceAccess.ViewModel(ref serviceRequestServiceAccessViewModel);
  284:  
  285:             return View(serviceRequestServiceAccessViewModel);
  286:         }
  287:  
  288:         ////////////////////////////////////////////////////////////////////////////
  289:  
  290:         /// <summary>
  291:         ///
  292:         /// </summary>
  293:         [HttpPost]
  294:         [Route("provision/service-request-service-access")]
  295:         public IActionResult ServiceRequestServiceAccess(Ia.Ftn.Wa.Models.Provision.ServiceRequestServiceAccessViewModel serviceRequestServiceAccessViewModel, string commandName, string inputTextArea)
  296:         {
  297:             serviceRequestServiceAccessViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  298:  
  299:             Ia.Ftn.Wa.Models.Provision.ServiceRequestServiceAccess.Post(ref serviceRequestServiceAccessViewModel, commandName);
  300:  
  301:             Ia.Ftn.Wa.Models.Provision.ServiceRequestServiceAccess.ViewModel(ref serviceRequestServiceAccessViewModel);
  302:  
  303:             return View(serviceRequestServiceAccessViewModel);
  304:         }
  305:  
  306:         ////////////////////////////////////////////////////////////////////////////
  307:         ////////////////////////////////////////////////////////////////////////////
  308:  
  309:         /// <summary>
  310:         ///
  311:         /// </summary>
  312:         [HttpGet]
  313:         [Route("provision/access")]
  314:         public IActionResult Access()
  315:         {
  316:             return View("/Views/Provision/Access/Index.cshtml");
  317:         }
  318:  
  319:         ////////////////////////////////////////////////////////////////////////////
  320:         ////////////////////////////////////////////////////////////////////////////
  321:  
  322:         /// <summary>
  323:         ///
  324:         /// </summary>
  325:         [HttpGet]
  326:         [Route("provision/access/manage")]
  327:         public IActionResult AccessManage()
  328:         {
  329:             var manageViewModel = new Ia.Ftn.Wa.Models.Provision.Access.ManageViewModel();
  330:  
  331:             manageViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  332:  
  333:             Ia.Ftn.Wa.Models.Provision.Access.Manage.ViewModel(ref manageViewModel);
  334:  
  335:             return View("/Views/Provision/Access/Manage.cshtml", manageViewModel);
  336:         }
  337:  
  338:         ////////////////////////////////////////////////////////////////////////////
  339:  
  340:         /// <summary>
  341:         ///
  342:         /// </summary>
  343:         [HttpPost]
  344:         [Route("provision/access/manage")]
  345:         public IActionResult AccessManage(Ia.Ftn.Wa.Models.Provision.Access.ManageViewModel manageViewModel, string commandName, string accessId)
  346:         {
  347:             manageViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  348:  
  349:             Ia.Ftn.Wa.Models.Provision.Access.Manage.Post(ref manageViewModel, commandName, accessId);
  350:  
  351:             Ia.Ftn.Wa.Models.Provision.Access.Manage.ViewModel(ref manageViewModel);
  352:  
  353:             return View("/Views/Provision/Access/Manage.cshtml", manageViewModel);
  354:         }
  355:  
  356:         ////////////////////////////////////////////////////////////////////////////
  357:         ////////////////////////////////////////////////////////////////////////////
  358:  
  359:         /// <summary>
  360:         ///
  361:         /// </summary>
  362:         [HttpGet]
  363:         [Route("provision/access/service")]
  364:         public IActionResult AccessService()
  365:         {
  366:             var serviceViewModel = new Ia.Ftn.Wa.Models.Provision.Access.ServiceViewModel();
  367:  
  368:             serviceViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  369:  
  370:             Ia.Ftn.Wa.Models.Provision.Access.Service.ViewModel(ref serviceViewModel);
  371:  
  372:             return View("/Views/Provision/Access/Service.cshtml", serviceViewModel);
  373:         }
  374:  
  375:         ////////////////////////////////////////////////////////////////////////////
  376:  
  377:         /// <summary>
  378:         ///
  379:         /// </summary>
  380:         [HttpPost]
  381:         [Route("provision/access/service")]
  382:         public IActionResult AccessService(Ia.Ftn.Wa.Models.Provision.Access.ServiceViewModel serviceViewModel, string commandName)
  383:         {
  384:             serviceViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  385:  
  386:             Ia.Ftn.Wa.Models.Provision.Access.Service.Post(ref serviceViewModel, commandName);
  387:  
  388:             Ia.Ftn.Wa.Models.Provision.Access.Service.ViewModel(ref serviceViewModel);
  389:  
  390:             return View("/Views/Provision/Access/Service.cshtml", serviceViewModel);
  391:         }
  392:  
  393:         ////////////////////////////////////////////////////////////////////////////
  394:         ////////////////////////////////////////////////////////////////////////////
  395:  
  396:         /// <summary>
  397:         ///
  398:         /// </summary>
  399:         [HttpGet]
  400:         [Route("provision/access/mail")]
  401:         public IActionResult AccessMail()
  402:         {
  403:             var mailViewModel = new Ia.Ftn.Wa.Models.Provision.Access.MailViewModel();
  404:  
  405:             mailViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  406:             mailViewModel.UserManager = userManager;
  407:  
  408:             Ia.Ftn.Wa.Models.Provision.Access.Mail.ViewModel(ref mailViewModel);
  409:  
  410:             return View("/Views/Provision/Access/Mail.cshtml", mailViewModel);
  411:         }
  412:  
  413:         ////////////////////////////////////////////////////////////////////////////
  414:  
  415:         /// <summary>
  416:         ///
  417:         /// </summary>
  418:         [HttpPost]
  419:         [Route("provision/access/mail")]
  420:         public IActionResult AccessMail(Ia.Ftn.Wa.Models.Provision.Access.MailViewModel mailViewModel, string commandName)
  421:         {
  422:             mailViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  423:             mailViewModel.UserManager = userManager;
  424:  
  425:             Ia.Ftn.Wa.Models.Provision.Access.Mail.Post(ref mailViewModel, commandName);
  426:  
  427:             Ia.Ftn.Wa.Models.Provision.Access.Mail.ViewModel(ref mailViewModel);
  428:  
  429:             return View("/Views/Provision/Access/Mail.cshtml", mailViewModel);
  430:         }
  431:  
  432:         ////////////////////////////////////////////////////////////////////////////
  433:         ////////////////////////////////////////////////////////////////////////////
  434:  
  435:         /// <summary>
  436:         ///
  437:         /// </summary>
  438:         [HttpGet]
  439:         [Route("provision/migration")]
  440:         public IActionResult Migration()
  441:         {
  442:             return View("/Views/Provision/Migration/Index.cshtml");
  443:         }
  444:  
  445:         ////////////////////////////////////////////////////////////////////////////
  446:  
  447:         /// <summary>
  448:         ///
  449:         /// </summary>
  450:         [HttpGet]
  451:         [Route("provision/migration/manage")]
  452:         public IActionResult MigrationManage()
  453:         {
  454:             var manageViewModel = new Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel();
  455:  
  456:             manageViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  457:  
  458:             Ia.Ftn.Wa.Models.Provision.Migration.Manage.ViewModel(ref manageViewModel);
  459:  
  460:             return View("/Views/Provision/Migration/Manage.cshtml", manageViewModel);
  461:         }
  462:  
  463:         ////////////////////////////////////////////////////////////////////////////
  464:  
  465:         /// <summary>
  466:         ///
  467:         /// </summary>
  468:         [HttpPost]
  469:         [Route("provision/migration/manage")]
  470:         public IActionResult MigrationManage(Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, string commandName)
  471:         {
  472:             manageViewModel.CurrentStaffIdentityUser = Ia.Ftn.Cl.Models.Data.StaffIdentityUser.CurrentStaffIdentityUser(userManager, User);
  473:  
  474:             Ia.Ftn.Wa.Models.Provision.Migration.Manage.Post(ref manageViewModel, commandName);
  475:  
  476:             Ia.Ftn.Wa.Models.Provision.Migration.Manage.ViewModel(ref manageViewModel);
  477:  
  478:             return View("/Views/Provision/Migration/Manage.cshtml", manageViewModel);
  479:         }
  480:  
  481:         ////////////////////////////////////////////////////////////////////////////
  482:         ////////////////////////////////////////////////////////////////////////////
  483:  
  484:         /// <summary>
  485:         ///
  486:         /// </summary>
  487:         [HttpGet]
  488:         public IActionResult Table()
  489:         {
  490:             return View();
  491:         }
  492:  
  493:         ////////////////////////////////////////////////////////////////////////////
  494:  
  495:         /// <summary>
  496:         ///
  497:         /// </summary>
  498:         [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
  499:         public IActionResult Error()
  500:         {
  501:             return View(new Ia.Ftn.Wa.Models.ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
  502:         }
  503:  
  504:         ////////////////////////////////////////////////////////////////////////////
  505:         ////////////////////////////////////////////////////////////////////////////
  506:     }
  507:  
  508:     ////////////////////////////////////////////////////////////////////////////
  509:     ////////////////////////////////////////////////////////////////////////////
  510: }