home *** CD-ROM | disk | FTP | other *** search
/ ip-72-10-208-29.nwptny.ntcnet.net / ip-72-10-208-29.nwptny.ntcnet.net.tar / ip-72-10-208-29.nwptny.ntcnet.net / newhartsystems / ASP / Support.aspx.cs < prev    next >
Text File  |  2007-11-28  |  9KB  |  271 lines

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11.  
  12. using System.Configuration;
  13.  
  14. using Quiksoft.EasyMail.SMTP;
  15.  
  16. namespace Order
  17. {
  18.     /// <summary>
  19.     /// Summary description for Support.
  20.     /// </summary>
  21.     public class Support : System.Web.UI.Page
  22.     {
  23.         protected System.Web.UI.WebControls.TextBox PhoneNumber;
  24.         protected System.Web.UI.WebControls.Label Label7;
  25.         protected System.Web.UI.WebControls.TextBox Name;
  26.         protected System.Web.UI.WebControls.Label Label6;
  27.         protected System.Web.UI.WebControls.TextBox EmailAddress;
  28.         protected System.Web.UI.WebControls.Label Label4;
  29.         protected System.Web.UI.WebControls.DropDownList Item;
  30.         protected System.Web.UI.WebControls.Label Label3;
  31.         protected System.Web.UI.WebControls.TextBox Question;
  32.         protected System.Web.UI.WebControls.Label Label2;
  33.         protected System.Web.UI.WebControls.Label Label8;
  34.         protected System.Web.UI.WebControls.TextBox Incident;
  35.         protected System.Web.UI.WebControls.TextBox SerialNumber;
  36.         protected System.Web.UI.WebControls.Button Button1;
  37.         protected System.Web.UI.WebControls.ImageButton ImageButton1;
  38.         protected System.Web.UI.WebControls.ImageButton ImageButton2;
  39.         protected System.Web.UI.WebControls.ImageButton ImageButton3;
  40.         protected System.Web.UI.WebControls.ImageButton ImageButton4;
  41.         protected System.Web.UI.WebControls.ImageButton ImageButton5;
  42.         protected System.Web.UI.WebControls.ImageButton ImageButton6;
  43.         protected System.Web.UI.WebControls.ImageButton ImageButton7;
  44.         protected System.Web.UI.WebControls.ImageButton ImageButton8;
  45.         protected System.Web.UI.WebControls.ImageButton ImageButton9;
  46.         protected System.Web.UI.WebControls.ImageButton ImageButton10;
  47.         protected System.Web.UI.WebControls.Label Label10;
  48.         protected System.Web.UI.WebControls.Label Label11;
  49.         protected System.Web.UI.WebControls.Label Label12;
  50.         protected System.Web.UI.WebControls.Label Label13;
  51.         protected System.Web.UI.WebControls.TextBox Version;
  52.         protected System.Web.UI.WebControls.Label Label5;
  53.         protected System.Web.UI.WebControls.Label Label14;
  54.         protected System.Web.UI.WebControls.Label Label9;
  55.         protected System.Web.UI.WebControls.Label Label1;
  56.     
  57.         private void Page_Load(object sender, System.EventArgs e)
  58.         {
  59.             //this.Item.SelectedIndex = 5;    //Blues 2006 client
  60.             // Put user code to initialize the page here
  61.         }
  62.  
  63.         #region Web Form Designer generated code
  64.         override protected void OnInit(EventArgs e)
  65.         {
  66.             //
  67.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  68.             //
  69.             InitializeComponent();
  70.             base.OnInit(e);
  71.         }
  72.         
  73.         /// <summary>
  74.         /// Required method for Designer support - do not modify
  75.         /// the contents of this method with the code editor.
  76.         /// </summary>
  77.         private void InitializeComponent()
  78.         {    
  79.             this.ImageButton10.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton10_Click);
  80.             this.ImageButton8.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton8_Click);
  81.             this.ImageButton6.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton6_Click);
  82.             this.ImageButton5.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton5_Click);
  83.             this.ImageButton4.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton4_Click);
  84.             this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
  85.             this.Item.SelectedIndexChanged += new System.EventHandler(this.Item_SelectedIndexChanged);
  86.             this.Button1.Click += new System.EventHandler(this.Button1_Click);
  87.             this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
  88.             this.Load += new System.EventHandler(this.Page_Load);
  89.  
  90.         }
  91.         #endregion
  92.  
  93.         private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  94.         {
  95.         
  96.         }
  97.  
  98.         private void ImageButton5_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  99.         {
  100.             this.Response.Redirect(ConfigurationSettings.AppSettings["HomeUrl"]);
  101.         
  102.         }
  103.  
  104.         private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  105.         {
  106.             this.Response.Redirect(ConfigurationSettings.AppSettings["ProductsUrl"]);
  107.         }
  108.  
  109.         private void ImageButton4_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  110.         {
  111.             this.Response.Redirect(ConfigurationSettings.AppSettings["PricingUrl"]);
  112.  
  113.         }
  114.  
  115.         private void ImageButton6_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  116.         {
  117.             this.Response.Redirect(ConfigurationSettings.AppSettings["OrderUrl"]);
  118.  
  119.         }
  120.  
  121.         private void ImageButton10_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  122.         {
  123.             this.Response.Redirect(ConfigurationSettings.AppSettings["ContactUrl"]);
  124.         
  125.         }
  126.  
  127.         private void ImageButton8_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  128.         {
  129.             this.Response.Redirect(ConfigurationSettings.AppSettings["SupportUrl"]);
  130.  
  131.         }
  132.  
  133.         private void Button1_Click(object sender, System.EventArgs e)
  134.         {
  135.     
  136.             //
  137.             // Validate fields
  138.             //
  139.             if(this.Version.Text.Length < 1)
  140.             {
  141.                 this.MessageBoxOk("Please enter your version number or type unknown.");
  142.                 return;
  143.             }
  144.             
  145.             if(this.EmailAddress.Text.Length < 1)
  146.             {
  147.                 this.MessageBoxOk("Please enter your email address, it is required.");
  148.                 return;
  149.             }
  150.             
  151.             if(this.Name.Text.Length < 1)
  152.             {
  153.                 this.MessageBoxOk("Please enter your Name");
  154.                 return;
  155.             }
  156.             
  157.             if(this.Question.Text.Length < 1)
  158.             {
  159.                 this.MessageBoxOk("Please enter your question.");
  160.                 return;
  161.             }
  162.  
  163.  
  164.             //
  165.             // Submit support request form
  166.             //
  167.             if(this.Incident.Text.Length == 0)
  168.             {
  169.                 // Assign an incident number
  170.  
  171.                 this.Incident.Text = String.Format("{0}",DateTime.Now.Ticks);
  172.             }
  173.  
  174.             //
  175.             // Send an email message to them and us
  176.             //
  177.             string ReplySubject = String.Format("Re[NSI Support Incident {0}]",this.Incident.Text);
  178.  
  179.             string Body = String.Format("This is an automated reply to your support question.\r\n\r\nYou will receive a response to your question within 24 hours.\r\n\r\nIf you need immediate contact, please call support at 315 896 4131 between 8AM and 5PM EST.\r\n\r\nPlease retain the incident number for future reference.\r\n\r\nYour Question was:\r\n\r\n\"{0}\"\r\n\r\nThank You,\r\n\r\nSupport@newhartsystems.com\r\n",this.Question.Text);
  180.             
  181.             Body += String.Format("\r\n\r\n\r\nProduct: {0}\r\nVersion: {1}\r\nSerial Number:{2}\r\nName: {3}\r\nPhone: {4}\r\n",this.Item.SelectedItem.Text,this.Version.Text,this.SerialNumber.Text,this.Name.Text,this.PhoneNumber.Text);
  182.  
  183.             this.SendEmail(ConfigurationSettings.AppSettings["EmailSupport"],this.EmailAddress.Text,ReplySubject,Body,null);
  184.             this.SendEmail(this.EmailAddress.Text,ConfigurationSettings.AppSettings["EmailSupport"],ReplySubject,Body,null);
  185.  
  186.             this.MessageBoxOk("Thank you for your request!  Please check your email periodically for your answer.");
  187.         
  188.         }
  189.     
  190.         static internal protected string SmtpAddress = ConfigurationSettings.AppSettings["SmtpServer"];    //mail.dc1.adelphia.net
  191.  
  192.         internal bool SendEmail(string From,string To,string Subject,string Body,string AttachedFile)
  193.         {
  194.             bool SendFailed = false;
  195.             Quiksoft.EasyMail.SMTP.SMTP sm = new SMTP();
  196.             Quiksoft.EasyMail.SMTP.EmailMessage ml = new EmailMessage();
  197.             
  198.             
  199.             try
  200.             {
  201.                 Quiksoft.EasyMail.SMTP.License.Key = "newhartsystems (Single Developer)/8128517F39914787F411A81610D9A";
  202.  
  203.                 ml.From.Email = From;
  204.                 ml.Recipients.Add(To);
  205.                 ml.Subject = Subject;
  206.                 ml.BodyParts.Add(Body);
  207.                 sm.SMTPServers.Add(SmtpAddress);
  208.  
  209.                 if(AttachedFile != null)
  210.                     ml.Attachments.Add(AttachedFile);
  211.  
  212.  
  213.                 //                ml.Attachments.Add(this.Package);
  214.  
  215.  
  216.                 //                sm.LogFile = "c:\\SMTPLOG";
  217.                 sm.Send(ml);
  218.                 
  219.                 SendFailed = false;
  220.             }
  221.             catch(Exception X)
  222.             {
  223.                 string Err = String.Format("We have encountered an error trying to process your order : {0}, please call us at 315 896 4131 between 8AM and 5PM EST",X.Message);
  224.                 this.MessageBoxOk(Err);
  225.  
  226.                 
  227.                 if(SendFailed)
  228.                 {
  229.                     try
  230.                     {
  231.                         //
  232.                         // Create a log file
  233.                         //
  234.                         //                        File.Delete("c:\\SMTPLOG",false);
  235.                         //                        sm.LogFile = "c:\\SMTPLOG";
  236.                         //                        sm.Send(ml);
  237.                     }
  238.                     catch
  239.                     {
  240.                     }
  241.  
  242.                 }
  243.                 //                MessageBox.Show(String.Format(GetLangMessage("STR_EMAIL_FAILED"),X.Message),"Blues");
  244.                 //                MessageBox.Show(GetLangMessage("STR_NOUSER_IN_DB"),"Blues");
  245.             }
  246.             if(SendFailed)
  247.                 return(false);
  248.             else
  249.                 return(true);
  250.  
  251.         }
  252.     
  253.     
  254.         internal void MessageBoxOk(string Msg)
  255.         {
  256.             
  257.             Response.Write("<script type='text/javascript'>alert('" + Msg +"');</script>");            
  258.             Response.Flush();
  259.             return;
  260.  
  261.         }
  262.  
  263.         private void Item_SelectedIndexChanged(object sender, System.EventArgs e)
  264.         {
  265.         
  266.         }
  267.     
  268.     
  269.     }
  270. }
  271.