Beispiel #1
0
        private void btnHuy_Click(object sender, EventArgs e)
        {
            double sl, slcon, slxoa;

            if (MessageBox.Show("Bạn có chắc chắn muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string    sql        = "SELECT Mabinh,SoLuong FROM chi_tiet_hoa_don_nhap WHERE SoHDN = N'" + txtSoHDN.Text + "'";
                DataTable DM_Binh_ga = DAO.GetDataToTable(sql);
                for (int ga = 0; ga <= DM_Binh_ga.Rows.Count - 1; ga++)
                {
                    // Cập nhật lại số lượng cho các loại ga
                    sl    = Convert.ToDouble(DAO.GetFieldValues("SELECT SoLuong FROM DM_Binh_ga WHERE Mabinh = N'" + DM_Binh_ga.Rows[ga][0].ToString() + "'"));
                    slxoa = Convert.ToDouble(DM_Binh_ga.Rows[ga][1].ToString());
                    slcon = sl - slxoa;
                    sql   = "UPDATE DM_Binh_ga SET SoLuong =" + slcon + " WHERE Mabinh= N'" + DM_Binh_ga.Rows[ga][0].ToString() + "'";
                    DAO.RunSql(sql);
                }

                //Xóa chi tiết hóa đơn
                sql = "DELETE Chi_tiet_hoa_don_nhap WHERE SoHDN=N'" + txtSoHDN.Text + "'";
                DAO.RunSqlDel(sql);

                //Xóa hóa đơn
                sql = "DELETE hoa_don_nhap WHERE SoHDN=N'" + txtSoHDN.Text + "'";
                DAO.RunSqlDel(sql);
                ResetValues();
                LoadDataGridView();
            }
        }
Beispiel #2
0
        private void buttonxoa_Click(object sender, EventArgs e)
        {
            string sql = "delete from khoi_luong where ma_khoi_luong='" + txtMakhoiluong.Text + "'";

            DAO.RunSqlDel(sql);
            loaddata();
        }
Beispiel #3
0
        private void buttonxoa_Click_1(object sender, EventArgs e)
        {
            string sql = "delete from nhan_vien where manv='" + textBoxMaNV.Text + "'";

            DAO.RunSqlDel(sql);
            loatdata();
        }
Beispiel #4
0
        private void buttonxoa_Click_1(object sender, EventArgs e)
        {
            string sql = "delete from nha_cc where mancc=N'" + textBoxmanhacungcap.Text + "'";

            DAO.RunSqlDel(sql);
            loaddata();
        }
Beispiel #5
0
        private void buttonxoa_Click(object sender, EventArgs e)
        {
            string sql = "delete from ca_lam where maca=N'" + textBoxmaca.Text + "'";

            DAO.RunSqlDel(sql);
            loaddata();
        }
Beispiel #6
0
        private void buttonxoa_Click(object sender, EventArgs e)
        {
            string sql = "delete from khach_hang where makhach=N'" + textBoxmakh.Text + "'";

            DAO.RunSqlDel(sql);
            loaddata();
        }
Beispiel #7
0
        private void btnXoa_Click_1(object sender, EventArgs e)
        {
            double sl, slcon, slxoa;

            if (MessageBox.Show("Bạn có chắc chắn muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string    sql        = "SELECT Mabinh,Soluong FROM Chi_tiet_hoa_don_ban WHERE SoHDB = N'" + txtSoHDB.Text + "'";
                DataTable DM_Binh_ga = DAO.GetDataToTable(sql);
                for (int hang = 0; hang <= DM_Binh_ga.Rows.Count - 1; hang++)
                {
                    // Cập nhật lại số lượng cho các mặt hàng
                    sl    = Convert.ToDouble(DAO.GetFieldValues("SELECT SoLuong FROM DM_Binh_ga WHERE Mabinh = N'" + DM_Binh_ga.Rows[hang][0].ToString() + "'"));
                    slxoa = Convert.ToDouble(DM_Binh_ga.Rows[hang][1].ToString());
                    slcon = sl + slxoa;
                    sql   = "UPDATE DM_Binh_ga SET Soluong =" + slcon + " WHERE Mabinh= N'" + DM_Binh_ga.Rows[hang][0].ToString() + "'";
                    DAO.RunSql(sql);
                }

                //Xóa chi tiết hóa đơn
                sql = "DELETE Chi_tiet_hoa_don_ban WHERE SoHDB=N'" + txtSoHDB.Text + "'";
                DAO.RunSqlDel(sql);

                //Xóa hóa đơn
                sql = "DELETE Hoa_don_ban WHERE SoHDB=N'" + txtSoHDB.Text + "'";
                DAO.RunSqlDel(sql);
                ResetValues();
                Load_DataGridViewChitiet();
                btnXoa.Enabled = false;
            }
        }
Beispiel #8
0
        private void buttonsua_Click(object sender, EventArgs e)
        {
            string sql = "update cong_viec set tencv=N'" + textBoxtencv.Text + "'where macv=N'" + textBoxmacv.Text + "'";

            DAO.RunSqlDel(sql);
            loaddata();
        }
Beispiel #9
0
        private void buttonsua_Click(object sender, EventArgs e)
        {
            string sql = "update Nhan_Vien set tennv=N'" + textBoxTenNV.Text + "',diachi=N'" + textBoxdiachi.Text + "',gioitinh='" + comboBoxgioitinh.SelectedValue
                         + "',ngaysinh='" + maskedTextBoxngaysinh.Text + "',dienthoai='" + textBoxdienthoai.Text + "',maca='" + comboBoxmaca.SelectedValue + "',macv='"
                         + comboBoxmacongviec.SelectedValue +
                         "' where maNv=N'" + textBoxMaNV.Text + "'";

            //MessageBox.Show(sql);
            //DAO.openconnectionstring();
            //SqlCommand cmd = new SqlCommand(sql, DAO.conn);
            //cmd.ExecuteNonQuery();
            //DAO.closeconnectionstring();
            DAO.RunSqlDel(sql);
            loatdata();
        }