예제 #1
0
    protected void ddlSelectId_SelectedIndexChanged(object sender, EventArgs e)
    {
        int sum = 0;
        BuyerDSTableAdapters.View_ChartDetailTableAdapter chartDA = new BuyerDSTableAdapters.View_ChartDetailTableAdapter();
        DataTable chartDT = chartDA.GetDataByPid(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "是");
        if (chartDT.Rows.Count != 0)
        {
            dlOrder.DataSource = chartDT;
            dlOrder.DataBind();
            for (int i = 0; i < chartDT.Rows.Count; i++)
            {
                Label lblProperity = (Label)dlOrder.Items[i].FindControl("lblProperity");
                Label lblPrice = (Label)dlOrder.Items[i].FindControl("lblAllPrice");

                BuyerDSTableAdapters.DM_colorTableAdapter colorDA = new BuyerDSTableAdapters.DM_colorTableAdapter();
                DataTable colorDT = colorDA.GetDataByColorId(chartDT.Rows[i][14].ToString());

                BuyerDSTableAdapters.DM_osTableAdapter osDA = new BuyerDSTableAdapters.DM_osTableAdapter();
                DataTable osDT = osDA.GetDataByOsId(chartDT.Rows[i][16].ToString());

                BuyerDSTableAdapters.DM_CPUTableAdapter cpuDA = new BuyerDSTableAdapters.DM_CPUTableAdapter();
                DataTable cpuDT = cpuDA.GetDataByCpuId(chartDT.Rows[i][17].ToString());

                if (colorDT.Rows.Count != 0 && osDT.Rows.Count != 0 && colorDT.Rows.Count != 0)
                {
                    lblProperity.Text = "颜色:" + colorDT.Rows[0][1].ToString()
                                      + " OS:" + osDT.Rows[0][1].ToString()
                                      + " CPU:" + cpuDT.Rows[0][1].ToString();
                }
                sum = int.Parse(lblPrice.Text.Substring(1));

            }
        }
        lblTotal.Text = "¥" + sum.ToString();
    }
예제 #2
0
    protected void imgbtnSubmit_Click1(object sender, ImageClickEventArgs e)
    {
        if (Session["Addr"] != null && Session["TelPhone"] != null && Session["RevName"] != null)
        {
            BuyerDSTableAdapters.View_ChartDetailTableAdapter chartDA = new BuyerDSTableAdapters.View_ChartDetailTableAdapter();
            DataTable chartDT = chartDA.GetDataByPid(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "是");

            if (chartDT.Rows.Count != 0)
            {
                int store = int.Parse(chartDT.Rows[0][21].ToString());
                int want  = int.Parse(chartDT.Rows[0][4].ToString());
                lblAddr.Text = System.Guid.Parse(chartDT.Rows[0][2].ToString()).ToString();
                int money = int.Parse(chartDT.Rows[0][5].ToString());
                BuyerDSTableAdapters.OrderInfoTableAdapter orderDA = new BuyerDSTableAdapters.OrderInfoTableAdapter();
                int orderDT = orderDA.InsertOrder(System.Guid.Parse(chartDT.Rows[0][2].ToString()),
                                                  System.Guid.Parse(Session["BuyerId"].ToString()),
                                                  long.Parse(ddlSelectId.SelectedValue.ToString()),
                                                  want,
                                                  DateTime.Now, "1", DateTime.Now, DateTime.Now,
                                                  Session["Addr"].ToString(),
                                                  Session["TelPhone"].ToString(),
                                                  Session["RevName"].ToString()
                                                  );
                if (orderDT != 0)
                {
                    BuyerDSTableAdapters.PhoneInfoTableAdapter storeDA = new BuyerDSTableAdapters.PhoneInfoTableAdapter();
                    int storeDT = storeDA.UpdateStore(store - want, long.Parse(ddlSelectId.SelectedValue.ToString()));
                    BuyerDSTableAdapters.ShopCartTableAdapter delDA = new BuyerDSTableAdapters.ShopCartTableAdapter();
                    int delDT = delDA.DeleteShopChart(long.Parse(chartDT.Rows[0][0].ToString()));
                    if (storeDT != 0 && delDT != 0)
                    {
                        BuyerDSTableAdapters.OrderInfoTableAdapter SearchOrderDA = new BuyerDSTableAdapters.OrderInfoTableAdapter();
                        DataTable SearchDT = SearchOrderDA.GetOrderId(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "1");
                        if (SearchDT.Rows.Count != 0)
                        {
                            string OrderId = SearchDT.Rows[0][0].ToString();
                            Response.Redirect("~/Buyer/Pay.aspx?OrderId=" + OrderId + "&OrderName=" + ddlSelectId.SelectedValue.ToString() + "&Money=" + money + "&RevName=" + Session["RevName"].ToString() + "&RevAddr=" + Session["Addr"].ToString() + "&RevTel=" + Session["TelPhone"].ToString());
                        }
                    }
                    else
                    {
                        Response.Write("<Script>alert('订单未能提交!')</Script>");
                        //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('订单未能提交!');", true);
                    }
                }
            }
        }
        else
        {
            Response.Write("<Script>alert('收货人信息不完整!')</Script>");
        }
    }
