شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » TraceController

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

Trace API Controller class.

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