示例#1
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (TextBox3.Text == "")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('Email can not be empty.')", true);
            return;
        }
        else if(TextBox4.Text==""||TextBox5.Text=="")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('Password can not be empty.')", true);
            return;
        }
        else if (TextBox4.Text != TextBox5.Text)
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('Passwords must be matched.')", true);
            return;
        }
        Table_Customer customer = new Table_Customer();
        customer.EmailAddress = TextBox3.Text;
        customer.Password = TextBox4.Text;
        customer.FirstName = customer.LastName = customer.PhoneNumber = customer.Sex = customer.CreditCardNumber = "";

        Dbc dbc = new Dbc();
        if (dbc.GetCustomer(customer.EmailAddress) == null)
        {
            dbc.AddCustomer(customer);
            Session["Customer"] = customer.EmailAddress;
            Panel1.Visible = false;
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('Email already Exist.')", true);
            return;
        }
    }
示例#2
0
        public List <Table_Customer> LoadTableList()
        {
            List <Table_Customer> tableList = new List <Table_Customer>();

            DataTable data = DataProvider.Instance.ExecuteQuery("GetTable_Customer");

            foreach (DataRow item in data.Rows)
            {
                Table_Customer table = new Table_Customer(item);
                tableList.Add(table);
            }

            return(tableList);
        }
示例#3
0
        public List <Table_Customer> GetListTable()
        {
            List <Table_Customer> list = new List <Table_Customer>();

            string query = "select * from Table_Customer";

            DataTable data = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                Table_Customer table_Customer = new Table_Customer(item);
                list.Add(table_Customer);
            }

            return(list);
        }
        // hàm xử lí sự kiện khi click vào button pay ( thanh toán ) hóa đơn, đồng thời xóa dữ liệu hiện tại ở bàn đấy
        private void btn_Thanhtoan_Click(object sender, EventArgs e)
        {
            Table_Customer table_customer = lsv_Bill.Tag as Table_Customer;

            int   idBill     = Bill_Status_DA.Instance.GetUncheckBillIDByTableID(table_customer.ID);
            float totalPrice = (float)Convert.ToDouble(txt_Total_Price.Text.Split(',')[0]) * 1000;

            if (idBill != -1)
            {
                if (MessageBox.Show("Bạn có chắc thanh toán hóa đơn cho bàn " + table_customer.Name, "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    Bill_Status_DA.Instance.Pay_Table_Customer(idBill, totalPrice);
                    HienThi_HoaDon(table_customer.ID);

                    Load_Table_Customer();
                }
            }
        }
        // Hàm xử lí sự kiện khi click select chọn products --> INSert bill mới vào database
        private void btn_Select_Click(object sender, EventArgs e)
        {
            Table_Customer table_customer = lsv_Bill.Tag as Table_Customer;

            int idBill = Bill_Status_DA.Instance.GetUncheckBillIDByTableID(table_customer.ID);
            int foodID = (cmb_Products.SelectedItem as Products).ID;
            int count  = (int)nmr_Add_Count.Value;

            if (idBill == -1)
            {
                Bill_Status_DA.Instance.InsertBill(table_customer.ID);
                Bill_Information_DA.Instance.InsertBillInfo(Bill_Status_DA.Instance.GetMaxIDBill(), foodID, count);
            }
            else
            {
                Bill_Information_DA.Instance.InsertBillInfo(idBill, foodID, count);
            }

            HienThi_HoaDon(table_customer.ID);
            Load_Table_Customer();
        }
示例#6
0
 partial void DeleteTable_Customer(Table_Customer instance);
示例#7
0
 partial void UpdateTable_Customer(Table_Customer instance);
示例#8
0
 partial void InsertTable_Customer(Table_Customer instance);
示例#9
0
文件: Dbc.cs 项目: JNU-SAD/SAD
    //更新已存在用户
    public void UpdateCustomer(Table_Customer customer)
    {
        var q = from s in data.Table_Customer
                where s.EmailAddress == customer.EmailAddress
                select s;
        foreach (Table_Customer c in q)
        {
            c.CreditCardNumber = customer.CreditCardNumber;
            c.FirstName = customer.FirstName;
            c.LastName = customer.LastName;
            c.Password = customer.Password;
            c.PhoneNumber = customer.PhoneNumber;
            c.Sex = customer.Sex;

        }
        data.SubmitChanges();
    }
示例#10
0
文件: Dbc.cs 项目: JNU-SAD/SAD
 //添加新用户
 public void AddCustomer(Table_Customer customer)
 {
     data.Table_Customer.InsertOnSubmit(customer);
     data.SubmitChanges();
 }