Exemplo n.º 1
0
        protected void btnSelect_Click(object sender, System.EventArgs e)
        {
            string strClass = ddlClass.SelectedValue;
            string strText  = txtSelect.Text;

            strText = CleanString.htmlInputText(strText);

            getSelectResult(strClass, strText);//脤戙
        }
Exemplo n.º 2
0
        public string strBuy       = ""; //湖荂婓盄劃鎗 麼 羶衄湔億


        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    string strID = Request.QueryString["id"].ToString();
                    strID = CleanString.htmlInputText(strID);

                    DBConn        myDB = new DBConn();
                    string        sql  = "select * from products where PID=" + strID;
                    SqlDataReader dr;
                    try
                    {
                        dr = myDB.getDataReader(sql);
                    }
                    catch
                    {
                        Response.Write("<script>");
                        Response.Write("alert('没有这个鲜花!!!');");
                        Response.Write("</script>");
                        Response.Redirect("index.aspx");
                        return;
                    }

                    if (dr.Read())
                    {
                        ViewState["CID"] = dr["CID"].ToString();
                    }
                    else
                    {
                        Response.Write("<script>");
                        Response.Write("alert('没有这个鲜花!!');");
                        Response.Write("</script>");
                        dr.Close();
                        myDB.Close();
                        Response.Redirect("index.aspx");
                        return;
                    }
                    dr.Close();
                    myDB.Close();

                    ViewState["ID"] = strID;
                }

                CData();
                HData();//煦濬勤茼腔种珅豪蹈桶堂隅
                DHData();

                leaveWord();

                setSelectClass();//堂隅 濬梗恁遺
            }
            PData();
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != String.Empty)
                {
                    if (Session["User"] != null)
                    {
                        txtName.Enabled = false;
                        txtName.Text    = (string)Session["User"];
                        DBConn db1 = new DBConn();
                        TextBox1.Text = db1.LookUp("select 真实姓名 from tblUser  where UserName='******'", "真实姓名");
                    }
                    else
                    {
                        Response.Write("<script>alert('未登陆禁止订购');window.close();</script>");
                        Response.End();
                        return;
                    }
                    string strID = Request.QueryString["id"].ToString();
                    strID           = CleanString.htmlInputText(strID);
                    ViewState["ID"] = strID;

                    PData();
                    string DBPath  = ConfigurationSettings.AppSettings["DataBasePath"];
                    string connStr = (DBPath);

                    SqlConnection con = new SqlConnection(connStr);
                    con.Open();
                    string         sql  = "select * from tblMode";
                    SqlDataAdapter sda1 = new SqlDataAdapter(sql, con);

                    DataSet ds1 = new DataSet();
                    sda1.Fill(ds1, "tblMode");

                    foreach (DataRow row in ds1.Tables[0].Rows)
                    {
                        this.dplBm.Items.Add(row["名称"].ToString());
                    }
                }
                else
                {
                    Response.Write("<script>");
                    Response.Write("alert('没有这个二手书!!!');");
                    Response.Write("</script>");
                    Response.Redirect("index.aspx");
                    return;
                }
                double dblNum = Int32.Parse(DropDownList1.SelectedValue) * double.Parse(lblPNPrice.Text);
                lblCount.Text = dblNum.ToString("f2");
            }
        }
