コード例 #1
0
ファイル: InsertCustomer.cs プロジェクト: HuuPhuoc0196/LTCSDL
        private void btnInsert_Click(object sender, EventArgs e)
        {
            string id, pass, name, address, email, phone, status;
            int    accumulation;

            id           = txtID.Text.Trim();
            pass         = txtPass.Text.Trim();
            name         = txtName.Text.Trim();
            address      = txtAddress.Text.Trim();
            email        = txtEmail.Text.Trim();
            phone        = txtPhone.Text.Trim();
            status       = txtStatus.Text.Trim();
            accumulation = Convert.ToInt32(txtAccumulation.Text.Trim());

            int RowsOfNumber = 0;

            try
            {
                CustomerBUS cus = new CustomerBUS();
                RowsOfNumber = cus.InsertCustomer(id, pass, name, address, email, phone, status, accumulation);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi " + ex.Message, "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (RowsOfNumber != 0)
            {
                MessageBox.Show("Bạn vừa thêm thành công nhân viên", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Cancel();
            }
        }
コード例 #2
0
 private void btnAddCus_Click(object sender, EventArgs e)
 {
     if (txtCName.Text != "" && txtCPhone.Text != "" && txtCEmail.Text != "" && txtCAddress.Text != "")
     {
         CustomerDTO customer_DTO = new CustomerDTO(txtCName.Text, txtCPhone.Text, txtCEmail.Text, txtCAddress.Text);
         if (customer_bus.InsertCustomer(customer_DTO))
         {
             MessageBox.Show("Adding success");
         }
         else
         {
             MessageBox.Show("Adding fail");
         }
     }
     else
     {
         MessageBox.Show("Please fill required data");
     }
     CustomerManagement_Load(sender, e);
     ClearData();
 }