示例#1
0
        public void GVOder()
        {
            string gridtext = "select order_id,order_name from [order]";

            GVList.DataSource = ConnSQL.SelectUnit(gridtext);
            GVList.DataBind();
        }
示例#2
0
        protected void Ordering_Click(object sender, EventArgs e)
        {
            DropDownList[] UnitRows = new DropDownList[GVMenu.Rows.Count];
            int[]          OrderNum = new int[GVMenu.Rows.Count];
            for (int i = 0; i < GVMenu.Rows.Count; i++)
            {
                UnitRows[i] = GVMenu.Rows[i].FindControl("DDL_Select") as DropDownList;
                OrderNum[i] = Convert.ToInt32(UnitRows[i].SelectedValue);
            }


            string SePeUn = "select order_unit,order_price from [order]";
            var    aa1    = ConnSQL.SelectUnit(SePeUn);

            int[] aa3        = new int[aa1.Rows.Count];
            int   TotalPrice = 0;

            for (int i = 0; i < aa1.Rows.Count; i++)
            {
                var a4 = Int32.Parse(aa1.Rows[i]["order_price"].ToString());
                var a2 = Convert.ToInt32(UnitRows[i].SelectedValue);
                var z6 = a4 * a2;
                aa3[i]      = z6;
                TotalPrice += aa3[i];
            }
            if (TotalPrice == 0)
            {
                Response.Write("<script>alert('กรุณาเลือกรายการอาหาร');</script>");
                return;
            }
            Session["ordernum"] = OrderNum;
            Session["price"]    = TotalPrice;
            Response.RedirectPermanent("Delivery.aspx");
        }
示例#3
0
        public void ShowGrid()
        {
            string gridtext = "select * from [order]";

            GVMenu.DataSource = ConnSQL.SelectUnit(gridtext);
            GVMenu.DataBind();
        }
示例#4
0
        protected void register_Click(object sender, EventArgs e)
        {
            SqlCommand RegisterUser = new SqlCommand("select * from member where member_name='" + ReUser.Text + "'", con);

            con.Open();
            SqlDataReader reader = RegisterUser.ExecuteReader();

            if (reader.Read())
            {
                Response.Write("<script>alert('มี Username นี้แล้ว');</script>");
                ReUser.Text = "";
                return;
            }
            con.Close();

            if (ReUser.Text == "" || RePass.Text == "" || ReFirt.Text == "" || ReLast.Text == "" || ReEmail.Text == "" || ReConPass.Text == "")
            {
                Response.Write("<script>alert('กรุณากรอกข้อมูลให้ครบ');</script>");
            }


            else if (ReConPass.Text == RePass.Text)
            {
                DbSQL data = new DbSQL()
                {
                    Member_name     = ReUser.Text,
                    Member_pass     = RePass.Text,
                    Member_myname   = ReFirt.Text,
                    Member_lastname = ReLast.Text,
                    Member_email    = ReEmail.Text,
                    Member_point    = 0
                };
                ConnSQL.insertMember(data);

                ReUser.Text          = "";
                ReFirt.Text          = "";
                ReLast.Text          = "";
                ReEmail.Text         = "";
                ReComplete.Visible   = true;
                ReComplete.ForeColor = System.Drawing.Color.Green;
                ReComplete.Text      = "ลงทะเบียนเรียบร้อย";
            }


            else if (RePass.Text != ReConPass.Text)
            {
                Response.Write("<script>alert('กรุณายืนยันรหัสผ่านอีกครั้ง');</script>");
            }
        }
示例#5
0
        protected void BTConfirm_Click(object sender, EventArgs e)
        {
            string[]  IdFood = { "0001", "0002", "0003", "0004", "0005", "0006", "0007", "0008", "0009", "0010", "0011", "0012" };
            DataSet[] aa2    = new DataSet[GVList.Rows.Count];
            var       aa1    = ConnSQL.SelectUnit("select * from [order]");

            int[]  a22           = (int[])Session["ordernum"];
            string OrderDelivery = "";

            for (int i = 0; i < GVList.Rows.Count; i++)
            {
                var a1 = Int32.Parse(aa1.Rows[i]["order_unit"].ToString());
                var a2 = a22[i];
                var a3 = a1 - a2;
                aa2[i]         = ConnSQL.UpdateUnit(IdFood[i], a3);
                OrderDelivery += IdFood[i] + '-' + a22[i] + ',';
            }

            if (TxtPoint.Text == "")
            {
                TxtPoint.Text = "0";
            }

            int idNum  = Convert.ToInt32(Session["member_id"]);
            int point2 = (Convert.ToInt32(TxtTotalPrice.Text) - 50) / 50;
            int point  = (Convert.ToInt32(LBPoint.Text) - Convert.ToInt32(TxtPoint.Text)) + point2;

            if (TxtAddress.Text != "")
            {
                DbSQL data = new DbSQL()
                {
                    dd_idUser     = (int)Session["member_id"],
                    dd_order      = OrderDelivery,
                    dd_totalPrice = TxtTotalPrice.Text,
                    dd_address    = TxtAddress.Text,
                    dd_usePoint   = TxtPoint.Text
                };
                ConnSQL.insertOrder(data);
                ConnSQL.updatePoint(point, idNum);
                Response.Write("<script>alert('ทำรายการเรียบร้อย');window.location='Inventory.aspx'</script>");
            }

            else if (TxtAddress.Text == "")
            {
                Response.Write("<script>alert('กรุณาใส่ที่อยู่ในการจัดส่ง');</script>");
                return;
            }
        }
示例#6
0
        public void RollDropdown()
        {
            string CheckRows = "select order_unit from [order]";
            var    a         = ConnSQL.SelectUnit(CheckRows);

            for (int i = 0; i < 12; i++)
            {
                var b   = Int32.Parse(a.Rows[i]["order_unit"].ToString());
                var DDL = GVMenu.Rows[i].FindControl("DDL_Select") as DropDownList;

                if (b < 5)
                {
                    DDL.Items.Clear();
                    for (int j = 0; j <= b; j++)
                    {
                        DDL.Items.Add(j.ToString());
                    }
                }
            }
        }