Exemplo n.º 1
0
        private void PData()//珆尨眈茼珅豪陓洘
        {
            string strID = ViewState["ID"].ToString();

            DBConn        myDB = new DBConn();
            string        sql  = "select * from Products where PID=" + strID;
            SqlDataReader dr   = myDB.getDataReader(sql);

            if (dr.Read())
            {
                strPID          = dr["PID"].ToString();
                lblPName.Text   = dr["PName"].ToString();
                strPName        = lblPName.Text;
                lblPFPrice.Text = double.Parse(dr["PFPrice"].ToString()).ToString("f2");
                lblPNPrice.Text = double.Parse(dr["PNPrice"].ToString()).ToString("f2");
                strPBewrite     = dr["PBewrite"].ToString();
                strPUseMode     = dr["PUseMode"].ToString();
                strPValidity    = dr["PValidity"].ToString();
                string strPStock = dr["PStock"].ToString();
                if (Int32.Parse(strPStock) > 0)
                {
                    strBuy = "<img src='images/car.gif'> [ <A target=_blank href='makeOrder.aspx?id=" + strPID + "'>在线购买</A> ]";
                }
                else
                {
                    strBuy = "[ 没有存货 ]";
                }
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 2
0
        private string getNewOrderID()//获取新的流水帐号
        {
            string strOrderID = "";

            DateTime myTime = System.DateTime.Now;

            strOrderID  = myTime.Year.ToString();
            strOrderID += myTime.Month.ToString("00");
            strOrderID += myTime.Day.ToString("00");
            strOrderID += myTime.Hour.ToString("00");
            strOrderID += myTime.Minute.ToString("00");
            strOrderID += myTime.Second.ToString("00");
            strOrderID += myTime.Millisecond.ToString("000");//毫秒

            DBConn        myDB = new DBConn();
            string        sql  = "select OID from [Order] order by OID desc";
            SqlDataReader dr   = myDB.getDataReader(sql);

            if (dr.Read())
            {
                string strTemp = dr["OID"].ToString();
                int    iTemp   = Int32.Parse(strTemp.Substring(strTemp.Length - 2, 2)) + 1;
                strOrderID += (iTemp % 100).ToString("00");
            }
            else
            {
                strOrderID += "00";
            }
            dr.Close();
            myDB.Close();

            return(strOrderID);
        }
Exemplo n.º 3
0
 private void CData()//分类列表绑定
 {
     DBConn myDB = new DBConn();
     string sql = "select * from Category";
     CRepeater.DataSource = myDB.getDataReader( sql );
     CRepeater.DataBind();
     myDB.Close();
 }
Exemplo n.º 4
0
 private void getNewDataList()//最新上架
 {
     DBConn myDB = new DBConn();
     string sql = "select top 6 * from Products order by PID desc";
     NDataList.DataSource = myDB.getDataReader( sql );
     NDataList.DataBind();
     myDB.Close();  
 }
Exemplo n.º 5
0
 private void getHotDataList()//热卖二手书
 {
     DBConn myDB = new DBConn();
     string sql = "select top 10 * from Products where PHot=1 order by PID desc";
     HDataList.DataSource = myDB.getDataReader( sql );
     HDataList.DataBind();
     myDB.Close();  
 }
        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.º 7
0
        private void getOrderData(string strOID, string strName, string strEmail)  //获取订单信息
        {
            DBConn        myDB = new DBConn();
            string        sql  = "select * from [Order] where OID='" + strOID + "' and TName='" + strName + "' and Email='" + strEmail + "'";
            SqlDataReader dr   = myDB.getDataReader(sql);

            if (dr.Read())
            {
                lblOrderID.Text = dr["OID"].ToString();

                if (dr["PID"].ToString() == "0")
                {
                    lblDetailP.Text = "<a href='P_OderInfo.aspx?id=" + dr["OID"].ToString() + "' target='_blank'>查看批量购买的产品详情</a>";
                }
                lblTName.Text      = dr["TName"].ToString();
                lblEmail.Text      = dr["Email"].ToString();
                lblPhone.Text      = dr["Phone"].ToString();
                lblPID.Text        = dr["PID"].ToString();
                lblPName.Text      = dr["PName"].ToString();
                lblPPrice.Text     = double.Parse(dr["PPrice"].ToString()).ToString("C");
                lblPNum.Text       = dr["PNum"].ToString();
                lblTotalPrice.Text = double.Parse(dr["TotalPrice"].ToString()).ToString("C");
                lblPubdate.Text    = dr["Pubdate"].ToString();
                lblOState.Text     = dr["OState"].ToString();

                string strOState = lblOState.Text;
                switch (strOState)
                {
                case "0":
                    strOState = "未处理";
                    break;

                case "1":
                    strOState = "完成";
                    break;

                case "2":
                    strOState = "等待";
                    break;

                default:
                    strOState = "其他";
                    break;
                }
                lblOState.Text = strOState;

                tableSelect.Visible = false;
                tableInfo.Visible   = true;
            }
            else
            {
                Response.Write("<script>");
                Response.Write("alert('找不到相应的订单资料!!!');");
                Response.Write("</script>");
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 8
0
        private void PData()//显示相应二手书信息
        {
            string strID = ViewState["ID"].ToString();

            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())
            {
                string strPID = "";
                strPID = dr["PID"].ToString();

                myImg.Src         = "showPP.aspx?id=" + strPID;
                lblPName.Text     = dr["PName"].ToString();
                lblPFPrice.Text   = double.Parse(dr["PFPrice"].ToString()).ToString("f2");
                lblPNPrice.Text   = double.Parse(dr["PNPrice"].ToString()).ToString("f2");
                lblTotalPric.Text = lblPNPrice.Text;

                ViewState["PCPrice"] = dr["PCPrice"].ToString();

                string strPStock = dr["PStock"].ToString();
                if (Int32.Parse(strPStock) > 0)
                {
                    lblIsStock.Text = "[仓库有货]";
                }
                else
                {
                    lblIsStock.Text = "[没有存货]";
                    btnOK.Enabled   = false;
                }
            }
            else
            {
                Response.Write("<script>");
                Response.Write("alert('没有这个二手书!!!');");
                Response.Write("</script>");
                dr.Close();
                myDB.Close();
                Response.Redirect("index.aspx");
                return;
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 9
0
        private void getNewDataList()//郔陔奻殤
        {
            DBConn myDB = new DBConn();
            string sql  = "select top 6 * from Products order by PID desc";

            NDataList.DataSource = myDB.getDataReader(sql);
            NDataList.DataBind();
            myDB.Close();
        }
Exemplo n.º 10
0
        private void CData()//煦濬蹈桶堂隅
        {
            DBConn myDB = new DBConn();
            string sql  = "select * from Category";

            CRepeater.DataSource = myDB.getDataReader(sql);
            CRepeater.DataBind();
            myDB.Close();
        }
Exemplo n.º 11
0
        private void getTJDataList()//儕芢熱
        {
            DBConn myDB = new DBConn();
            string sql  = "select top 10 * from Products where PCommend=1 order by PID desc";

            JRepeater.DataSource = myDB.getDataReader(sql);
            JRepeater.DataBind();
            myDB.Close();
        }
Exemplo n.º 12
0
        private void getHotDataList()//闖珅豪
        {
            DBConn myDB = new DBConn();
            string sql  = "select top 10 * from Products where PHot=1 order by PID desc";

            HDataList.DataSource = myDB.getDataReader(sql);
            HDataList.DataBind();
            myDB.Close();
        }
Exemplo n.º 13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                string Pid = Request.QueryString["id"].ToString();



                //检查库存

                string strNum = DropDownList1.SelectedValue;

                DBConn        myDB  = new DBConn();
                string        mySql = "select PStock from Products where PID=" + Pid;
                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();



                string tblUser = (String)Session["User"];
                string sql     = "insert into [tblBasket](tblUser,Pid,isN,isMoney) values ( '" + tblUser + "', '" + Pid + "', '" + strNum + "', " + lblCount.Text + ")";

                DBConn myDB1 = new DBConn();

                myDB1.ExecuteNonQuery(sql);
                myDB1.Close();

                Response.Write("<script>alert('加入购物车成功 ~');</script>");
            }
            else
            {
                Response.Write("<script>alert('未登陆无法收藏~');</script>");
            }
        }
Exemplo n.º 14
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.º 15
0
 private void setSelectClass()//绑定 类别选框
 {
     DBConn myDB = new DBConn();
     string mySql = "select CID,CName from Category order by CID desc";
     ddlClass.DataSource  = myDB.getDataReader( mySql );
     ddlClass.DataTextField = "CName";
     ddlClass.DataValueField = "CID";
     ddlClass.DataBind();
     myDB.Close();
     
     ddlClass.Items.Insert(0,new ListItem("所有分类","-1"));
 }
Exemplo n.º 16
0
        private void getOrderData( string strOID, string strName, string strEmail )//获取订单信息
        {
            DBConn myDB = new DBConn();
            string sql="select * from [Order] where OID='" + strOID + "' and TName='" + strName + "' and Email='" + strEmail + "'";
            SqlDataReader dr  = myDB.getDataReader( sql );
            if( dr.Read() )
            {
                lblOrderID.Text = dr["OID"].ToString();

               if(dr["PID"].ToString()=="0")   lblDetailP.Text = "<a href='P_OderInfo.aspx?id=" + dr["OID"].ToString() + "' target='_blank'>查看批量购买的产品详情</a>";
                lblTName.Text = dr["TName"].ToString();
                lblEmail.Text = dr["Email"].ToString();
                lblPhone.Text = dr["Phone"].ToString();
                lblPID.Text = dr["PID"].ToString();
                lblPName.Text = dr["PName"].ToString();
                lblPPrice.Text = double.Parse( dr["PPrice"].ToString() ).ToString("C");
                lblPNum.Text = dr["PNum"].ToString();
                lblTotalPrice.Text = double.Parse( dr["TotalPrice"].ToString() ).ToString("C");
                lblPubdate.Text = dr["Pubdate"].ToString();
                lblOState.Text = dr["OState"].ToString();

                string strOState = lblOState.Text;
                switch( strOState )
                {
                    case "0":
                        strOState = "未处理";
                        break;
                    case "1":
                        strOState = "完成";
                        break;
                    case "2":
                        strOState = "等待";
                        break;
                    default:
                        strOState = "其他";
                        break;
                }                                   
                lblOState.Text = strOState; 

                tableSelect.Visible = false;
                tableInfo.Visible = true;

            }
            else
            {
                Response.Write("<script>");
                Response.Write("alert('找不到相应的订单资料!!!');");
                Response.Write("</script>");
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 17
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.º 18
0
        private void setSelectClass()
        {
            DBConn myDB  = new DBConn();
            string mySql = "select CID,CName from Category order by CID desc";

            ddlClass.DataSource     = myDB.getDataReader(mySql);
            ddlClass.DataTextField  = "CName";
            ddlClass.DataValueField = "CID";
            ddlClass.DataBind();
            myDB.Close();

            ddlClass.Items.Insert(0, new ListItem("所有分类", "-1"));
        }
Exemplo n.º 19
0
        private void PData()//珅豪蹈桶堂隅
        {
            if (ViewState["CID"] == null)
            {
                MySqlPager SqlPager = new MySqlPager();
                SqlPager.setAttribute(SqlPager1, "PDataList", "select * from Products order by PID desc", "PID desc", 12);

                lblDaohang.Text = "所有鲜花";
            }
            else
            {
                string strCID = ViewState["CID"].ToString();
                DBConn myDB   = new DBConn();
                string sql    = "select * from Products where CID=" + strCID + " order by PID desc";
                try
                {
                    MySqlPager SqlPager = new MySqlPager();
                    SqlPager.setAttribute(SqlPager1, "PDataList", sql, "PID desc", 12);
                }
                catch
                {
                    Response.Write("<script>");
                    Response.Write("alert('没有记录!!!');");
                    Response.Write("</script>");
                    myDB.Close();
                    Response.Redirect("index.aspx");
                    return;
                }
                myDB.Close();

                DBConn        DB    = new DBConn();
                string        mySql = "select * from Category where CID=" + strCID;
                SqlDataReader dr    = DB.getDataReader(mySql);
                if (dr.Read())
                {
                    lblDaohang.Text = dr["CName"].ToString();
                }
                else
                {
                    Response.Write("<script>");
                    Response.Write("alert('没有这个类别!!!');");
                    Response.Write("</script>");
                    dr.Close();
                    DB.Close();
                    Response.Redirect("index.aspx");
                    return;
                }
                dr.Close();
                DB.Close();
            }
        }
Exemplo n.º 20
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.º 21
0
        private void HData()//煦濬勤茼腔种珅豪蹈桶堂隅
        {
            if (ViewState["CID"] == null)
            {
                DBConn myDB = new DBConn();
                string sql  = "SELECT TOP 5 * FROM Products WHERE PSellNum>0 ORDER BY PSellNum DESC,PID";
                HotRepeater.DataSource = myDB.getDataReader(sql);
                HotRepeater.DataBind();
                myDB.Close();
            }
            else
            {
                string strCID = ViewState["CID"].ToString();

                DBConn myDB = new DBConn();
                string sql  = "SELECT top 5 * From Products Where PSellNum>0 and CID=" + strCID + " order by PSellNum desc,PID";
                HotRepeater.DataSource = myDB.getDataReader(sql);
                HotRepeater.DataBind();
                myDB.Close();
            }
        }
Exemplo n.º 22
0
        private void DHData()//絳瑤沭扢离
        {
            string strCID = ViewState["CID"].ToString();

            if (ViewState["CID"] == null || ViewState["CID"].ToString() == String.Empty)
            {
                lblDaohang.Text = "所有鲜花";
            }
            else
            {
                DBConn        myDB = new DBConn();
                string        sql  = "select * from Category where CID=" + strCID;
                SqlDataReader dr   = myDB.getDataReader(sql);
                if (dr.Read())
                {
                    lblDaohang.Text = dr["CName"].ToString();
                }
                dr.Close();
                myDB.Close();
            }
        }
Exemplo n.º 23
0
        private bool isAdmin(string strAdmin, string strPassword)
        {
            bool bTemp = false;

            DBConn myDB = new DBConn();
            string mySql = "select * from tblUser where UserName='******' and Psw='" + strPassword + "'";
            SqlDataReader mydr = myDB.getDataReader(mySql);
            if (mydr.Read())
            {
                bTemp = true;
            }
            else
            {
                bTemp = false;
            }

            mydr.Close();
            myDB.Close();

            return bTemp;
        }
Exemplo n.º 24
0
        private void HData()//分类对应的热销二手书列表绑定
        {
            if (ViewState["CID"] == null || ViewState["CID"].ToString() == String.Empty)
            {
                DBConn myDB = new DBConn();
                string sql  = "SELECT TOP 5 * FROM Products WHERE PSellNum>0 ORDER BY PSellNum DESC,PID";
                HotRepeater.DataSource = myDB.getDataReader(sql);
                HotRepeater.DataBind();
                myDB.Close();
            }
            else
            {
                string strCID = ViewState["CID"].ToString();

                DBConn myDB = new DBConn();
                string sql  = "select top 5 * from Products where PSellNum>0 and CID=" + strCID + " order by PSellNum desc,PID";
                HotRepeater.DataSource = myDB.getDataReader(sql);
                HotRepeater.DataBind();
                myDB.Close();
            }
        }
Exemplo n.º 25
0
        private bool isAdmin(string strAdmin, string strPassword)
        {
            bool bTemp = false;

            DBConn        myDB  = new DBConn();
            string        mySql = "select * from tblUser where UserName='******' and Psw='" + strPassword + "'";
            SqlDataReader mydr  = myDB.getDataReader(mySql);

            if (mydr.Read())
            {
                bTemp = true;
            }
            else
            {
                bTemp = false;
            }

            mydr.Close();
            myDB.Close();

            return(bTemp);
        }
Exemplo n.º 26
0
        private string getNewOrderID()//获取新的流水帐号
        {
            string strOrderID = "";

            DateTime myTime = System.DateTime.Now;
            strOrderID = myTime.Year.ToString();
            strOrderID += myTime.Month.ToString("00");
            strOrderID += myTime.Day.ToString("00");
            strOrderID += myTime.Hour.ToString("00");
            strOrderID += myTime.Minute.ToString("00");
            strOrderID += myTime.Second.ToString("00");
            strOrderID += myTime.Millisecond.ToString("000");//毫秒

            DBConn myDB = new DBConn();
            string sql = "select OID from [Order] order by OID desc";
            SqlDataReader dr = myDB.getDataReader(sql);
            if (dr.Read())
            {
                string strTemp = dr["OID"].ToString();
                int iTemp = Int32.Parse(strTemp.Substring(strTemp.Length - 2, 2)) + 1;
                strOrderID += (iTemp % 100).ToString("00");
            }
            else
            {
                strOrderID += "00";
            }
            dr.Close();
            myDB.Close();

            return strOrderID;
        }
Exemplo n.º 27
0
        private void PData()//显示相应二手书信息
        {
            string strID = ViewState["ID"].ToString();

            DBConn myDB = new DBConn();
            string sql = "select * from Products where PID=" + strID;
            SqlDataReader dr = myDB.getDataReader(sql);
            if (dr.Read())
            {
                strPID = dr["PID"].ToString();
                lblPName.Text = dr["PName"].ToString();
                strPName = lblPName.Text;
                lblPFPrice.Text = double.Parse(dr["PFPrice"].ToString()).ToString("f2");
                lblPNPrice.Text = double.Parse(dr["PNPrice"].ToString()).ToString("f2");
                strPBewrite = dr["PBewrite"].ToString();
                strPUseMode = dr["PUseMode"].ToString();
                strPValidity = dr["PValidity"].ToString();
                string strPStock = dr["PStock"].ToString();
                if (Int32.Parse(strPStock) > 0)
                {
                    strBuy = "<img src='images/car.gif'> [ <A target=_blank href='makeOrder.aspx?id=" + strPID + "'>在线购买</A> ]";
                }
                else
                {
                    strBuy = "[ 没有存货 ]";
                }
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 28
0
        private void DHData()//导航条设置
        {
            string strCID = ViewState["CID"].ToString();

            if (ViewState["CID"] == null || ViewState["CID"].ToString() == String.Empty)
            {
                lblDaohang.Text = "所有二手书";
            }
            else
            {
                DBConn myDB = new DBConn();
                string sql = "select * from Category where CID=" + strCID;
                SqlDataReader dr = myDB.getDataReader(sql);
                if (dr.Read())
                {
                    lblDaohang.Text = dr["CName"].ToString();
                }
                dr.Close();
                myDB.Close();
            }
         
        }
Exemplo n.º 29
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.º 30
0
        private void PData()//显示相应二手书信息
        {
            string strID = ViewState["ID"].ToString();

            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())
            {
                string strPID = "";
                strPID = dr["PID"].ToString();

                myImg.Src = "showPP.aspx?id=" + strPID;
                lblPName.Text = dr["PName"].ToString();
                lblPFPrice.Text = double.Parse(dr["PFPrice"].ToString()).ToString("f2");
                lblPNPrice.Text = double.Parse(dr["PNPrice"].ToString()).ToString("f2");
                lblTotalPric.Text = lblPNPrice.Text;

                ViewState["PCPrice"] = dr["PCPrice"].ToString();

                string strPStock = dr["PStock"].ToString();
                if (Int32.Parse(strPStock) > 0)
                {
                    lblIsStock.Text = "[仓库有货]";
                }
                else
                {
                    lblIsStock.Text = "[没有存货]";
                    btnOK.Enabled = false;
                }
            }
            else
            {
                Response.Write("<script>");
                Response.Write("alert('没有这个二手书!!!');");
                Response.Write("</script>");
                dr.Close();
                myDB.Close();
                Response.Redirect("index.aspx");
                return;
            }
            dr.Close();
            myDB.Close();
        }
Exemplo n.º 31
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                string Pid = Request.QueryString["id"].ToString();


  
                //检查库存

                string strNum = DropDownList1.SelectedValue;

                DBConn myDB = new DBConn();
                string mySql = "select PStock from Products where PID=" + Pid;
                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();

                

                string tblUser = (String)Session["User"];
                string sql = "insert into [tblBasket](tblUser,Pid,isN,isMoney) values ( '" + tblUser + "', '" + Pid + "', '" + strNum + "', " + lblCount.Text +")";

                DBConn myDB1 = new DBConn();

                myDB1.ExecuteNonQuery(sql);
                myDB1.Close();

                Response.Write("<script>alert('加入购物车成功 ~');</script>");
            }
            else
            {
                Response.Write("<script>alert('未登陆无法收藏~');</script>");
            }
                  
        }
Exemplo n.º 32
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.º 33
0
 private void getTJDataList()//精品推荐
 {
     DBConn myDB = new DBConn();
     string sql = "select top 10 * from Products where PCommend=1 order by PID desc";
     JRepeater.DataSource = myDB.getDataReader( sql );
     JRepeater.DataBind();
     myDB.Close();  
 }
Exemplo n.º 34
0
        private void HData()//分类对应的热销二手书列表绑定
        {
            if( ViewState["CID"] == null )
            {
                DBConn myDB = new DBConn();
				string sql = "SELECT TOP 5 * FROM Products WHERE PSellNum>0 ORDER BY PSellNum DESC,PID";
                HotRepeater.DataSource = myDB.getDataReader( sql );
                HotRepeater.DataBind();
                myDB.Close();
            }
            else
            {
                string strCID = ViewState["CID"].ToString();

                DBConn myDB = new DBConn();
                string sql = "SELECT top 5 * From Products Where PSellNum>0 and CID=" + strCID + " order by PSellNum desc,PID";
                HotRepeater.DataSource = myDB.getDataReader( sql );
                HotRepeater.DataBind();
                myDB.Close();
            }
            
        }
Exemplo n.º 35
0
        private void PData()//二手书列表绑定
        {
            if( ViewState["CID"] == null )
            {
                MySqlPager SqlPager = new MySqlPager();
				SqlPager.setAttribute( SqlPager1, "PDataList", "select * from Products order by PID desc", "PID desc", 12);
                
                lblDaohang.Text = "所有二手书";
            }
            else
            {
                string strCID = ViewState["CID"].ToString();
                DBConn myDB = new DBConn();
                string sql="select * from Products where CID=" + strCID + " order by PID desc";
                try
                {
                    MySqlPager SqlPager = new MySqlPager();
					SqlPager.setAttribute( SqlPager1, "PDataList", sql, "PID desc", 12);
                }
                catch
                {
                    Response.Write("<script>");
                    Response.Write("alert('没有记录!!!');");
                    Response.Write("</script>");
                    myDB.Close();
                    Response.Redirect("index.aspx");
                    return;
                }
                myDB.Close();

                DBConn DB = new DBConn();
                string mySql = "select * from Category where CID=" + strCID;
                SqlDataReader dr = DB.getDataReader( mySql );
                if( dr.Read() )
                {
                    lblDaohang.Text = dr["CName"].ToString();
                }
                else
                {
                    Response.Write("<script>");
                    Response.Write("alert('没有这个类别!!!');");
                    Response.Write("</script>");
                    dr.Close();
                    DB.Close();
                    Response.Redirect("index.aspx");
                    return;
                }
                dr.Close();
                DB.Close();
            }
        }