Example #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            NCCPTien exited = NCCPTien.Single(Code);
            NCCPTien newAdd = controls_Load();

            if (exited.TenNCC != newAdd.TenNCC)
            {
                if (NCCPTien.FindByTenNCC(newAdd.TenNCC) != null)
                {
                    MessageBox.Show("This supplier had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    btnAdd.Enabled = false;
                    return;
                }
            }

            int affected = NCCPTien.Update(newAdd);

            if (affected > 0)
            {
                MessageBox.Show("Updating is successfull!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void controls_LoadUp()
        {
            NCCPTien nc = NCCPTien.Single(Code);

            txtName.Text    = nc.TenNCC;
            txtAddress.Text = nc.DiaChi;
            txtPhone.Text   = nc.DienThoai;
        }
Example #3
0
        private void btnView_Click(object sender, EventArgs e)
        {
            Supplierform frm = new Supplierform();
            NCCPTien     nc  = cbbSupplier.SelectedItem as NCCPTien;

            frm.Code = NCCPTien.Single(nc.ID).ID;
            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                cbbSupplier_Load();
            }
        }