)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
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 Optical Fiber Network (OFN) web application (Intranet) model.

    1: using System.Configuration;
    2: using System.Text;
    3: using System.Xml.Linq;
    4:  
    5: namespace Ia.Ngn.Ofn.Wa.Model.Business
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Contact support class for Optical Fiber Network (OFN) 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.Ngn.Ofn.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 string Registration_Email(string email, string password)
  171:         {
  172:             bool b;
  173:             string message, result;
  174:  
  175:             message = Ia.Ngn.Cl.Model.Ui.Default.MailTop();
  176:             message += @"
  177: <p>You new account is ready:</p>
  178: <table>
  179: <tr><td>Email:</td><td style=""font-weight:bold"">" + email + @"</td></tr>
  180: <tr><td>Password:</td><td style=""font-weight:bold"">" + password + @"</td></tr>
  181: </table>
  182: ";
  183:  
  184:             message += "<p>We wish you a good experience with our service</p>";
  185:  
  186:             message += Ia.Ngn.Cl.Model.Ui.Default.MailBottom();
  187:  
  188:             result = string.Empty;
  189:  
  190:             b = Ia.Cl.Model.Smtp.SendHtml(email, email, "Your New " + ConfigurationManager.AppSettings["site_name"].ToString() + " Account is Ready", message); //, out result);
  191:  
  192:             if (b) result = "Confirmation email was sent to your '" + email + "' mailbox. ";
  193:             else result = "Could not send email with new password. ";
  194:  
  195:             return result;
  196:         }
  197:  
  198:         ////////////////////////////////////////////////////////////////////////////
  199:  
  200:         /// <summary>
  201:         ///
  202:         /// </summary>
  203:         public static string SendRegistrationConfirmationEmail(object providerUserKey, string email, string password)
  204:         {
  205:             bool b;
  206:             string message, result;
  207:  
  208:             message = Ia.Ngn.Cl.Model.Ui.Default.PlainMailTop();
  209:             message += @"
  210: Please confirm your account by clicking on the link: <a href=""http://fkim.com/private/verify_registration.aspx?id=" + providerUserKey.ToString() + @"""/>
  211: Email: " + email + @"
  212: Password: " + password + @"
  213:  
  214: We wish you a good experience with our service.
  215: ";
  216:  
  217:             message += Ia.Ngn.Cl.Model.Ui.Default.PlainMailBottom();
  218:  
  219:             result = string.Empty;
  220:  
  221:             b = Ia.Cl.Model.Smtp.SendPlain(email, email, "Your New " + ConfigurationManager.AppSettings["site_name"].ToString() + " Account is Ready", message); //, out result);
  222:  
  223:             if (b) result = "Confirmation email was sent to your '" + email + "' mailbox. ";
  224:             else result = "Could not send email with new password. ";
  225:  
  226:             return result;
  227:         }
  228:  
  229:         ////////////////////////////////////////////////////////////////////////////
  230:         ////////////////////////////////////////////////////////////////////////////
  231:     }
  232:  
  233:     ////////////////////////////////////////////////////////////////////////////
  234:     ////////////////////////////////////////////////////////////////////////////   
  235: }