コード例 #1
0
ファイル: frmSupplier.cs プロジェクト: EricArita/QuanLiLKDT
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (button == "Add")
            {
                client = new ObjSupplier(txtSupplierCode.Text, txtName.Text, txtNote.Text);
                server = new LogicSupplier();
                DataSet dataset_Check = server.getDataBase(client);
                if (dataset_Check.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("Nhà cung cấp này đã tồn tại trong danh sách", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    server.setDataBase(client, button);
                    dataset_Check           = server.getDataBase("NguonCungCap");
                    dataGridView.DataSource = dataset_Check.Tables[0];
                }

                enable_button(0);
                button = "";
                return;
            }

            if (button == "Edit")
            {
                client_edited = new ObjSupplier(txtSupplierCode.Text, txtName.Text, txtNote.Text);
                server        = new LogicSupplier();
                server.editDataBase(client, client_edited);
                DataSet dataset_edit = server.getDataBase("NguonCungCap");
                dataGridView.DataSource = dataset_edit.Tables[0];
                enable_button(0);
                button = "";
                return;
            }
        }
コード例 #2
0
ファイル: frmSupplier.cs プロジェクト: EricArita/QuanLiLKDT
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Bạn có chắc muốn xóa loại sản phẩm này?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            button = "Delete";
            if (res == DialogResult.Yes)
            {
                client = new ObjSupplier(txtSupplierCode.Text, txtName.Text, txtNote.Text);
                server = new LogicSupplier();
                server.setDataBase(client, button);
                DataSet dataset_AfterDeleting = server.getDataBase("NguonCungCap");
                dataGridView.DataSource = dataset_AfterDeleting.Tables[0];
            }
        }