コード例 #1
0
ファイル: Login.aspx.cs プロジェクト: lgwebb/Restaurant-Webb
 protected void ButtonLogin_Click(object sender, EventArgs e)
 {
     System.Data.DataView dv;
     SDS_Customer.Select(DataSourceSelectArguments.Empty);
     dv = (System.Data.DataView)SDS_Customer.Select(DataSourceSelectArguments.Empty);
     System.Data.DataRow dr;
     dr = dv.Table.Rows[0];
     //  go back SDS look SQL for array index values
     // match db email and password to form email and password
     if (dr.ItemArray[1].ToString().ToLower().Equals(TextBoxEmail.Text) &&
         dr.ItemArray[2].ToString().ToLower().Equals(TextBoxPassword.Text))
     {
         Session["CustomerID"] = dr.ItemArray[0];
         LabelMessage.Text     = "Welcome back " + dr.ItemArray[0].ToString();
         if (CheckBoxRemember.Checked)
         {
             SetCookie();
         }
         ButtonContinue.Visible = true;
     }
     else
     {
         LabelMessage.Text      = "Login not found!";
         ButtonContinue.Visible = false;
     }
 }
コード例 #2
0
        protected void ButtonCreate_Click(object sender, EventArgs e)
        {
            LabelMessage.Text = "";

            try
            {
                if (Page.IsValid)
                {
                    SDS_Customer.Insert();
                    //could textbox email - just try to showcase session variables
                    Session["EmailAddress"] = TextBoxEmail.Text;
                    Select_Customer();  // get the Reviewer ID and store it in a session variable
                    SetCookie();
                }
                else
                {
                    LabelMessage.Text = "Page contains errors.";
                }



                LabelMessage.Text = TextBoxFirstName.Text + " " + TextBoxLastName.Text + " was created!";
            }
            catch (System.Data.OleDb.OleDbException ex)
            {
                if (ex.ErrorCode == -2147467259) //Error for duplicate records
                {
                    LabelMessage.Text = "Email Address already exists. / Error.";
                }
                else
                {
                    LabelMessage.Text = "ERROR CREATING ACCOUNT: " + TextBoxFirstName.Text + " " + TextBoxLastName.Text + " was NOT created!";
                }
            }
        }
コード例 #3
0
        protected void Select_Customer()
        {
            System.Data.DataView dv;
            SDS_Customer.Select(DataSourceSelectArguments.Empty);
            dv = (System.Data.DataView)SDS_Customer.Select(DataSourceSelectArguments.Empty);
            System.Data.DataRow dr;
            dr = dv.Table.Rows[0];
            //could textbox email - just try to showcase session variables
            /*if (dr.ItemArray[6].ToString().ToLower().Equals(Session["EmailAddress"].ToString().ToLower()))*/

            Session["CustomerID"] = dr.ItemArray[0];
        }
コード例 #4
0
ファイル: order.aspx.cs プロジェクト: goish135/asp.net
 protected void saveCustomerData(object sender, EventArgs e)
 {
     SDS_Customer.Insert();
 }