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

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

Contact support class for Next Generation Network (NGN) web application (Intranet) model.

   1:  using System;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.Xml.Linq;
   5:  using System.IO;
   6:  using System.Configuration;
   7:  using System.Text;
   8:  using System.Text.RegularExpressions;
   9:  using System.Data;
  10:  using System.Data.SqlClient;
  11:  using System.Web.UI;
  12:  using System.Web.UI.WebControls;
  13:  using System.Collections;
  14:   
  15:  namespace Ia.Ngn.Ofn.Wa.Model.Business
  16:  {
  17:      ////////////////////////////////////////////////////////////////////////////
  18:   
  19:      /// <summary publish="true">
  20:      /// Contact support class for Next Generation Network (NGN) web application (Intranet) model.
  21:      /// </summary>
  22:      /// 
  23:      /// <remarks> 
  24:      /// Copyright © 2006-2017 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 partial class Contact
  37:      {
  38:          ////////////////////////////////////////////////////////////////////////////
  39:   
  40:          /// <summary>
  41:          ///
  42:          /// </summary>
  43:          public Contact()
  44:          {
  45:          }
  46:   
  47:          ////////////////////////////////////////////////////////////////////////////
  48:   
  49:          /// <summary>
  50:          ///
  51:          /// </summary>
  52:          public string ReturnFormattedContactTable()
  53:          {
  54:              StringBuilder sb;
  55:              //XDocument xd;
  56:   
  57:              sb = new StringBuilder(10000);
  58:   
  59:              /*
  60:              xd = Ia.Ngn.Ofn.Wa.Model Data.Contact();
  61:  
  62:              foreach (XElement xe in xd.Elements("contact").Elements("group"))
  63:              {
  64:                  sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Khaki"">");
  65:  
  66:                  sb.Append(IterateThroughContacts(xe));
  67:  
  68:                  sb.Append(@"</table><hr/>");
  69:              }
  70:               */ 
  71:   
  72:              return sb.ToString();
  73:          }
  74:   
  75:          ////////////////////////////////////////////////////////////////////////////
  76:   
  77:          /// <summary>
  78:          ///
  79:          /// </summary>
  80:          private string IterateThroughContacts(XElement xe)
  81:          {
  82:              //string u;//, v; //, w;
  83:              string name, name_en, name_ar, phone, fax, email, ext;
  84:              StringBuilder a_sb;
  85:              XElement a, b;
  86:   
  87:              //u = ""; // v = ""; // w = "";
  88:              name = name_en = name_ar = phone = fax = email = ext = "";
  89:              a_sb = new StringBuilder(10000);
  90:   
  91:              a_sb.Append(@"<tr><td>");
  92:              a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid LavenderBlush"">");
  93:   
  94:              a = xe.Element("name");
  95:   
  96:              if (a != null)
  97:              {
  98:                  if (a.Attribute("en") != null) name_en = a.Attribute("en").Value;
  99:                  if (a.Attribute("ar") != null) name_ar = a.Attribute("ar").Value;
 100:   
 101:                  if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
 102:                  else if (name_en.Length > 0) name = name_en;
 103:                  else if (name_ar.Length > 0) name = name_ar;
 104:   
 105:                  a = xe.Element("phone");
 106:                  if (a != null) phone = a.Value;
 107:   
 108:                  a = xe.Element("fax");
 109:                  if (a != null) fax = a.Value;
 110:   
 111:                  a = xe.Element("email");
 112:                  if (a != null) email = a.Value;
 113:   
 114:                  a = xe.Element("ext");
 115:                  if (a != null) ext = a.Value;
 116:   
 117:                  if (name.Length > 0) a_sb.Append(@"<tr><td style=""font-weight:bold"">&nbsp;" + name + "</td></tr>");
 118:                  if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
 119:                  if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
 120:                  if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
 121:                  if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
 122:   
 123:                  name = phone = fax = email = ext = "";
 124:              }
 125:   
 126:              foreach (XElement o in xe.Elements("person"))
 127:              {
 128:                  a_sb.Append(@"<tr><td>");
 129:                  a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Lavender"">");
 130:   
 131:                  b = o.Element("name");
 132:   
 133:                  if (b.Attribute("en") != null) name_en = b.Attribute("en").Value;
 134:                  if (b.Attribute("ar") != null) name_ar = b.Attribute("ar").Value;
 135:   
 136:                  if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
 137:                  else if (name_en.Length > 0) name = name_en;
 138:                  else if (name_ar.Length > 0) name = name_ar;
 139:   
 140:                  b = o.Element("phone");
 141:                  if (b != null) phone = b.Value;
 142:   
 143:                  b = o.Element("fax");
 144:                  if (b != null) fax = b.Value;
 145:   
 146:                  b = o.Element("email");
 147:                  if (b != null) email = b.Value;
 148:   
 149:                  b = o.Element("ext");
 150:                  if (b != null) ext = b.Value;
 151:   
 152:                  if (name.Length > 0) a_sb.Append(@"<tr><td>&nbsp;" + name + "</td></tr>");
 153:                  if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
 154:                  if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
 155:                  if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
 156:                  if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
 157:   
 158:                  name = phone = fax = email = ext = "";
 159:   
 160:                  a_sb.Append("</table>");
 161:                  a_sb.Append(@"</td></tr>");
 162:              }
 163:   
 164:              foreach (XElement o in xe.Elements("group"))
 165:              {
 166:                  a_sb.Append(IterateThroughContacts(o));
 167:              }
 168:   
 169:              a_sb.Append("</table>");
 170:              a_sb.Append(@"</td></tr>");
 171:   
 172:              return a_sb.ToString();
 173:          }
 174:   
 175:          ////////////////////////////////////////////////////////////////////////////
 176:   
 177:          /// <summary>
 178:          ///
 179:          /// </summary>
 180:          public static string Registration_Email(string email, string password)
 181:          {
 182:              bool b;
 183:              string message, result;
 184:   
 185:              message = Ia.Ngn.Cl.Model.Ui.Default.MailTop();
 186:              message += @"
 187:  <p>You new account is ready:</p>
 188:  <table>
 189:  <tr><td>Email:</td><td style=""font-weight:bold"">" + email + @"</td></tr>
 190:  <tr><td>Password:</td><td style=""font-weight:bold"">" + password + @"</td></tr>
 191:  </table>
 192:  ";
 193:   
 194:              message += "<p>We wish you a good experience with our service</p>";
 195:   
 196:              message += Ia.Ngn.Cl.Model.Ui.Default.MailBottom();
 197:   
 198:              result = "";
 199:   
 200:              b = Ia.Cl.Model.Smtp.SendHtml(email, email, "Your New " + ConfigurationManager.AppSettings["site_name"].ToString() + " Account is Ready", message); //, out result);
 201:   
 202:              if (b) result = "Confirmation email was sent to your '" + email + "' mailbox. ";
 203:              else result = "Could not send email with new password. ";
 204:   
 205:              return result;
 206:          }
 207:   
 208:          ////////////////////////////////////////////////////////////////////////////
 209:   
 210:          /// <summary>
 211:          ///
 212:          /// </summary>
 213:          public static string SendRegistrationConfirmationEmail(object providerUserKey, string email, string password)
 214:          {
 215:              bool b;
 216:              string message, result;
 217:   
 218:              message = Ia.Ngn.Cl.Model.Ui.Default.PlainMailTop();
 219:              message += @"
 220:  Please confirm your account by clicking on the link: <a href=""http://fkim.com/private/verify_registration.aspx?id=" + providerUserKey.ToString() + @"""/>
 221:  Email: " + email + @"
 222:  Password: " + password + @"
 223:   
 224:  We wish you a good experience with our service.
 225:  ";
 226:   
 227:              message += Ia.Ngn.Cl.Model.Ui.Default.PlainMailBottom();
 228:   
 229:              result = "";
 230:   
 231:              b = Ia.Cl.Model.Smtp.SendPlain(email, email, "Your New " + ConfigurationManager.AppSettings["site_name"].ToString() + " Account is Ready", message); //, out result);
 232:   
 233:              if (b) result = "Confirmation email was sent to your '" + email + "' mailbox. ";
 234:              else result = "Could not send email with new password. ";
 235:   
 236:              return result;
 237:          }
 238:   
 239:          ////////////////////////////////////////////////////////////////////////////
 240:          ////////////////////////////////////////////////////////////////////////////
 241:      }
 242:   
 243:      ////////////////////////////////////////////////////////////////////////////
 244:      ////////////////////////////////////////////////////////////////////////////   
 245:  }