Ejemplo n.º 1
0
        private void leaveWord()//蹦
        {
            DBConn myDB = new DBConn();
            string sql  = "select * from tblLeaveWord where PID=" + Request.QueryString["id"];

            strLeaveWord = "";
            DataSet ds1 = myDB.getDataSet(sql);

            foreach (DataRow row in ds1.Tables[0].Rows)
            {
                strLeaveWord += "<br>用户id:" + row["UserName"].ToString() + "-----------";
                strLeaveWord += row["isDate"].ToString() + "<br>";

                strLeaveWord += row["isNote"].ToString() + "<br>" + "<br>";
            }
            myDB.Close();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["myOrder"] == null)
                {
                    Response.Redirect("index.aspx");
                    return;
                }

                //返回操作
                if (Request.QueryString["key"] == null || Request.QueryString["key"].ToString() == String.Empty)
                {
                    Response.Redirect("index.aspx");
                    return;
                }
                string strBack = Request.QueryString["key"].ToString();
                strBack      = Server.UrlDecode(strBack);
                lblBack.Text = "<a href='index.aspx'>返回</a>";

                Order  myOrder       = (Order)Session["myOrder"];
                string strOID        = myOrder.OID;
                string strPID        = myOrder.PID;
                string strPName      = myOrder.PName;
                string strPNum       = myOrder.PNum;
                string strPPrice     = myOrder.PPrice;
                string strTotalPrice = myOrder.TotalPrice;
                string strTName      = myOrder.TName;
                string strEmail      = myOrder.Email;
                string strPhone      = myOrder.Phone;
                string strPCPrice    = myOrder.PCPrice;//成本


                strOID = getNewOrderID(); //订单号
                string sql  = "";
                DBConn myDB = new DBConn();


                if (strPID == "0")
                {
                    //没有ID 为批量购物的订单
                    //清空购物车,添加批量记录
                    strPName  = "批量购买产品,请查看详情";
                    strPNum   = "0";
                    strPPrice = "0";

                    sql = "select * from [viwBasket] where tblUser='******'order by ID desc";

                    DataSet ds1 = myDB.getDataSet(sql);


                    foreach (DataRow row in ds1.Tables[0].Rows)
                    {
                        string sql1 = "";
                        string tblUser, Pid, isN, isMoney, OrderNo;
                        tblUser = row["tblUser"].ToString();
                        isN     = row["isN"].ToString();
                        isMoney = row["isMoney"].ToString();
                        OrderNo = strOID;
                        Pid     = row["Pid"].ToString();

                        sql1 = "Insert into tblP_Order(tblUser,Pid,isN,isMoney,OrderNo) values ( '" +
                               tblUser + "', '" + Pid + "', '" + isN + "', " + isMoney + ", '" + OrderNo + "')";
                        myDB.ExecuteNonQuery(sql1);

                        myDB.ExecuteNonQuery("Update Products Set PStock = PStock - " + isN + ",PSellNum = PSellNum + " + isN + " WHERE PID = " + Pid);
                    }

                    sql = "delete from [tblBasket] where tblUser='******'";
                    myDB.ExecuteNonQuery(sql);//删除购物车


                    sql = "insert into [Order](OID,PID,PName,PNum,PPrice,TotalPrice,Pubdate,TName,Email,Phone,PCPrice) values('" +
                          strOID + "'," + strPID + ",'" + strPName + "'," + strPNum + "," + strPPrice + "," + strTotalPrice + ",'" +
                          DateTime.Now + "','" + strTName + "','" + strEmail + "','" + strPhone + "',0)";
                }
                else
                {
                    sql = "insert into [Order](OID,PID,PName,PNum,PPrice,TotalPrice,Pubdate,TName,Email,Phone,PCPrice) values('" +
                          strOID + "'," + strPID + ",'" + strPName + "'," + strPNum + "," + strPPrice + "," + strTotalPrice + ",'" +
                          DateTime.Now + "','" + strTName + "','" + strEmail + "','" + strPhone + "'," + strPCPrice + ")";

                    myDB.ExecuteNonQuery("Update Products Set PStock = PStock - " + strPNum + ",PSellNum = PSellNum + " + strPNum + " WHERE PID = " + strPID);
                }


                myDB.ExecuteNonQuery(sql);


                myOrder.OID        = strOID;
                Session["myOrder"] = myOrder;

                if (strPID == "0")
                {
                    lblDetailP.Text = "<a href='P_OderInfo.aspx?id=" + strOID + "' target='_blank'>查看批量购买的产品详情</a>";
                }

                lblOrderID.Text    = strOID;
                lblPName.Text      = strPName;
                lblPNum.Text       = strPNum;
                lblPPrice.Text     = strPPrice;
                lblTotalPrice.Text = strTotalPrice;
                lblTName.Text      = strTName;
                lblEmail.Text      = strEmail;
                lblPhone.Text      = strPhone;
                Label1.Text        = myDB.LookUp("select * from tbluser where UserName='******'", "真实姓名");

                myDB.Close();
            }
        }
