コード例 #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
        //tìm kiếm nhà cung cấp
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            nhacungcapbus bus = new nhacungcapbus();

            nhacungcapdgv.DataSource = bus.findall(textBox1.Text);
            nhacungcapdgv.Columns["PHIEUNHAPHANGs"].Visible = false;
        }
コード例 #3
0
 public void loadcombobox()
 {
     if (listnhacungcap(cbmancc))
     {
         nhacungcapbus bus = new nhacungcapbus();
         txtsuatenncc.Text = bus.getname(cbmancc.SelectedItem.ToString());
     }
 }
コード例 #4
0
 public void loadlistnhacc()
 {
     if (listnhacungcap(manhacungcapcb))
     {
         nhacungcapbus bus = new nhacungcapbus();
         mancctxt.Text = bus.getname(manhacungcapcb.SelectedItem.ToString());
     }
 }
コード例 #5
0
        private bool listnhacungcap(ComboBox cb)
        {
            nhacungcapbus bus = new nhacungcapbus();

            if (bus.any())
            {
                cb.DataSource = bus.getids();
                return(true);
            }
            return(false);
        }
コード例 #6
0
        //lấy danh sách nhà cung cấp
        private void button5_Click(object sender, EventArgs e)
        {
            nhacungcapbus bus = new nhacungcapbus();

            nhacungcapdgv.DataSource = bus.list();
            nhacungcapdgv.Columns["MANHACUNGCAP"].HeaderText  = "Mã nhà cung cấp";
            nhacungcapdgv.Columns["TENNHACUNGCAP"].HeaderText = "Tên nhà cung cấp";
            nhacungcapdgv.Columns["DIACHI"].HeaderText        = "Địa chỉ";
            nhacungcapdgv.Columns["DIENTHOAI"].HeaderText     = "Điện thoại";
            nhacungcapdgv.Columns["PHIEUNHAPHANGs"].Visible   = false;
        }
コード例 #7
0
        //load dữ liệu lên sửa phiếu
        private void suaphieu(object sender, EventArgs args)
        {
            tabControl4.SelectedTab = tabPage13;
            panel12.Visible         = true;
            splitContainer3.Visible = false;
            madonnhap           = (int)danhsachdonnhapdgv.SelectedCells[0].Value;
            maphieunhaplbl.Text = madonnhap.ToString();

            dateTimePicker4.Text = danhsachdonnhapdgv.SelectedCells[1].Value.ToString();
            if (listnhacungcap(cbmancc))
            {
                //load thông tin nhân viên đang đăng nhập
                txtsuamanvhientai.Text = currentuser.user;
                //load dữ liệu vào combobox manhacungcapcb
                nhacungcapbus bus = new nhacungcapbus();
                txtsuatenncc.Text = bus.getname(cbmancc.SelectedItem.ToString());
            }

            txtsuamanv.Text = danhsachdonnhapdgv.SelectedCells[3].Value.ToString();
        }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = textBox1.Text;
            entity.TENNHACUNGCAP = textBox2.Text;
            entity.DIACHI        = textBox3.Text;
            entity.DIENTHOAI     = textBox4.Text;

            nhacungcapbus bus = new nhacungcapbus();

            if (bus.add(entity))
            {
                MessageBox.Show("Nhập thành công");
            }
            else
            {
                MessageBox.Show("Lỗi");
            }
        }
コード例 #9
0
        private void Delete_Click(object sender, EventArgs args)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = dataGridView1.SelectedCells[0].Value.ToString();
            entity.TENNHACUNGCAP = dataGridView1.SelectedCells[1].Value.ToString();
            entity.DIACHI        = dataGridView1.SelectedCells[2].Value.ToString();
            entity.DIENTHOAI     = dataGridView1.SelectedCells[3].Value.ToString();

            nhacungcapbus bus = new nhacungcapbus();

            if (bus.delete(entity))
            {
                MessageBox.Show("Xóa thành công");
            }
            else
            {
                MessageBox.Show("Lỗi");
            }
            dataGridView1.DataSource = bus.list();
        }
コード例 #10
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();
        }
コード例 #11
0
        //nhập nhà cung cấp mới
        private void button3_Click(object sender, EventArgs e)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = manhacungcaptxt.Text;
            entity.TENNHACUNGCAP = tennhacungcaptxt.Text;
            entity.DIACHI        = diachinhacungcaptxt.Text;
            entity.DIENTHOAI     = dienthoainhacungcaptxt.Text;
            nhacungcapbus bus     = new nhacungcapbus();
            bool          success = bus.add(entity);

            common.successorerror(success);
            if (success)
            {
                errorProvider1.Clear();
            }
            else
            {
                ViewErrors(bus.validatedictionary);
            }
        }
コード例 #12
0
        //load mã nhà cung cấp vào combobox
        private bool listnhacungcap()
        {
            nhacungcapbus bus = new nhacungcapbus();

            if (bus.any())
            {
                return(true);
            }
            //nếu không có thì hỏi có nhập không
            else
            {
                DialogResult dialogResult = MessageBox.Show("Bạn chưa có nhà cung cấp" + "\n" + "Vào thêm nhà cung cấp mới?", "Chưa có nhà cung cấp", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    button20.PerformClick();
                }
                else if (dialogResult == DialogResult.No)
                {
                    //tabControl1.SelectedTab = tabPage1;
                }
                return(false);
            }
        }
コード例 #13
0
        //load tên nhà cung cấp
        private void cbmancc_SelectionChangeCommitted(object sender, EventArgs e)
        {
            nhacungcapbus bus = new nhacungcapbus();

            txtsuatenncc.Text = bus.getname(cbmancc.SelectedItem.ToString());
        }
コード例 #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            nhacungcapbus bus = new nhacungcapbus();

            dataGridView1.DataSource = bus.list();
        }
コード例 #15
0
        //lấy tên nhà cung cấp vào textbox
        private void manhacungcapcb_SelectionChangeCommitted(object sender, EventArgs e)
        {
            nhacungcapbus bus = new nhacungcapbus();

            mancctxt.Text = bus.getname(manhacungcapcb.SelectedItem.ToString());
        }