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 / Eval.aspx.cs < prev    next >
Text File  |  2007-11-28  |  12KB  |  356 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. using System.Configuration;
  12.  
  13. using Quiksoft.EasyMail.SMTP;
  14.  
  15.  
  16. namespace Order
  17. {
  18.     /// <summary>
  19.     /// Summary description for Eval.
  20.     /// </summary>
  21.     public class Eval : System.Web.UI.Page
  22.     {
  23.         protected System.Web.UI.WebControls.Label Label1;
  24.         protected System.Web.UI.WebControls.Label Label3;
  25.         protected System.Web.UI.WebControls.Label Label4;
  26.         protected System.Web.UI.WebControls.TextBox EmailAddress;
  27.         protected System.Web.UI.WebControls.Label Label5;
  28.         protected System.Web.UI.WebControls.Label Label6;
  29.         protected System.Web.UI.WebControls.TextBox Name;
  30.         protected System.Web.UI.WebControls.Label Label7;
  31.         protected System.Web.UI.WebControls.TextBox PhoneNumber;
  32.         protected System.Web.UI.WebControls.Label Label8;
  33.         protected System.Web.UI.WebControls.Label Label2;
  34.         protected System.Web.UI.WebControls.Button Submit;
  35.         protected System.Web.UI.WebControls.DropDownList Item;
  36.     
  37.  
  38.         /// <summary>
  39.         /// Email account for sending emails
  40.         /// </summary>
  41.         static internal protected string SmtpAddress = ConfigurationSettings.AppSettings["SmtpServer"];    //mail.dc1.adelphia.net
  42.         static internal protected string SupportUrl = ConfigurationSettings.AppSettings["SupportUrl"];
  43.         protected System.Web.UI.WebControls.Label Label11;
  44.         protected System.Web.UI.WebControls.ImageButton ImageButton1;
  45.         protected System.Web.UI.WebControls.ImageButton ImageButton2;
  46.         protected System.Web.UI.WebControls.ImageButton ImageButton3;
  47.         protected System.Web.UI.WebControls.ImageButton ImageButton4;
  48.         protected System.Web.UI.WebControls.ImageButton ImageButton5;
  49.         protected System.Web.UI.WebControls.ImageButton ImageButton6;
  50.         protected System.Web.UI.WebControls.ImageButton ImageButton7;
  51.         protected System.Web.UI.WebControls.ImageButton ImageButton8;
  52.         protected System.Web.UI.WebControls.ImageButton ImageButton10;
  53.         protected System.Web.UI.WebControls.Label Label12;
  54.         protected System.Web.UI.WebControls.Label Description;    //mail.dc1.adelphia.net
  55.  
  56.         static internal protected string DownloadNotificationTo = ConfigurationSettings.AppSettings["DownloadEmailTo"];        
  57.  
  58.         private void Page_Load(object sender, System.EventArgs e)
  59.         {
  60.             // Put user code to initialize the page here
  61.             //this.Item.SelectedIndex = 5;    //Blues 2006 client
  62.         }
  63.  
  64.         #region Web Form Designer generated code
  65.         override protected void OnInit(EventArgs e)
  66.         {
  67.             //
  68.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  69.             //
  70.             InitializeComponent();
  71.             base.OnInit(e);
  72.         }
  73.         
  74.         /// <summary>
  75.         /// Required method for Designer support - do not modify
  76.         /// the contents of this method with the code editor.
  77.         /// </summary>
  78.         private void InitializeComponent()
  79.         {    
  80.             this.ImageButton10.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton10_Click);
  81.             this.ImageButton8.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton8_Click);
  82.             this.ImageButton6.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton6_Click);
  83.             this.ImageButton5.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton5_Click);
  84.             this.ImageButton4.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton4_Click);
  85.             this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
  86.             this.Item.SelectedIndexChanged += new System.EventHandler(this.Item_SelectedIndexChanged);
  87.             this.Submit.Click += new System.EventHandler(this.Submit_Click);
  88.             this.Load += new System.EventHandler(this.Page_Load);
  89.  
  90.         }
  91.         #endregion
  92.  
  93.         private void Item_SelectedIndexChanged(object sender, System.EventArgs e)
  94.         {
  95.  
  96.             if(String.Compare(this.Item.SelectedValue,"Blues2003Client",true)==0)
  97.                 Description.Text = "Blues 2003 .NET Windows Software";
  98.             else
  99.             if(String.Compare(this.Item.SelectedValue,"Blues2006Client",true)==0)
  100.                 Description.Text = "Blues 2006 .NET Windows Software";
  101.             else
  102.             if(String.Compare(this.Item.SelectedValue,"Blues2003Developer",true)==0)
  103.                 Description.Text = "Blues 2003 .NET Windows Software";
  104.             else
  105.             if(String.Compare(this.Item.SelectedValue,"Blues2006Developer",true)==0)
  106.                 Description.Text = "Blues 2006 .NET Windows Software";
  107.             else
  108.             if(String.Compare(this.Item.SelectedValue,"BluesMobile04",true)==0)
  109.                 Description.Text = "Blues Mobile 04 Software";
  110.             else
  111.             if(String.Compare(this.Item.SelectedValue,"BluesMobile06",true)==0)
  112.                 Description.Text = "Blues Mobile 05 Software";
  113.             else
  114.             if(String.Compare(this.Item.SelectedValue,"BluesVirtualHost",true)==0)
  115.                 Description.Text = "Blues Virtual Host Software";
  116.             else
  117.             if(String.Compare(this.Item.SelectedValue,"Blues2006VirtualHost",true)==0)
  118.                 Description.Text = "Blues 2006 Virtual Host Software";
  119.             else
  120.                 Description.Text = "Blues 2000 32 bit Windows Software";
  121.         
  122.         }
  123.  
  124.         static internal protected string EmailOrderFrom = ConfigurationSettings.AppSettings["EmailOrderFrom"];
  125.  
  126. /// <summary>
  127. /// Send the person an email message with instructions on downloading the trial copy
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131.         private void Submit_Click(object sender, System.EventArgs e)
  132.         {
  133.         
  134.             if(this.EmailAddress.Text.Length == 0)
  135.             {
  136.                 this.MessageBoxOk("Please enter your email address !");
  137.                 return;            
  138.             }
  139.  
  140.             if(this.Name.Text.Length == 0)
  141.             {
  142.                 this.MessageBoxOk("Please enter your name !");
  143.                 return;            
  144.             }
  145.  
  146.             if(this.PhoneNumber.Text.Length == 0)
  147.             {
  148.                 this.MessageBoxOk("Please enter your phone number !");
  149.                 return;            
  150.             }
  151.  
  152.             //
  153.             //email myself the download record to import into Goldmine
  154.             //
  155.             string Body = "";
  156.  
  157.             Body += "\"" + this.Name.Text + "\"" + ",";
  158.             Body += "\"" + "" + "\"" + ",";
  159.             Body += "\"" + "" + "\"" + ",";
  160.             Body += "\"" + "" + "\"" + ",";
  161.             Body += "\"" + "" + "\"" + ",";
  162.             Body += "\"" + "" + "\"" + ",";
  163.             Body += "\"" + "" + "\"" + ",";
  164.             Body += "\"" + "" + "\"" + ",";
  165.             Body += "\"" + "" + "\"" + ",";
  166.             Body += "\"" + this.PhoneNumber.Text + "\"" + ",";
  167.             Body += "\"" + "" + "\"" + ",";
  168.             Body += "\"" + this.EmailAddress.Text + "\"" + ",";
  169.             Body += "\"" + "" + "\"" + ",";
  170.             Body += "\"" + "" + "\"" + ",";
  171.             Body += "\"" + this.Item.SelectedValue + "\"" + "\"";
  172.             this.SendEmail(DownloadNotificationTo,DownloadNotificationTo,"DOWNLOADED TRIAL",Body,null);
  173.  
  174.             //
  175.             //email the user instructions on downloading the product
  176.             //
  177.             string Product;
  178.             string DownloadUrl;
  179.             string PricingUrl = ConfigurationSettings.AppSettings["PricingHttp"];
  180.  
  181.  
  182.             if(String.Compare(this.Item.SelectedValue,"Blues2000",true)==0)
  183.             {
  184.                 Product = "Blues 2000";
  185.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2000Trial"];
  186.             }
  187.             else
  188.             if(String.Compare(this.Item.SelectedValue,"Blues2003Developer",true)==0)
  189.             {
  190.                 Product = "Blues 2003";
  191.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2003DevTrial"];
  192.             }
  193.             else
  194.             if(String.Compare(this.Item.SelectedValue,"Blues2006Developer",true)==0)
  195.             {
  196.                 Product = "Blues 2006 Developer";
  197.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2006DevTrial"];
  198.             }
  199.             else
  200.             if(String.Compare(this.Item.SelectedValue,"BluesMobile04",true)==0)
  201.             {
  202.                 Product = "Blues Mobile 04";
  203.                 DownloadUrl = ConfigurationSettings.AppSettings["BluesMobileDevTrial"];
  204.             }
  205.             else
  206.             if(String.Compare(this.Item.SelectedValue,"BluesMobile06",true)==0)
  207.             {
  208.                 Product = "Blues Mobile 06";
  209.                 DownloadUrl = ConfigurationSettings.AppSettings["BluesMobile06Trial"];
  210.             }
  211.             else
  212.             if(String.Compare(this.Item.SelectedValue,"BluesVirtualHost",true)==0)
  213.             {
  214.                 Product = "Blues 2003 Virtual Host";
  215.                 DownloadUrl = ConfigurationSettings.AppSettings["BluesVirtualHostTrial"];
  216.             }
  217.             else
  218.             if(String.Compare(this.Item.SelectedValue,"Blues2006VirtualHost",true)==0)
  219.             {
  220.                 Product = "Blues 2006 Virtual Host";
  221.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2006VirtualHostTrial"];
  222.             }
  223.             else
  224.             if(String.Compare(this.Item.SelectedValue,"Blues2006Client",true)==0)
  225.             {
  226.                 Product = "Blues 2006 Client";
  227.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2006CliTrial"];
  228.             }
  229.             else
  230.             {
  231.                 Product = "Blues 2003";
  232.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2003CliTrial"];
  233.             }
  234.                 
  235.             Body = String.Format("Thank you for trying our {0} product.\r\n\r\nTo download your trial copy, please go to the following address:\r\n\r\n{1}\r\n\r\nIf you need help with the product, please go to the following address:\r\n\r\n{2}\r\n\r\nIf you need pricing, please go to the following address.  Our prices are on our order form:\r\n\r\n{3}\r\n\r\nThank You,\r\n\r\n\r\nNewhart Systems Inc.\r\nwww.newhartsystems.com\r\n315-896-4131\r\n",Product,DownloadUrl,SupportUrl,PricingUrl);
  236.             
  237.             
  238.             this.SendEmail(EmailOrderFrom,this.EmailAddress.Text,String.Format("{0} Download Instructions",Product),Body,null);
  239.  
  240.             this.MessageBoxOk(String.Format("Thank you, please check your email for instructions on downloading our product."));
  241.  
  242.  
  243.         }
  244.  
  245.  
  246.         internal bool SendEmail(string From,string To,string Subject,string Body,string AttachedFile)
  247.         {
  248.             bool SendFailed = false;
  249.             Quiksoft.EasyMail.SMTP.SMTP sm = new SMTP();
  250.             Quiksoft.EasyMail.SMTP.EmailMessage ml = new EmailMessage();
  251.             
  252.             
  253.             try
  254.             {
  255.                 Quiksoft.EasyMail.SMTP.License.Key = "newhartsystems (Single Developer)/8128517F39914787F411A81610D9A";
  256.  
  257.                 ml.From.Email = From;
  258.                 ml.Recipients.Add(To);
  259.                 ml.Subject = Subject;
  260.                 ml.BodyParts.Add(Body);
  261.                 sm.SMTPServers.Add(SmtpAddress);
  262.  
  263.                 if(AttachedFile != null)
  264.                     ml.Attachments.Add(AttachedFile);
  265.  
  266.  
  267.                 //                ml.Attachments.Add(this.Package);
  268.  
  269.  
  270.                 //                sm.LogFile = "c:\\SMTPLOG";
  271.                 sm.Send(ml);
  272.                 
  273.                 SendFailed = false;
  274.             }
  275.             catch(Exception X)
  276.             {
  277.                 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);
  278.                 this.MessageBoxOk(Err);
  279.  
  280.                 
  281.                 if(SendFailed)
  282.                 {
  283.                     try
  284.                     {
  285.                         //
  286.                         // Create a log file
  287.                         //
  288.                         //                        File.Delete("c:\\SMTPLOG",false);
  289.                         //                        sm.LogFile = "c:\\SMTPLOG";
  290.                         //                        sm.Send(ml);
  291.                     }
  292.                     catch
  293.                     {
  294.                     }
  295.  
  296.                 }
  297.                 //                MessageBox.Show(String.Format(GetLangMessage("STR_EMAIL_FAILED"),X.Message),"Blues");
  298.                 //                MessageBox.Show(GetLangMessage("STR_NOUSER_IN_DB"),"Blues");
  299.             }
  300.             if(SendFailed)
  301.                 return(false);
  302.             else
  303.                 return(true);
  304.  
  305.         }
  306.  
  307.  
  308.  
  309.         internal void MessageBoxOk(string Msg)
  310.         {
  311.             
  312.             Response.Write("<script type='text/javascript'>alert('" + Msg +"');</script>");            
  313.             return;
  314.  
  315.         }
  316.  
  317.         private void ImageButton5_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  318.         {
  319.             this.Response.Redirect(ConfigurationSettings.AppSettings["HomeUrl"]);
  320.         
  321.         }
  322.  
  323.         private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  324.         {
  325.             this.Response.Redirect(ConfigurationSettings.AppSettings["ProductsUrl"]);
  326.         
  327.         }
  328.  
  329.         private void ImageButton4_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  330.         {
  331.             this.Response.Redirect(ConfigurationSettings.AppSettings["PricingUrl"]);
  332.         
  333.         }
  334.  
  335.         private void ImageButton6_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  336.         {
  337.             this.Response.Redirect(ConfigurationSettings.AppSettings["OrderUrl"]);
  338.  
  339.         }
  340.  
  341.         private void ImageButton8_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  342.         {
  343.             this.Response.Redirect(ConfigurationSettings.AppSettings["SupportUrl"]);
  344.         
  345.         }
  346.  
  347.         private void ImageButton10_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  348.         {
  349.             this.Response.Redirect(ConfigurationSettings.AppSettings["ContactUrl"]);
  350.  
  351.         }
  352.  
  353.  
  354.     }
  355. }
  356.