private void but_fix_Click(object sender, EventArgs e)
        {
            if (checkInput())
            {
                funcShare.update("chi_tiet_phieu_nhap", "so_luong,don_gia,don_vi",
                                 textbox_soluong.Text, textbox_cost.Text, funcShare.Nvarchar(textbox_donvi.Text),
                                 funcShare.where ("phieu_nhap_id", phieu_nhap_id, "mat_hang_id", item_id));

                this.Close();
            }
        }
        private void gridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (isFormRegister)
            {
                if (e.RowIndex != -1)//not header
                {
                    gridView2.Rows.RemoveAt(gridView2.CurrentCell.RowIndex);
                }
            }
            if (!isFormRegister)
            {
                c4 = gridView2.CurrentRow.Cells[0].Value.ToString();
                c1 = gridView2.CurrentRow.Cells[1].Value.ToString();
                c2 = gridView2.CurrentRow.Cells[2].Value.ToString();
                c3 = gridView2.CurrentRow.Cells[3].Value.ToString();

                ChiTietPhieuNhap sua_item = new ChiTietPhieuNhap(label_id.Text, c4, c1, c2, c3);
                sua_item.ShowDialog();
                funcShare.loadGridView("chi_tiet_phieu_nhap", "mat_hang_id,so_luong,don_gia,don_vi",
                                       gridView2, funcShare.where ("phieu_nhap_id", label_id.Text));
            }
        }
Example #3
0
        private void but_form_alter(object sender, EventArgs e)
        {
            Button but = (Button)sender;

            switch (but.Name)
            {
            case "but_changeToRegis":
                changeToFormRegister();
                break;

            case "but_sua":
                if (checkInput())
                {
                    c1 = label_id.Text;
                    c2 = funcShare.Nvarchar(textbox_ten.Text);
                    c3 = textbox_remain.Text;
                    c4 = textbox_loai.Text;
                    funcShare.update("mat_hang", "ten,remain,loai_hang_id", c2, c3, c4, funcShare.where ("id", c1));
                    changeToFormRegister();
                    LoadMatHang();
                }
                break;

            case "but_xoa":
                string xoa = "DELETE FROM mat_hang WHERE id=" + label_id.Text;
                cmd = new SqlCommand(xoa);
                db.editDB(cmd);
                changeToFormRegister();
                LoadMatHang();

                break;
            }
        }
Example #4
0
        private void but_sua_xoa_Click(object sender, EventArgs e)
        {
            Button but = (Button)sender;

            switch (but.Name)
            {
            case "but_sua":
                if (kiemTraInput())
                {
                    c1 = funcShare.Nvarchar(textbox_ten.Text);
                    c2 = funcShare.Nvarchar(textbox_sdt.Text);
                    c3 = funcShare.Nvarchar(textbox_quan.Text);
                    c4 = funcShare.Nvarchar(textbox_phuong.Text);
                    c5 = funcShare.Nvarchar(textbox_city.Text);
                    c6 = label_id.Text;
                    funcShare.update("nha_cung_cap", "ten,sdt,quan,phuong,city", c1, c2, c3, c4, c5, funcShare.where ("id", c6));
                    funcShare.loadGridView("nha_cung_cap", gridView);
                    changeToFormRegister();
                }
                break;

            case "but_xoa":
                string delete = "DELETE FROM nha_cung_cap WHERE id =" + label_id.Text;
                comman = new SqlCommand(delete);
                database.editDB(comman);
                funcShare.loadGridView("nha_cung_cap", gridView);
                changeToFormRegister();
                break;

            case "but_changeToRegis":
                changeToFormRegister();
                break;
            }
        }