Exemplo n.º 4
0
        private void getAnnounce()//鳳鼠豢陓洘
        {
            string mySql = "select * from append where id='3'";

            DBConn        myDB = new DBConn();
            SqlDataReader mydr = myDB.getDataReader(mySql);

            if (mydr.Read())
            {
                lblAnnounce.Text = CleanString.htmlOutputText(mydr["text"].ToString());
            }
            mydr.Close();
            myDB.Close();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>

        #endregion


        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            string strName  = txtName.Text.Trim();
            string strEmail = txtEmail.Text.Trim();
            string strPhone = txtPhone.Text.Trim();


            if (strName == String.Empty || strEmail == String.Empty || strPhone == String.Empty)
            {
                Response.Write("<script>");
                Response.Write("alert('请把必填项添上!!!');");
                Response.Write("</script>");
                return;
            }


            if (lblTotalPric.Text == String.Empty || lblTotalPric.Text == "0")
            {
                Response.Write("<script>");
                Response.Write("alert('购物车空,没办法生成订单!!!');");
                Response.Write("</script>");
                return;
            }


            if (Session["CheckCode"].ToString() != txtCheck.Text.Trim())
            {
                Response.Write("<script>");
                Response.Write("alert('输入的验证码有误!请重新输入!')");
                Response.Write("</script>");
                return;
            }

            Order myOrder = new Order();

            myOrder.PID        = "0"; //特定批量购物的标识
            myOrder.TotalPrice = lblTotalPric.Text;
            myOrder.TName      = CleanString.htmlInputText(strName);
            myOrder.Email      = strEmail;
            myOrder.Phone      = CleanString.htmlInputText(strPhone);

            Session["myOrder"] = myOrder;
            Response.Redirect("orderinfo.aspx?key=" + Server.UrlEncode("makeOrder.aspx?id="));
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["CID"] = null;

                if (Request.QueryString["cid"] != null)
                {
                    string strCID = Request.QueryString["cid"].ToString();
                    ViewState["CID"] = CleanString.htmlInputText(strCID);
                }

                CData();          //煦濬蹈桶堂隅
                PData();          //珅豪蹈桶堂隅
                HData();          //煦濬勤茼腔种珅豪蹈桶堂隅

                setSelectClass(); //堂隅濬梗
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["CID"] = null;

                if (Request.QueryString["cid"] != null)
                {
                    string strCID = Request.QueryString["cid"].ToString();
                    ViewState["CID"] = CleanString.htmlInputText(strCID);
                }

                CData();          //分类列表绑定
                PData();          //二手书列表绑定
                HData();          //分类对应的热销二手书列表绑定

                setSelectClass(); //绑定类别
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                setSelectClass();                                                                //堂隅濬梗

                if (Request.QueryString["class"] != null && Request.QueryString["text"] != null) //婓翋珜換徹懂腔刲坰腔濬倰睿珅豪靡
                {
                    string strClass = Request.QueryString["class"].ToString();
                    string strText  = Request.QueryString["text"].ToString();

                    strClass = CleanString.htmlInputText(strClass);
                    strText  = CleanString.htmlInputText(Server.UrlDecode(strText));

                    CData();                            //煦濬蹈桶堂隅
                    getSelectResult(strClass, strText); //脤戙
                }
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                setSelectClass();                                                                //绑定类别

                if (Request.QueryString["class"] != null && Request.QueryString["text"] != null) //在主页传过来的搜索的类型和二手书名
                {
                    string strClass = Request.QueryString["class"].ToString();
                    string strText  = Request.QueryString["text"].ToString();

                    strClass = CleanString.htmlInputText(strClass);
                    strText  = CleanString.htmlInputText(Server.UrlDecode(strText));

                    CData();                            //分类列表绑定
                    getSelectResult(strClass, strText); //查询
                }
            }
        }
Exemplo n.º 10
0
        private void ibtnSelect_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            string strOrderid = txtOrderid.Text.Trim();
            string strName    = txtName.Text.Trim();
            string strEmail   = txtEmail.Text.Trim();

            if (strOrderid == String.Empty || strName == String.Empty || strEmail == String.Empty)
            {
                Response.Write("<script>");
                Response.Write("alert('订单相应资料不能为空!!!');");
                Response.Write("</script>");
                return;
            }

            strOrderid = CleanString.htmlInputText(strOrderid);
            strName    = CleanString.htmlInputText(strName);
            strEmail   = CleanString.htmlInputText(strEmail);

            getOrderData(strOrderid, strName, strEmail);  //获取订单信息
        }
