Пример #1
0
        protected void EmailDetailsChanged_Changed(object sender, EventArgs e)
        {
            MultiView1.SetActiveView(PasswordView);
            object returnVal;
            string Name;

            //Read Database
            DatabaseMgmt  dbObj = new DatabaseMgmt();
            SqlDataReader dR;

            dbObj.Connect();


            string strSqlCmd;

            strSqlCmd = $"select SecurityQn, ShopperID from Shopper where Email='{emailDetailsTextBox.Text}'";

            dR = dbObj.ExecuteSelect(strSqlCmd);
            if (dR.Read())
            {
                SecurityQnLabel.Text = dR["SecurityQn"].ToString();
            }
            else
            {
                SecurityQnLabel.Text = "No Account found!";
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ShopperID"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                DatabaseMgmt  objdbMgmt = new DatabaseMgmt();
                SqlDataReader dR;
                objdbMgmt.Connect();

                string strSqlCmd;
                strSqlCmd = $"select address,email,phone, passwd from Shopper where ShopperID='{Session["ShopperId"]}'";
                dR        = objdbMgmt.ExecuteSelect(strSqlCmd);

                if (displayNameCheckBox.Checked == true)
                {
                }
                NameLabel.Text = (string)Session["Name"];
                if (dR.Read())
                {
                    PasswordLabel.Text = dR["Passwd"].ToString().Trim();
                    AddressLabel.Text  = dR["address"].ToString();
                    EmailLabel.Text    = dR["email"].ToString();
                    PhoneLabel.Text    = dR["phone"].ToString();
                }
            }
        }
