コード例 #1
0
        //sửa nhà cung cấp
        private void button8_Click(object sender, EventArgs e)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = suamanhacungcaptxt.Text;
            entity.TENNHACUNGCAP = suatennhacungcaptxt.Text;
            entity.DIACHI        = suadiachinhacungcaptxt.Text;
            entity.DIENTHOAI     = suadienthoainhacungcaptxt.Text;

            nhacungcapbus bus = new nhacungcapbus();

            bool success = bus.update(entity);

            common.successorerror(success);
            if (success)
            {
                errorProvider1.Clear();
                common.ClearTextBoxes(tabPage9);
                nhacungcapdgv.DataSource = bus.findall(textBox1.Text);
                nhacungcapdgv.Columns["PHIEUNHAPHANGs"].Visible = false;
            }
            else
            {
                ViewErrors(bus.validatedictionary);
            }
        }
コード例 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = textBox5.Text;
            entity.TENNHACUNGCAP = textBox6.Text;
            entity.DIACHI        = textBox7.Text;
            entity.DIENTHOAI     = textBox8.Text;

            nhacungcapbus bus = new nhacungcapbus();

            if (bus.update(entity))
            {
                MessageBox.Show("Cập nhật thành công");
            }
            else
            {
                MessageBox.Show("Lỗi");
            }
            dataGridView1.DataSource = bus.list();
        }