Exemplo n.º 11
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            string strID    = ViewState["ID"].ToString();
            string strName  = txtName.Text.Trim();
            string strEmail = txtEmail.Text.Trim();
            string strPhone = txtPhone.Text.Trim();
            string strNum   = ddlNum.SelectedValue;

            if (strName == String.Empty || strEmail == String.Empty || strPhone == String.Empty)
            {
                Response.Write("<script>");
                Response.Write("alert('请把必填项添上!!!');");
                Response.Write("</script>");
                return;
            }
            //   if (Session["CheckCode"] == null)
            // {
            //     Response.Redirect("index.aspx");
            //    return;
            // }
            if (Session["CheckCode"].ToString() != txtCheck.Text.Trim())
            {
                Response.Write("<script>");
                Response.Write("alert('输入的验证码有误!请重新输入!')");
                Response.Write("</script>");
                return;
            }

            //检查库存
            DBConn        myDB  = new DBConn();
            string        mySql = "select PStock from Products where PID=" + strID;
            SqlDataReader mydr  = myDB.getDataReader(mySql);

            if (mydr.Read())
            {
                int iPStock = Int32.Parse(mydr["PStock"].ToString());
                if (iPStock < int.Parse(strNum))
                {
                    Response.Write("<script>");
                    Response.Write("alert('库存不足!!!现在库存还有[ " + iPStock.ToString() + " ]');");
                    Response.Write("</script>");
                    return;
                }
            }
            else
            {
                Response.Write("<script>");
                Response.Write("alert('没有这个二手书!!!');");
                Response.Write("</script>");
                mydr.Close();
                myDB.Close();
                Response.Redirect("index.aspx");
                return;
            }
            mydr.Close();
            myDB.Close();

            Order myOrder = new Order();

            myOrder.PID        = strID;
            myOrder.PName      = lblPName.Text;
            myOrder.PNum       = strNum.ToString();
            myOrder.PPrice     = lblPNPrice.Text;
            myOrder.TotalPrice = lblTotalPric.Text;
            myOrder.TName      = CleanString.htmlInputText(strName);
            myOrder.Email      = strEmail;
            myOrder.Phone      = CleanString.htmlInputText(strPhone);
            if (ViewState["PCPrice"] != null)
            {
                myOrder.PCPrice = ViewState["PCPrice"].ToString();
            }


            Session["myOrder"] = myOrder;

            if (Session["SubmitCheck"] != null)
            {
                DateTime myDTime = (DateTime)Session["SubmitCheck"];
                if (myDTime.AddMilliseconds(30000) > DateTime.Now)
                {
                    Response.Write("<script>");
                    TimeSpan myTime = DateTime.Now - (DateTime)Session["SubmitCheck"];
                    Response.Write("alert('不能频繁提交,请在" + (30 - myTime.Seconds) + "秒后继续!!!');");
                    Response.Write("</script>");
                    return;
                }
            }
            Session["SubmitCheck"] = DateTime.Now;

            Response.Redirect("orderinfo.aspx?key=" + Server.UrlEncode("makeOrder.aspx?id=" + ViewState["ID"].ToString()));
        }
Exemplo n.º 12
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            string strUName    = txtUserName.Text.Trim();
            string strUPhone   = txtUserPhone.Text.Trim();
            string strUEmail   = txtEmail.Text.Trim();
            string strMTitle   = txtTitle.Text.Trim();
            string strMContent = txtContent.Text.Trim();

            if (strUEmail == String.Empty || strMTitle == String.Empty || strMContent == String.Empty)
            {
                Response.Write("<script>");
                Response.Write("alert('请把必填项添上!!!');");
                Response.Write("</script>");
                return;
            }
            if (strMContent.Length > 300)
            {
                Response.Write("<script>");
                Response.Write("alert('内容太长了..(300字以内)!!!');");
                Response.Write("</script>");
                return;
            }

            //防止恶意刷信息
            if (Session["messageCheck"] != null)
            {
                DateTime myDTime = (DateTime)Session["messageCheck"];
                if (myDTime.AddMilliseconds(30000) > DateTime.Now)
                {
                    Response.Write("<script>");
                    TimeSpan myTime = DateTime.Now - (DateTime)Session["messageCheck"];
                    Response.Write("alert('不能频繁提交,请在" + (30 - myTime.Seconds) + "秒后继续!!!');");
                    Response.Write("</script>");
                    return;
                }
            }

            //过滤输入字符串
            strUName    = CleanString.htmlInputText(strUName);
            strUPhone   = CleanString.htmlInputText(strUPhone);
            strUEmail   = CleanString.htmlInputText(strUEmail);
            strMTitle   = CleanString.htmlInputText(strMTitle);
            strMContent = CleanString.htmlInputText(strMContent);

            string mySql = "insert into [message](UName,UPhone,UEmail,MTitle,MContent,Pubdate) values('" +
                           strUName + "','" + strUPhone + "','" + strUEmail + "','" + strMTitle
                           + "','" + strMContent + "','" + DateTime.Now + "')";
            DBConn myDB = new DBConn();

            myDB.ExecuteNonQuery(mySql);
            myDB.Close();

            Session["messageCheck"] = DateTime.Now; //防止恶意刷信息 记录提交时间

            Response.Write("<script>");
            Response.Write("alert('成功提交!')");
            Response.Write("</script>");
            txtUserName.Text  = "";
            txtUserPhone.Text = "";
            txtEmail.Text     = "";
            txtTitle.Text     = "";
            txtContent.Text   = "";
        }