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

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.Net;
    3: using System.Text;
    4: using System.Xml.Linq;
    5:  
    6: namespace Ia.Ftn.Wa.Models.Contact
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Contact support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright © 2006-2024 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     /// </remarks> 
   17:     public class Index
   18:     {
   19:         ////////////////////////////////////////////////////////////////////////////
   20:  
   21:         /// <summary>
   22:         ///
   23:         /// </summary>
   24:         public Index()
   25:         {
   26:         }
   27:  
   28:         /////////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public static Ia.Cl.Models.Result ProcessEmail(string nameTextInput, string emailTextInput, string phoneTextInput, string inquiryTextArea)
   34:         {
   35:             var result = new Ia.Cl.Models.Result();
   36:  
   37:             if (!string.IsNullOrEmpty(nameTextInput))
   38:             {
   39:                 if (!string.IsNullOrEmpty(emailTextInput))
   40:                 {
   41:                     if (Ia.Cl.Models.Default.IsEmail(emailTextInput))
   42:                     {
   43:                         if (!string.IsNullOrEmpty(inquiryTextArea))
   44:                         {
   45:                             //if (Ia.Cl.Models.Google.Recaptcha.Passed(Request.Form["g-recaptcha-response"]))
   46:                             //{
   47:                             var name = WebUtility.HtmlEncode(nameTextInput);
   48:                             var email = WebUtility.HtmlEncode(emailTextInput);
   49:                             var phone = WebUtility.HtmlEncode(phoneTextInput);
   50:                             var inquiry = WebUtility.HtmlEncode(inquiryTextArea);
   51:  
   52:                             result = SendMail(name, email, phone, inquiry);
   53:                             //}
   54:                             //else
   55:                             //{
   56:                             //    result.AddError("Captcha had failed.");
   57:                             //}
   58:                         }
   59:                         else
   60:                         {
   61:                             result.AddError("Please enter your inquiry.");
   62:                         }
   63:                     }
   64:                     else
   65:                     {
   66:                         result.AddError("Email is not in valid email format.");
   67:                     }
   68:                 }
   69:                 else
   70:                 {
   71:                     result.AddError("Please enter your email.");
   72:                 }
   73:             }
   74:             else
   75:             {
   76:                 result.AddError("Please enter your name.");
   77:             }
   78:  
   79:             return result;
   80:         }
   81:  
   82:         /////////////////////////////////////////////////////////////////////////////////
   83:  
   84:         /// <summary>
   85:         ///
   86:         /// </summary>
   87:         private static Ia.Cl.Models.Result SendMail(string name, string email, string phone, string inquiry)
   88:         {
   89:             var result = new Ia.Cl.Models.Result();
   90:  
   91:             var message = Ia.Ftn.Wa.Models.Ui.Default.MailTop();
   92:  
   93:             message += @"
   94: <p>A visitor to the website has an inquiry. Visitor information is below:</p>
   95:  
   96: <p>Visitor information:</p>
   97:  
   98: <table class=""form"">
   99: <tr><td>Name:</td><td>" + name + @"&nbsp;</td></tr>
  100: <tr><td>Email:</td><td>" + email + @"&nbsp;</td></tr>
  101: <tr><td>Phone:</td><td>" + phone + @"&nbsp;</td></tr>
  102: <tr><td></td><td></td></tr>
  103: <tr><td valign=""top"">Inquery:</td><td>" + inquiry + @"</td></tr>
  104: </table>";
  105:  
  106:             message += Ia.Ftn.Wa.Models.Ui.Default.MailBottom();
  107:  
  108:             var applicationContact = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:ApplicationContact");
  109:             var applicationEmail = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:ApplicationEmail");
  110:  
  111:             return Ia.Cl.Models.Smtp.SendHtml(applicationContact, applicationEmail, "A visitor to the website has an inquiry", message);
  112:         }
  113:  
  114:         /////////////////////////////////////////////////////////////////////////////////
  115:         /////////////////////////////////////////////////////////////////////////////////
  116:  
  117:         /// <summary>
  118:         ///
  119:         /// </summary>
  120:         protected Ia.Cl.Models.Result ProcessMailingList(string emailTextInput)
  121:         {
  122:             var result = new Ia.Cl.Models.Result();
  123:  
  124:             if (!string.IsNullOrEmpty(emailTextInput))
  125:             {
  126:                 if (Ia.Cl.Models.Default.IsEmail(emailTextInput))
  127:                 {
  128:                     //if (Ia.Cl.Models.Google.Recaptcha.Passed(Request.Form["g-recaptcha-response"]))
  129:                     //{
  130:                     var email = WebUtility.HtmlEncode(emailTextInput);
  131:  
  132:                     result = SendMail("Unknown", email, string.Empty, "Request to join mailing list");
  133:                     //}
  134:                     //else
  135:                     //{
  136:                     //    result.AddError("Captcha had failed.");
  137:                     //}
  138:                 }
  139:                 else
  140:                 {
  141:                     result.AddError("Your email is not in valid email format.");
  142:                 }
  143:             }
  144:             else
  145:             {
  146:                 result.AddError("Please enter your email.");
  147:             }
  148:  
  149:             return result;
  150:         }
  151:  
  152:         ////////////////////////////////////////////////////////////////////////////
  153:         ////////////////////////////////////////////////////////////////////////////
  154:     }
  155:  
  156:     ////////////////////////////////////////////////////////////////////////////
  157:     ////////////////////////////////////////////////////////////////////////////   
  158: }