Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Default

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

Koran Reference Network Class Library support functions: UI model

   1:  using System;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.IO;
   5:  using System.Configuration;
   6:  using System.Text;
   7:  using System.Text.RegularExpressions;
   8:  using System.Data;
   9:  using System.Data.SqlClient;
  10:  using System.Web.UI;
  11:  using System.Web.UI.WebControls;
  12:   
  13:  namespace Ia.Islamic.Koran.Wa.Model.Ui
  14:  {
  15:      ////////////////////////////////////////////////////////////////////////////
  16:   
  17:      /// <summary publish="true">
  18:      /// Koran Reference Network Class Library support functions: UI model
  19:      /// </summary>
  20:      /// <value>
  21:      /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
  22:      /// </value>
  23:      /// <remarks> 
  24:      /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  25:      ///
  26:      /// 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
  27:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  28:      ///
  29:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  30:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  31:      /// 
  32:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  33:      /// 
  34:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  35:      /// </remarks> 
  36:      public abstract class Default
  37:      {
  38:          //private static string languageCode;
  39:   
  40:          ////////////////////////////////////////////////////////////////////////////
  41:          
  42:          /// <summary>
  43:          ///
  44:          /// </summary>
  45:          public Default() 
  46:          { 
  47:          }
  48:   
  49:          ////////////////////////////////////////////////////////////////////////////
  50:   
  51:          /// <summary>
  52:          ///
  53:          /// </summary>
  54:          public static void Theme(System.Web.UI.Page page, System.Web.Profile.ProfileBase profile)
  55:          {
  56:              // below: use mobile master pages if this browser is mobile
  57:              if (HttpContext.Current.Request.Browser.IsMobileDevice)
  58:              {
  59:                  page.MasterPageFile = page.MasterPageFile.Replace("/", "/m/");
  60:   
  61:                  if (page.MasterPageFile.Contains("ar")) page.Theme = "m.ar";
  62:                  else if (page.MasterPageFile.Contains("en")) page.Theme = "m";
  63:                  else if (page.MasterPageFile.Contains("es")) page.Theme = "m";
  64:                  else if (page.MasterPageFile.Contains("fr")) page.Theme = "m";
  65:                  else if (page.MasterPageFile.Contains("de")) page.Theme = "m";
  66:                  else if (page.MasterPageFile.Contains("nl")) page.Theme = "m";
  67:                  else if (page.MasterPageFile.Contains("ru")) page.Theme = "m";
  68:                  else if (page.MasterPageFile.Contains("zh")) page.Theme = "m";
  69:                  else if (page.MasterPageFile.Contains("ja")) page.Theme = "m";
  70:                  else if (page.MasterPageFile.Contains("ko")) page.Theme = "m";
  71:              }
  72:              else
  73:              {
  74:                  //if (page.Session["languageCode"] != null)
  75:                  //{
  76:                  //    languageCode = page.Session["languageCode"].ToString();
  77:   
  78:                  //    if (languageCode != "ar" && languageCode != "fa") languageCode = "ar";
  79:                  //}
  80:                  //else languageCode = "ar";
  81:   
  82:                  //page.Theme = languageCode;
  83:   
  84:                  if (page.MasterPageFile.Contains("ar")) page.Theme = "ar";
  85:                  else if (page.MasterPageFile.Contains("en")) page.Theme = "en";
  86:                  else if (page.MasterPageFile.Contains("es")) page.Theme = "es";
  87:                  else if (page.MasterPageFile.Contains("fr")) page.Theme = "fr";
  88:                  else if (page.MasterPageFile.Contains("de")) page.Theme = "de";
  89:                  else if (page.MasterPageFile.Contains("nl")) page.Theme = "nl";
  90:                  else if (page.MasterPageFile.Contains("ru")) page.Theme = "ru";
  91:                  else if (page.MasterPageFile.Contains("zh")) page.Theme = "zh";
  92:                  else if (page.MasterPageFile.Contains("ja")) page.Theme = "ja";
  93:                  else if (page.MasterPageFile.Contains("ko")) page.Theme = "ko";
  94:              }
  95:          }
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:   
  99:          /// <summary>
 100:          ///
 101:          /// </summary>
 102:          public static string MailTop()
 103:          {
 104:              return @"
 105:  <!DOCTYPE html>
 106:  <html xmlns=""http://www.w3.org/1999/xhtml"" >
 107:  <head>
 108:  <title>" + ConfigurationManager.AppSettings["site_name"].ToString() + ": " + ConfigurationManager.AppSettings["company_name"].ToString() + @"</title>
 109:  <style>
 110:  html { direction:ltr; }
 111:  body { background:#fff;margin:5px;padding:0px;color:DarkBlue; }
 112:  body,td,th,a,input.button_ia,input,textarea,option,select,pre { font:9pt normal #000066 ""Tahoma"";font-family:Tahoma;text-decoration:none; }
 113:  a:link { color:#0000ff;text-decoration:none; }
 114:  a:visited { color:#0000ff;text-decoration:none; }
 115:  a:hover { color:#ff8888;text-decoration:none; }
 116:  hr { color:rgb(204,204,204); }
 117:  p { line-height:18px;margin-top:9px;margin-bottom:9px; }
 118:  table.form { }
 119:  table.form td { }
 120:  </style>
 121:  </head>
 122:  <body>
 123:   
 124:  <p><b>" + ConfigurationManager.AppSettings["site_name"].ToString() + "</b>: <b>" + ConfigurationManager.AppSettings["company_name"].ToString() + @"</b></p>
 125:  ";
 126:          }
 127:   
 128:          ////////////////////////////////////////////////////////////////////////////
 129:   
 130:          /// <summary>
 131:          ///
 132:          /// </summary>
 133:          public static string PlainMailTop()
 134:          {
 135:              return ConfigurationManager.AppSettings["site_name"].ToString() + ": " + ConfigurationManager.AppSettings["company_name"].ToString() + @"
 136:  ";
 137:          }
 138:   
 139:          ////////////////////////////////////////////////////////////////////////////
 140:   
 141:          /// <summary>
 142:          ///
 143:          /// </summary>
 144:          public static string MailBottom()
 145:          {
 146:              return @"
 147:  </body>
 148:  </html>
 149:  ";
 150:          }
 151:   
 152:          ////////////////////////////////////////////////////////////////////////////
 153:   
 154:          /// <summary>
 155:          ///
 156:          /// </summary>
 157:          public static string PlainMailBottom()
 158:          {
 159:              return @"";
 160:          }
 161:   
 162:          ////////////////////////////////////////////////////////////////////////////
 163:          ////////////////////////////////////////////////////////////////////////////
 164:      }
 165:  }