Ejemplo n.º 3
0
        private void leaveWord()//评论
        {
            DBConn myDB = new DBConn();
            string sql = "select * from tblLeaveWord where PID=" + Request.QueryString["id"];
            strLeaveWord = "";
            DataSet ds1 = myDB.getDataSet(sql);
            foreach (DataRow row in ds1.Tables[0].Rows)
            {
                strLeaveWord += "<br>用户id:" + row["UserName"].ToString() + "-----------";
                strLeaveWord += row["isDate"].ToString() + "<br>" ;

                strLeaveWord += row["isNote"].ToString() + "<br>" + "<br>";
            }
            myDB.Close();

        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["myOrder"] == null)
                {
                    Response.Redirect("index.aspx");
                    return;
                }

                //返回操作
                if (Request.QueryString["key"] == null || Request.QueryString["key"].ToString() == String.Empty)
                {
                    Response.Redirect("index.aspx");
                    return;
                }
                string strBack = Request.QueryString["key"].ToString();
                strBack = Server.UrlDecode(strBack);
                lblBack.Text = "<a href='index.aspx'>返回</a>";

                Order myOrder = (Order)Session["myOrder"];
                string strOID = myOrder.OID;
                string strPID = myOrder.PID;
                string strPName = myOrder.PName;
                string strPNum = myOrder.PNum;
                string strPPrice = myOrder.PPrice;
                string strTotalPrice = myOrder.TotalPrice;
                string strTName = myOrder.TName;
                string strEmail = myOrder.Email;
                string strPhone = myOrder.Phone;
                string strPCPrice = myOrder.PCPrice;//成本


                strOID = getNewOrderID(); //订单号
                string sql = "";
                DBConn myDB = new DBConn();

              
                    if (strPID == "0")
                    {
                        //没有ID 为批量购物的订单
                        //清空购物车,添加批量记录
                        strPName = "批量购买产品,请查看详情";
                        strPNum = "0";
                        strPPrice = "0";

                        sql = "select * from [viwBasket] where tblUser='******'order by ID desc";

                        DataSet ds1 = myDB.getDataSet(sql);


                        foreach (DataRow row in ds1.Tables[0].Rows)
                        {
                            string sql1 = "";
                            string tblUser, Pid, isN, isMoney, OrderNo;
                            tblUser = row["tblUser"].ToString();
                            isN = row["isN"].ToString();
                            isMoney = row["isMoney"].ToString();
                            OrderNo = strOID;
                            Pid = row["Pid"].ToString();

                            sql1 = "Insert into tblP_Order(tblUser,Pid,isN,isMoney,OrderNo) values ( '" +
                                tblUser + "', '" + Pid + "', '" + isN + "', " + isMoney + ", '" + OrderNo + "')";
                            myDB.ExecuteNonQuery(sql1);


                        }

                        sql = "delete from [tblBasket] where tblUser='******'";
                       myDB.ExecuteNonQuery(sql);//删除购物车
                        

                        sql = "insert into [Order](OID,PID,PName,PNum,PPrice,TotalPrice,Pubdate,TName,Email,Phone,PCPrice) values('" +
                         strOID + "'," + strPID + ",'" + strPName + "'," + strPNum + "," + strPPrice + "," + strTotalPrice + ",'" +
                         DateTime.Now + "','" + strTName + "','" + strEmail + "','" + strPhone + "',0)";
                    

                    }
                    else
                    {
                        sql = "insert into [Order](OID,PID,PName,PNum,PPrice,TotalPrice,Pubdate,TName,Email,Phone,PCPrice) values('" +
                              strOID + "'," + strPID + ",'" + strPName + "'," + strPNum + "," + strPPrice + "," + strTotalPrice + ",'" +
                              DateTime.Now + "','" + strTName + "','" + strEmail + "','" + strPhone + "'," + strPCPrice + ")";


                    }

                    myDB.ExecuteNonQuery(sql);
                  

                    myOrder.OID = strOID;
                    Session["myOrder"] = myOrder;

                    if (strPID == "0") lblDetailP.Text = "<a href='P_OderInfo.aspx?id=" + strOID + "' target='_blank'>查看批量购买的产品详情</a>";

                lblOrderID.Text = strOID;
                lblPName.Text = strPName;
                lblPNum.Text = strPNum;
                lblPPrice.Text = strPPrice;
                lblTotalPrice.Text = strTotalPrice;
                lblTName.Text = strTName;
                lblEmail.Text = strEmail;
                lblPhone.Text = strPhone;
                Label1.Text = myDB.LookUp("select * from tbluser where UserName='******'", "真实姓名");

                      myDB.Close();
            }
        }