예제 #3
0
    protected void ddlSelectId_SelectedIndexChanged(object sender, EventArgs e)
    {
        int sum = 0;

        BuyerDSTableAdapters.View_ChartDetailTableAdapter chartDA = new BuyerDSTableAdapters.View_ChartDetailTableAdapter();
        DataTable chartDT = chartDA.GetDataByPid(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "是");

        if (chartDT.Rows.Count != 0)
        {
            dlOrder.DataSource = chartDT;
            dlOrder.DataBind();
            for (int i = 0; i < chartDT.Rows.Count; i++)
            {
                Label lblProperity = (Label)dlOrder.Items[i].FindControl("lblProperity");
                Label lblPrice     = (Label)dlOrder.Items[i].FindControl("lblAllPrice");

                BuyerDSTableAdapters.DM_colorTableAdapter colorDA = new BuyerDSTableAdapters.DM_colorTableAdapter();
                DataTable colorDT = colorDA.GetDataByColorId(chartDT.Rows[i][14].ToString());

                BuyerDSTableAdapters.DM_osTableAdapter osDA = new BuyerDSTableAdapters.DM_osTableAdapter();
                DataTable osDT = osDA.GetDataByOsId(chartDT.Rows[i][16].ToString());

                BuyerDSTableAdapters.DM_CPUTableAdapter cpuDA = new BuyerDSTableAdapters.DM_CPUTableAdapter();
                DataTable cpuDT = cpuDA.GetDataByCpuId(chartDT.Rows[i][17].ToString());

                if (colorDT.Rows.Count != 0 && osDT.Rows.Count != 0 && colorDT.Rows.Count != 0)
                {
                    lblProperity.Text = "颜色:" + colorDT.Rows[0][1].ToString()
                                        + " OS:" + osDT.Rows[0][1].ToString()
                                        + " CPU:" + cpuDT.Rows[0][1].ToString();
                }
                sum = int.Parse(lblPrice.Text.Substring(1));
            }
        }
        lblTotal.Text = "¥" + sum.ToString();
    }
예제 #4
0
    protected void imgbtnSubmit_Click1(object sender, ImageClickEventArgs e)
    {
        if (Session["Addr"] != null && Session["TelPhone"] != null && Session["RevName"] != null)
        {
            BuyerDSTableAdapters.View_ChartDetailTableAdapter chartDA = new BuyerDSTableAdapters.View_ChartDetailTableAdapter();
            DataTable chartDT = chartDA.GetDataByPid(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "是");

            if (chartDT.Rows.Count != 0)
            {
                int store = int.Parse(chartDT.Rows[0][21].ToString());
                int want = int.Parse(chartDT.Rows[0][4].ToString());
                lblAddr.Text = System.Guid.Parse(chartDT.Rows[0][2].ToString()).ToString();
                int money = int.Parse(chartDT.Rows[0][5].ToString());
                BuyerDSTableAdapters.OrderInfoTableAdapter orderDA = new BuyerDSTableAdapters.OrderInfoTableAdapter();
                int orderDT = orderDA.InsertOrder(System.Guid.Parse(chartDT.Rows[0][2].ToString()),
                                                  System.Guid.Parse(Session["BuyerId"].ToString()),
                                                  long.Parse(ddlSelectId.SelectedValue.ToString()),
                                                  want,
                                                  DateTime.Now, "1", DateTime.Now, DateTime.Now,
                                                  Session["Addr"].ToString(),
                                                  Session["TelPhone"].ToString(),
                                                  Session["RevName"].ToString()
                                                  );
                if (orderDT != 0)
                {
                    BuyerDSTableAdapters.PhoneInfoTableAdapter storeDA = new BuyerDSTableAdapters.PhoneInfoTableAdapter();
                    int storeDT = storeDA.UpdateStore(store - want, long.Parse(ddlSelectId.SelectedValue.ToString()));
                    BuyerDSTableAdapters.ShopCartTableAdapter delDA = new BuyerDSTableAdapters.ShopCartTableAdapter();
                    int delDT = delDA.DeleteShopChart(long.Parse(chartDT.Rows[0][0].ToString()));
                    if (storeDT != 0 && delDT != 0)
                    {
                        BuyerDSTableAdapters.OrderInfoTableAdapter SearchOrderDA = new BuyerDSTableAdapters.OrderInfoTableAdapter();
                        DataTable SearchDT = SearchOrderDA.GetOrderId(System.Guid.Parse(Session["BuyerId"].ToString()), long.Parse(ddlSelectId.SelectedValue.ToString()), "1");
                        if (SearchDT.Rows.Count != 0)
                        {
                            string OrderId = SearchDT.Rows[0][0].ToString();
                            Response.Redirect("~/Buyer/Pay.aspx?OrderId=" + OrderId + "&OrderName=" + ddlSelectId.SelectedValue.ToString() + "&Money=" + money + "&RevName=" + Session["RevName"].ToString() + "&RevAddr=" + Session["Addr"].ToString() + "&RevTel=" + Session["TelPhone"].ToString());
                        }
                    }
                    else
                    {
                        Response.Write("<Script>alert('订单未能提交!')</Script>");
                        //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('订单未能提交!');", true);
                    }
                }
            }
        }
        else
        {
            Response.Write("<Script>alert('收货人信息不完整!')</Script>");
        }
    }