Пример #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn chắc chắn muốn sửa không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (txtName.Text.Trim().Equals("") || txtPhone.Text.Trim().Equals(""))
         {
             MessageBox.Show("Nhập tên khách hàng và số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             var        id   = id_current.ToString();
             cls.Member c    = new cls.Member();
             string     mess = "";
             var        ok   = c.updateMember(id, txtName.Text.Trim(), txtBirthday.Text.Trim(), cboSex.SelectedValue.ToString(), txtPhone.Text.Trim(),
                                              txtAddress.Text.Trim(), txtEmail.Text.Trim(), txtNote.Text.Trim(), WindowsFormsApplication3.Form1.branch_type_id, out mess);
             if (ok)
             {
                 string name = txtName.Text.Trim();
                 resetControl();
                 MessageBox.Show("Đã cập nhật khách hàng [" + name + "]", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Chưa cập nhật được khách hàng [" + txtName.Text.Trim() + "]. " + mess, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
 }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            cls.Member c    = new cls.Member();
            string     mess = "";

            if (txtName.Text.Trim().Equals("") || txtPhone.Text.Trim().Equals(""))
            {
                MessageBox.Show("Nhập tên khách hàng và số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                var ok = c.insertMember(txtName.Text.Trim(), txtBirthday.Text.Trim(), cboSex.SelectedValue.ToString(), txtPhone.Text.Trim(),
                                        txtAddress.Text.Trim(), txtEmail.Text.Trim(), txtNote.Text.Trim(), WindowsFormsApplication3.Form1.branch_type_id, out mess);
                if (ok)
                {
                    string name = txtName.Text.Trim();
                    resetControl();
                    MessageBox.Show("Đã thêm khách hàng [" + name + "]", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Chưa thêm được khách hàng [" + txtName.Text.Trim() + "]. " + mess, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }