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

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

Trace API Controller class.

    1: using Microsoft.AspNetCore.Mvc;
    2:  
    3: namespace Ia.Api.Wa.Controllers
    4: {
    5:     ////////////////////////////////////////////////////////////////////////////
    6:  
    7:     /// <summary publish="true">
    8:     /// Trace API Controller class.
    9:     /// </summary>
   10:     /// 
   11:     /// <remarks> 
   12:     /// Copyright © 2001-2024 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   13:     ///
   14:     /// 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
   15:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   16:     ///
   17:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   18:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   19:     /// 
   20:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   21:     /// 
   22:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   23:     /// </remarks> 
   24:     [ApiController]
   25:     [Route("api/traces")]
   26:     public class TraceController : ControllerBase
   27:     {
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         /// Function used to call trace without having to use Entity Framework or connectionStrings
   32:         /// <code>
   33:         ///       protected void Session_Start(object sender, EventArgs e)
   34:         ///       {
   35:         ///               // call trace inspect
   36:         ///               using(kw.com.ia.api.trace.TraceClient traceClient = new kw.com.ia.api.trace.TraceClient()
   37:         ///               {
   38:         ///
   39:         ///               Ia.Cl.Models.Trace.Inspect(this.Request, traceClient.Inspect);
   40:         ///
   41:         ///               //traceClient.Close();
   42:         ///               }
   43:         ///       }
   44:         /// </code>
   45:         /// </summary>
   46:         [HttpPut]
   47:         [Route("{userHostAddress}/{uriString}/{guidString}/{serverVariables}")]
   48:         public bool Insert(string userHostAddress, string uriString, string guidString, string serverVariables)
   49:         {
   50:             bool traceInserted;
   51:             Uri uri;
   52:             Guid guid;
   53:  
   54:             // function is used in Func and must return an int value;
   55:  
   56:             try
   57:             {
   58:                 uri = new Uri(uriString);
   59:                 guid = Guid.Parse(guidString);
   60:  
   61:                 traceInserted = Ia.Cl.Models.Trace.Insert(userHostAddress, uri, guid, serverVariables);
   62:             }
   63:             catch (ArgumentNullException)
   64:             {
   65:                 traceInserted = false;
   66:             }
   67:             catch (UriFormatException)
   68:             {
   69:                 traceInserted = false;
   70:             }
   71:             catch (FormatException)
   72:             {
   73:                 traceInserted = false;
   74:             }
   75:  
   76:             return traceInserted;
   77:         }
   78:  
   79:         ////////////////////////////////////////////////////////////////////////////
   80:         ////////////////////////////////////////////////////////////////////////////
   81:     }
   82:  
   83:     ////////////////////////////////////////////////////////////////////////////
   84:     ////////////////////////////////////////////////////////////////////////////
   85: }