예제 #1
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            Label lblPayment          = (Label)Repeater1.FindControl("lblID_Payment");
            Cls_ShopsOrdersDetail cls = new Cls_ShopsOrdersDetail();

            //Cls_Users user = Session["WebsiteUser"] as Cls_Users;
            cls.ID_Payment = Convert.ToInt32(lblPayment.Text);
            // cls.ID_Payment = 1;
            cls.ID_User  = 2;
            cls.UserName = "";
            //if (Session["WebsiteUser"] != null)
            //{
            //    int ID_WebUser = user.ID_User;
            //    cls.ID_User = ID_WebUser;
            //}
            //else
            //{
            //    cls.ID_User = 2;
            //}
            cls.OrdersName = txtFullName.Text;
            //if (Session["WebsiteUser"] != null)
            //{
            //    string WebUserName = user.UserName;
            //    cls.UserName = WebUserName;
            //}
            //else
            //{
            //    cls.UserName = "";
            //}
            cls.UserEmail   = txtEmail.Text;
            cls.UserAddress = txtAddress.Text;
            cls.UserPhone   = txtPhoneNumber.Text;
            cls.PriceTotal  = Convert.ToDouble(getTotal());
            //cls.PriceTotal = 1111111;
            cls.Description = txtDescription.Text;
            //cls.AddTime = DateTime.Now;
            //cls.EditTime = DateTime.Now;
            cls.AddTime  = Convert.ToDateTime(txtDatePick.Text);
            cls.EditTime = Convert.ToDateTime(txtDayOff.Text);
            cls.Hidden   = true;
            if (cls.doInsert() == 1)
            {
                SendMaiInfor(txtEmail.Text);
                string sMessages = "alert('Đã đặt hàng thành công!');";
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", sMessages, true);
            }
            else
            {
                string sMessages = "alert('Đã xảy ra lỗi trong quá trình đặt hàng! Bạn vui lòng kiểm tra lại!');";
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", sMessages, true);
            }
        }