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

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

Contact support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.

    1: using System.Configuration;
    2: using System.Text;
    3: using System.Xml.Linq;
    4:  
    5: namespace Ia.Ftn.Wa.Models.Business
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Contact support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.
   11:     /// </summary>
   12:     /// 
   13:     /// <remarks> 
   14:     /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   15:     ///
   16:     /// 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
   17:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   18:     ///
   19:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   20:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   21:     /// 
   22:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   23:     /// 
   24:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   25:     /// </remarks> 
   26:     public class Contact
   27:     {
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public Contact()
   34:         {
   35:         }
   36:  
   37:         ////////////////////////////////////////////////////////////////////////////
   38:  
   39:         /// <summary>
   40:         ///
   41:         /// </summary>
   42:         public string ReturnFormattedContactTable()
   43:         {
   44:             StringBuilder sb;
   45:             //XDocument xd;
   46:  
   47:             sb = new StringBuilder(10000);
   48:  
   49:             /*
   50:             xd = Ia.Ftn.Wa.Model Data.Contact();
   51: 
   52:             foreach (XElement xe in xd.Elements("contact").Elements("group"))
   53:             {
   54:                 sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Khaki"">");
   55: 
   56:                 sb.Append(IterateThroughContacts(xe));
   57: 
   58:                 sb.Append(@"</table><hr/>");
   59:             }
   60:              */
   61:  
   62:             return sb.ToString();
   63:         }
   64:  
   65:         ////////////////////////////////////////////////////////////////////////////
   66:  
   67:         /// <summary>
   68:         ///
   69:         /// </summary>
   70:         private string IterateThroughContacts(XElement xe)
   71:         {
   72:             //string u;//, v; //, w;
   73:             string name, name_en, name_ar, phone, fax, email, ext;
   74:             StringBuilder a_sb;
   75:             XElement a, b;
   76:  
   77:             //u = string.Empty; // v = string.Empty; // w = string.Empty;
   78:             name = name_en = name_ar = phone = fax = email = ext = string.Empty;
   79:             a_sb = new StringBuilder(10000);
   80:  
   81:             a_sb.Append(@"<tr><td>");
   82:             a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid LavenderBlush"">");
   83:  
   84:             a = xe.Element("name");
   85:  
   86:             if (a != null)
   87:             {
   88:                 if (a.Attribute("en") != null) name_en = a.Attribute("en").Value;
   89:                 if (a.Attribute("ar") != null) name_ar = a.Attribute("ar").Value;
   90:  
   91:                 if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
   92:                 else if (name_en.Length > 0) name = name_en;
   93:                 else if (name_ar.Length > 0) name = name_ar;
   94:  
   95:                 a = xe.Element("phone");
   96:                 if (a != null) phone = a.Value;
   97:  
   98:                 a = xe.Element("fax");
   99:                 if (a != null) fax = a.Value;
  100:  
  101:                 a = xe.Element("email");
  102:                 if (a != null) email = a.Value;
  103:  
  104:                 a = xe.Element("ext");
  105:                 if (a != null) ext = a.Value;
  106:  
  107:                 if (name.Length > 0) a_sb.Append(@"<tr><td style=""font-weight:bold"">&nbsp;" + name + "</td></tr>");
  108:                 if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
  109:                 if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
  110:                 if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
  111:                 if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
  112:  
  113:                 name = phone = fax = email = ext = string.Empty;
  114:             }
  115:  
  116:             foreach (XElement o in xe.Elements("person"))
  117:             {
  118:                 a_sb.Append(@"<tr><td>");
  119:                 a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Lavender"">");
  120:  
  121:                 b = o.Element("name");
  122:  
  123:                 if (b.Attribute("en") != null) name_en = b.Attribute("en").Value;
  124:                 if (b.Attribute("ar") != null) name_ar = b.Attribute("ar").Value;
  125:  
  126:                 if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
  127:                 else if (name_en.Length > 0) name = name_en;
  128:                 else if (name_ar.Length > 0) name = name_ar;
  129:  
  130:                 b = o.Element("phone");
  131:                 if (b != null) phone = b.Value;
  132:  
  133:                 b = o.Element("fax");
  134:                 if (b != null) fax = b.Value;
  135:  
  136:                 b = o.Element("email");
  137:                 if (b != null) email = b.Value;
  138:  
  139:                 b = o.Element("ext");
  140:                 if (b != null) ext = b.Value;
  141:  
  142:                 if (name.Length > 0) a_sb.Append(@"<tr><td>&nbsp;" + name + "</td></tr>");
  143:                 if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
  144:                 if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
  145:                 if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
  146:                 if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
  147:  
  148:                 name = phone = fax = email = ext = string.Empty;
  149:  
  150:                 a_sb.Append("</table>");
  151:                 a_sb.Append(@"</td></tr>");
  152:             }
  153:  
  154:             foreach (XElement o in xe.Elements("group"))
  155:             {
  156:                 a_sb.Append(IterateThroughContacts(o));
  157:             }
  158:  
  159:             a_sb.Append("</table>");
  160:             a_sb.Append(@"</td></tr>");
  161:  
  162:             return a_sb.ToString();
  163:         }
  164:  
  165:         ////////////////////////////////////////////////////////////////////////////
  166:  
  167:         /// <summary>
  168:         ///
  169:         /// </summary>
  170:         public static Ia.Cl.Models.Result Registration_Email(string email, string password)
  171:         {
  172:             var message = Ia.Ftn.Cl.Models.Ui.Default.MailTop();
  173:             message += @"
  174: <p>You new account is ready:</p>
  175: <table>
  176: <tr><td>Email:</td><td style=""font-weight:bold"">" + email + @"</td></tr>
  177: <tr><td>Password:</td><td style=""font-weight:bold"">" + password + @"</td></tr>
  178: </table>
  179: ";
  180:  
  181:             message += "<p>We wish you a good experience with our service</p>";
  182:  
  183:             message += Ia.Ftn.Cl.Models.Ui.Default.MailBottom();
  184:  
  185:             return Ia.Cl.Models.Smtp.SendHtml(email, email, "Your New " + Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName") + " Account is Ready", message);
  186:         }
  187:  
  188:         ////////////////////////////////////////////////////////////////////////////
  189:  
  190:         /// <summary>
  191:         ///
  192:         /// </summary>
  193:         public static Ia.Cl.Models.Result SendRegistrationConfirmationEmail(object providerUserKey, string email, string password)
  194:         {
  195:             string message;
  196:  
  197:             message = Ia.Ftn.Cl.Models.Ui.Default.PlainMailTop();
  198:             message += @"
  199: Please confirm your account by clicking on the link: <a href=""http://fkim.com/private/verify_registration.aspx?id=" + providerUserKey.ToString() + @"""/>
  200: Email: " + email + @"
  201: Password: " + password + @"
  202:  
  203: We wish you a good experience with our service.
  204: ";
  205:  
  206:             message += Ia.Ftn.Cl.Models.Ui.Default.PlainMailBottom();
  207:  
  208:             return Ia.Cl.Models.Smtp.SendPlain(email, email, "Your New " + Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName") + " Account is Ready", message);
  209:         }
  210:  
  211:         ////////////////////////////////////////////////////////////////////////////
  212:         ////////////////////////////////////////////////////////////////////////////
  213:     }
  214:  
  215:     ////////////////////////////////////////////////////////////////////////////
  216:     ////////////////////////////////////////////////////////////////////////////   
  217: }