Пример #3
0
        protected void getAnswer_Changed(object sender, EventArgs e)
        {
            string Question;

            //Read Database
            DatabaseMgmt  dbObj = new DatabaseMgmt();
            SqlDataReader dR;

            dbObj.Connect();


            string strSqlCmd;

            strSqlCmd = $"select Name, ShopperID, SecurityQn, QnAnswer from Shopper where Name='{nameEmailViewTextBox.Text}' and passwd = '{passwordEmailViewTextBox.Text}'";

            dR = dbObj.ExecuteSelect(strSqlCmd);
            if (dR.Read())
            {
                MultiView1.SetActiveView(EmailView);
                Question = dR["SecurityQn"].ToString();
                QuestionEmailLabel.Text = Question;
            }
            else
            {
                QuestionEmailLabel.Text = "No Account found";
                MultiView1.SetActiveView(EmailView);
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Connect to the database
            DatabaseMgmt objdbMgmt = new DatabaseMgmt();

            objdbMgmt.Connect();

            string strSqlCmd;

            // System.Data.OleDb.OleDbDataReader objDataReader;
            System.Data.SqlClient.SqlDataReader objDataReader;

            double curOringalPrice;

            // Retrieve the details of product of a given product ID
            // from the database
            int intProductId;

            intProductId  = Convert.ToInt32(Request.QueryString["ProductId"]);
            strSqlCmd     = "SELECT * FROM Product WHERE ProductId=" + intProductId;
            objDataReader = objdbMgmt.ExecuteSelect(strSqlCmd);

            // Read the only record retrieved
            if (objDataReader.Read())
            {
                // Display the product title
                lblProductTitle.Text = (string)objDataReader["ProductTitle"];

                // Display the product description
                if (objDataReader["ProductDesc"] != DBNull.Value)
                {
                    lblProductDesc.Text = (string)objDataReader["ProductDesc"];
                }

                // Display the product image
                imgProduct.ImageUrl = "images/products/" + (string)objDataReader["ProductImage"];

                // Display the product price
                // Format to display two decimals
                curOringalPrice      = Convert.ToDouble(objDataReader["Price"]);
                lblProductPrice.Text = "$" + string.Format(Convert.ToString(curOringalPrice), "0.00");
                objDataReader.Close();
            }
            // Retrieve the dynamic attributes of a given product
            strSqlCmd = "SELECT an.AttributeName, pa.AttributeVal FROM AttributeName an INNER JOIN ProductAttribute pa ON an.AttributeNameID=pa.AttributeNameID WHERE pa.ProductID=" + intProductId;

            objDataReader = objdbMgmt.ExecuteSelect(strSqlCmd);

            // Bind the records to the data grid control
            dgAttribute.DataSource = objDataReader;
            dgAttribute.DataBind();

            objDataReader.Close();
            objdbMgmt.Close();
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseMgmt  objdbMgmt = new DatabaseMgmt();
            SqlDataReader dR;

            objdbMgmt.Connect();

            string strSqlCmd;

            strSqlCmd = $"select address,email,phone from Shopper where ShopperID='{Session["ShopperId"]}'";
            dR        = objdbMgmt.ExecuteSelect(strSqlCmd);

            nameTextBox.Text = (string)Session["Name"];
            if (dR.Read())
            {
                addressTextbox.Text = dR["address"].ToString();
                emailTextbox.Text   = dR["email"].ToString();
                phoneTextbox.Text   = dR["phone"].ToString();
            }
        }
Пример #6
0
        protected void PasswordFormSubmitButton_Click(object sender, EventArgs e)
        {
            string Question;

            //Read Database
            DatabaseMgmt  dbObj = new DatabaseMgmt();
            SqlDataReader dR;

            dbObj.Connect();


            string strSqlCmd;

            strSqlCmd = $"select Name, ShopperID, SecurityQn, QnAnswer from Shopper where Email='{emailDetailsTextBox.Text}'";

            dR = dbObj.ExecuteSelect(strSqlCmd);
            if (dR.Read())
            {
                Question = dR["QnAnswer"].ToString();

                if (AnswerTextBox.Text == Question)
                {
                    MultiView1.SetActiveView(PasswordChangeView);
                    Session["email"] = emailDetailsTextBox.Text;
                }
                else
                {
                    SecurityQnLabel.Text = "Wrong";
                    MultiView1.SetActiveView(PasswordView);
                }
            }
            else
            {
                SecurityQnLabel.Text = "No Account found!";
                MultiView1.SetActiveView(PasswordView);
            }
        }
Пример #7
0
        protected void ContinueButton_Click(object sender, EventArgs e)
        {
            string Question;

            //Read Database
            DatabaseMgmt  dbObj = new DatabaseMgmt();
            SqlDataReader dR;

            dbObj.Connect();

            string strSqlCmd;

            strSqlCmd = $"select SecurityQn, QnAnswer, Email, ShopperID from Shopper where Name='{nameEmailViewTextBox.Text}'";

            dR = dbObj.ExecuteSelect(strSqlCmd);
            if (dR.Read())
            {
                Question = dR["QnAnswer"].ToString();
                if (answerEmailViewTextBox.Text == Question)
                {
                    MultiView1.SetActiveView(EmailChangeView);
                    Session["name"]   = nameEmailViewTextBox.Text;
                    Session["passwd"] = passwordEmailViewTextBox.Text;
                }
                else
                {
                    MultiView1.SetActiveView(EmailView);
                    QuestionEmailLabel.Text = "Wrong Answer!";
                }
            }
            else
            {
                MultiView1.SetActiveView(EmailView);
                QuestionEmailLabel.Text = "No Account found!";
            }
        }
Пример #8
0
        protected void Update_Click(object sender, EventArgs e)
        {
            int          temp;
            string       sqlcmd = $"update shopper set address = '{addressTextbox.Text}', email = '{emailTextbox.Text}', passwd = '{pswTextBox.Text}', phone = '{phoneTextBox.Text}' where shopperid = '{Session["ShopperId"]}'";
            DatabaseMgmt dbObj  = new DatabaseMgmt();

            temp = dbObj.ExecuteNonQuery(sqlcmd);

            //Read the Database.
            DatabaseMgmt  objdbMgmt = new DatabaseMgmt();
            SqlDataReader dR;

            objdbMgmt.Connect();

            string strSqlCmd;

            strSqlCmd = $"select address,email,phone, passwd from Shopper where ShopperID='{Session["ShopperId"]}'";

            dR             = dbObj.ExecuteSelect(strSqlCmd);
            NameLabel.Text = (string)Session["Name"];
            if (dR.Read())
            {
                AddressLabel.Text = dR["address"].ToString();
                EmailLabel.Text   = dR["email"].ToString();
                PhoneLabel.Text   = dR["phone"].ToString();
            }

            int    other;
            string sqlcommands = $"Insert into shopper (DisplayName) VALUES ('{displaynameTextBox.Text}')" + $"Select DisplayName from ShopperID where ShopperID = '{Session["ShopperID"]}'";

            if (displayNameCheckBox.Checked == true)
            {
                DatabaseMgmt db = new DatabaseMgmt();
                other = db.ExecuteNonQuery(sqlcommands);

                objdbMgmt.Connect();

                string strSqlCmds;
                strSqlCmds = $"select DisplayName from Shopper where ShopperID='{Session["ShopperId"]}'";
                dR         = db.ExecuteSelect(strSqlCmds);
                if (dR.Read())
                {
                    displayNameLabel.Text = dR["DisplayName"].ToString();
                }
            }

            else
            {
                displayNameLabel.Text = "Unused";
            }

            msgLabel.Text = "Updated Information!";

            NameLabel.Visible     = true;
            PasswordLabel.Visible = true;
            AddressLabel.Visible  = true;
            EmailLabel.Visible    = true;
            PhoneLabel.Visible    = true;


            nameTextBox.Visible    = false;
            pswTextBox.Visible     = false;
            addressTextbox.Visible = false;
            emailTextbox.Visible   = false;
            phoneTextBox.Visible   = false;

            if (displaynameTextBox.Visible == true)
            {
                displaynameTextBox.Visible = false;
            }

            ConfirmButton.Visible = false;
            backButton.Visible    = false;
            EditButton.Visible    = true;
        }