protected void Application_Start(object sender, EventArgs e) { List<Customer> custlist = new List<Customer>(); String Stat = "select * from KannegantiS_WADfl13_Customers "; SqlCommand sc = new SqlCommand(Stat, connect); try { connect.Open(); SqlDataReader sqlReader = sc.ExecuteReader(); while (sqlReader.Read()) { Customer c = new Customer(); c.EmailAddress = (String)sqlReader["emailAddress"]; c.Password = (String)sqlReader["password"]; c.FirstName = (String)sqlReader["firstName"]; c.LastName = (String)sqlReader["lastName"]; c.FullAddress = (String)sqlReader["fullAddress"]; c.ContactPhone = (String)sqlReader["contactPhone"]; c.Country = sqlReader["country"].ToString(); c.OrderDate = sqlReader["orderDate"].ToString(); c.NumberofMinutes = sqlReader["numberofMinutes"].ToString(); c.DollarAmount = sqlReader["dollaramount"].ToString(); c.PaymentMethod = sqlReader["paymentMethod"].ToString(); custlist.Add(c); } Application["CustomerList"] = custlist; } finally { connect.Close(); } }
protected void Confirmation(object sender, EventArgs e) { Customer cust = new Customer(); List<Customer> customersList = Application["CustomerList"] as List<Customer>; cust.EmailAddress = email.Text.ToString(); cust.Password = pass1.Text.ToString(); cust.LastName = lname.Text.ToString(); cust.FirstName = fname.Text.ToString(); cust.FullAddress = address1.Text.ToString(); cust.ContactPhone = phone.Text.ToString(); SqlConnection connect = new SqlConnection("Data Source=dcm.uhcl.edu;Initial Catalog=c423013fa01kannegantis;User id=kannegantis;Password=1187207;Persist Security Info=True"); String Stat = "insert into KannegantiS_WADfl13_Customers(emailAddress,password,firstName,lastName,fullAddress,contactPhone) values('" + cust.EmailAddress + "','" + cust.Password + "','" + cust.FirstName + "','" + cust.LastName + "','" + cust.FullAddress + "','" + cust.ContactPhone + "')"; SqlCommand sc = new SqlCommand(Stat, connect); try { connect.Open(); sc.CommandText = Stat; sc.BeginExecuteNonQuery(); //System.Data.SqlClient.SqlDataReader sqlReader = sc.ExecuteReader(); } finally { connect.Close(); } Session["currentCutomer"] = cust; customersList.Add(cust); ClientScript.RegisterStartupScript(GetType(), "TestAlert", "alert(\'Thank you for creating an account.Please click the \\'Go to Main Page\\' button below and click \\'My Account\\' on the main page to Login.\');", true); }