)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
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:     /// </remarks> 
   16:     public class Contact
   17:     {
   18:         ////////////////////////////////////////////////////////////////////////////
   19:  
   20:         /// <summary>
   21:         ///
   22:         /// </summary>
   23:         public Contact()
   24:         {
   25:         }
   26:  
   27:         ////////////////////////////////////////////////////////////////////////////
   28:  
   29:         /// <summary>
   30:         ///
   31:         /// </summary>
   32:         public string ReturnFormattedContactTable()
   33:         {
   34:             StringBuilder sb;
   35:             //XDocument xd;
   36:  
   37:             sb = new StringBuilder(10000);
   38:  
   39:             /*
   40:             xd = Ia.Ftn.Wa.Model Data.Contact();
   41: 
   42:             foreach (XElement xe in xd.Elements("contact").Elements("group"))
   43:             {
   44:                 sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Khaki"">");
   45: 
   46:                 sb.Append(IterateThroughContacts(xe));
   47: 
   48:                 sb.Append(@"</table><hr/>");
   49:             }
   50:              */
   51:  
   52:             return sb.ToString();
   53:         }
   54:  
   55:         ////////////////////////////////////////////////////////////////////////////
   56:  
   57:         /// <summary>
   58:         ///
   59:         /// </summary>
   60:         private string IterateThroughContacts(XElement xe)
   61:         {
   62:             //string u;//, v; //, w;
   63:             string name, name_en, name_ar, phone, fax, email, ext;
   64:             StringBuilder a_sb;
   65:             XElement a, b;
   66:  
   67:             //u = string.Empty; // v = string.Empty; // w = string.Empty;
   68:             name = name_en = name_ar = phone = fax = email = ext = string.Empty;
   69:             a_sb = new StringBuilder(10000);
   70:  
   71:             a_sb.Append(@"<tr><td>");
   72:             a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid LavenderBlush"">");
   73:  
   74:             a = xe.Element("name");
   75:  
   76:             if (a != null)
   77:             {
   78:                 if (a.Attribute("en") != null) name_en = a.Attribute("en").Value;
   79:                 if (a.Attribute("ar") != null) name_ar = a.Attribute("ar").Value;
   80:  
   81:                 if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
   82:                 else if (name_en.Length > 0) name = name_en;
   83:                 else if (name_ar.Length > 0) name = name_ar;
   84:  
   85:                 a = xe.Element("phone");
   86:                 if (a != null) phone = a.Value;
   87:  
   88:                 a = xe.Element("fax");
   89:                 if (a != null) fax = a.Value;
   90:  
   91:                 a = xe.Element("email");
   92:                 if (a != null) email = a.Value;
   93:  
   94:                 a = xe.Element("ext");
   95:                 if (a != null) ext = a.Value;
   96:  
   97:                 if (name.Length > 0) a_sb.Append(@"<tr><td style=""font-weight:bold"">&nbsp;" + name + "</td></tr>");
   98:                 if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
   99:                 if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
  100:                 if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
  101:                 if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
  102:  
  103:                 name = phone = fax = email = ext = string.Empty;
  104:             }
  105:  
  106:             foreach (XElement o in xe.Elements("person"))
  107:             {
  108:                 a_sb.Append(@"<tr><td>");
  109:                 a_sb.Append(@"<table style=""margin-left:7px;border-left:2px solid Lavender"">");
  110:  
  111:                 b = o.Element("name");
  112:  
  113:                 if (b.Attribute("en") != null) name_en = b.Attribute("en").Value;
  114:                 if (b.Attribute("ar") != null) name_ar = b.Attribute("ar").Value;
  115:  
  116:                 if (name_en.Length > 0 && name_ar.Length > 0) name = name_en + " (" + name_ar + ")";
  117:                 else if (name_en.Length > 0) name = name_en;
  118:                 else if (name_ar.Length > 0) name = name_ar;
  119:  
  120:                 b = o.Element("phone");
  121:                 if (b != null) phone = b.Value;
  122:  
  123:                 b = o.Element("fax");
  124:                 if (b != null) fax = b.Value;
  125:  
  126:                 b = o.Element("email");
  127:                 if (b != null) email = b.Value;
  128:  
  129:                 b = o.Element("ext");
  130:                 if (b != null) ext = b.Value;
  131:  
  132:                 if (name.Length > 0) a_sb.Append(@"<tr><td>&nbsp;" + name + "</td></tr>");
  133:                 if (phone.Length > 0) a_sb.Append("<tr><td>&nbsp;Phone: " + phone + "</td></tr>");
  134:                 if (fax.Length > 0) a_sb.Append("<tr><td>&nbsp;Fax: " + fax + "</td></tr>");
  135:                 if (email.Length > 0) a_sb.Append(@"<tr><td>&nbsp;Email: <a href=""mailto:" + email + @""">" + email + "</a></td></tr>");
  136:                 if (ext.Length > 0) a_sb.Append("<tr><td>&nbsp;Ext: " + ext + "</td></tr>");
  137:  
  138:                 name = phone = fax = email = ext = string.Empty;
  139:  
  140:                 a_sb.Append("</table>");
  141:                 a_sb.Append(@"</td></tr>");
  142:             }
  143:  
  144:             foreach (XElement o in xe.Elements("group"))
  145:             {
  146:                 a_sb.Append(IterateThroughContacts(o));
  147:             }
  148:  
  149:             a_sb.Append("</table>");
  150:             a_sb.Append(@"</td></tr>");
  151:  
  152:             return a_sb.ToString();
  153:         }
  154:  
  155:         ////////////////////////////////////////////////////////////////////////////
  156:  
  157:         /// <summary>
  158:         ///
  159:         /// </summary>
  160:         public static Ia.Cl.Models.Result Registration_Email(string email, string password)
  161:         {
  162:             var message = Ia.Ftn.Cl.Models.Ui.Default.MailTop();
  163:             message += @"
  164: <p>You new account is ready:</p>
  165: <table>
  166: <tr><td>Email:</td><td style=""font-weight:bold"">" + email + @"</td></tr>
  167: <tr><td>Password:</td><td style=""font-weight:bold"">" + password + @"</td></tr>
  168: </table>
  169: ";
  170:  
  171:             message += "<p>We wish you a good experience with our service</p>";
  172:  
  173:             message += Ia.Ftn.Cl.Models.Ui.Default.MailBottom();
  174:  
  175:             return Ia.Cl.Models.Smtp.SendHtml(email, email, "Your New " + Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName") + " Account is Ready", message);
  176:         }
  177:  
  178:         ////////////////////////////////////////////////////////////////////////////
  179:  
  180:         /// <summary>
  181:         ///
  182:         /// </summary>
  183:         public static Ia.Cl.Models.Result SendRegistrationConfirmationEmail(object providerUserKey, string email, string password)
  184:         {
  185:             string message;
  186:  
  187:             message = Ia.Ftn.Cl.Models.Ui.Default.PlainMailTop();
  188:             message += @"
  189: Please confirm your account by clicking on the link: <a href=""http://fkim.com/private/verify_registration.aspx?id=" + providerUserKey.ToString() + @"""/>
  190: Email: " + email + @"
  191: Password: " + password + @"
  192:  
  193: We wish you a good experience with our service.
  194: ";
  195:  
  196:             message += Ia.Ftn.Cl.Models.Ui.Default.PlainMailBottom();
  197:  
  198:             return Ia.Cl.Models.Smtp.SendPlain(email, email, "Your New " + Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName") + " Account is Ready", message);
  199:         }
  200:  
  201:         ////////////////////////////////////////////////////////////////////////////
  202:         ////////////////////////////////////////////////////////////////////////////
  203:     }
  204:  
  205:     ////////////////////////////////////////////////////////////////////////////
  206:     ////////////////////////////////////////////////////////////////////////////   
  207: }