Example #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1      = "SELECT * FROM NHOM_HANG";
            NHOM_HANG = DAO.GetDataToTable(sql1);
            string sql;

            if (NHOM_HANG.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (txtManhom.Text == "")
            {
                MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("Bạn có muốn xóa không?", "Thông báo",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                sql = "DELETE NHOM_HANG WHERE MANHOM=N'" + txtManhom.Text + "'";
                DAO.RunSqlDel(sql);
                hienthi();
                ResetValue();
            }
        }
Example #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1            = "SELECT * FROM CHI_TIET_HD_NHAP";
            CHI_TIET_HD_BAN = DAO.GetDataToTable(sql1);
            string sql;


            if (CHI_TIET_HD_BAN.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (txtsoHDB.Text == "")
            {
                MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("Bạn có muốn xóa không?", "Thông báo",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                sql = "DELETE FROM CHI_TIET_HD_BAN WHERE SOHDB =N'" + txtsoHDB.Text + "'";
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = sql;
                cmd.Connection  = DAO.con;
                cmd.ExecuteNonQuery();
                DAO.RunSqlDel(sql);
                hienthi();
                ResetValues();
            }
        }
Example #3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1        = "SELECT * FROM HOA_DON_BAN";
            HOA_DON_BAN = DAO.GetDataToTable(sql1);
            string sql;

            if (HOA_DON_BAN.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtsoHDB.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtNgayban.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập ngày bán", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtNgayban.Focus();
                    return;
                }
                if (txtMaNV.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập mã nhân viên", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMaNV.Focus();
                    return;
                }
                if (txtMakhach.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập mã khách", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMakhach.Focus();
                    return;
                }
                if (txtTongtien.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập tổng tiền", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTongtien.Focus();
                    return;
                }
            }
            sql = "UPDATE HOA_DON_BAN SET NGAYBAN=N'" + txtNgayban.Text.ToString() + "',MANV=N'" + txtMaNV.Text.ToString()
                  + "',MAKHACH=N'" + txtMakhach.Text.ToString() + "',TONGTIEN=N'" + txtTongtien.Text.ToString() + "' WHERE SOHDB=N'" + txtsoHDB.Text + "'";
            DAO.RunSQL(sql);
            hienthi();
            ResetValues();
            btnBoqua.Enabled = false;
        }
Example #4
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1      = "SELECT * FROM NHAN_VIEN";
            NHAN_VIEN = DAO.GetDataToTable(sql1);
            string sql;

            if (NHAN_VIEN.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtManhanvien.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtTennhanvien.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập tên nhân viên", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTennhanvien.Focus();
                    return;
                }
                if (txtDiachi.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập địa chỉ", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTennhanvien.Focus();
                    return;
                }
                if (mtbDienthoai.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập điện thoại", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTennhanvien.Focus();
                    return;
                }
            }
            sql = "UPDATE NHANVIEN SET TENNHANVIEN=N'" + txtTennhanvien.Text.ToString() + "',DIACHI=N'" + txtDiachi.Text.ToString()
                  + "',DIENTHOAI=N'" + mtbDienthoai.Text.ToString() + "',MANHOM=N'" + txtManhom.Text.ToString() + "' WHERE MANV=N'" + txtManhanvien.Text + "'";
            DAO.RunSQL(sql);
            hienthi();
            ResetValues();
            btnBoqua.Enabled = false;
        }
Example #5
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1         = "SELECT * FROM NHA_CUNG_CAP";
            NHA_CUNG_CAP = DAO.GetDataToTable(sql1);
            string sql;

            if (NHA_CUNG_CAP.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtMaNCC.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtTenNCC.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập tên nhà cung cấp", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTenNCC.Focus();
                    return;
                }
                if (txtDiachi.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập địa chỉ", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTenNCC.Focus();
                    return;
                }
                if (txtDienThoai.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập điện thoại", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTenNCC.Focus();
                    return;
                }
            }
            sql = "UPDATE NHA_CUNG_CAP SET TENNCC=N'" + txtTenNCC.Text.ToString() + "',DIACHI=N'" + txtDiachi.Text.ToString()
                  + "',DIENTHOAI=N'" + txtDienThoai.Text.ToString() + "' WHERE MANCC=N'" + txtMaNCC.Text + "'";
            DAO.RunSQL(sql);
            hienthi();
            ResetValues();
            btnTimkiem.Enabled = false;
        }
Example #6
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1      = "SELECT * FROM NHOM_HANG";
            NHOM_HANG = DAO.GetDataToTable(sql1);
            string sql;

            if (NHOM_HANG.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtManhom.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtTennhom.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập tên nhóm", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTennhom.Focus();
                    return;
                }
            }
            sql = "UPDATE NHOM_HANG SET TENNHOM=N'" + txtTennhom.Text.ToString() + "' WHERE MANHOM=N'" + txtManhom.Text + "'";
            DAO.RunSQL(sql);
            hienthi();
            ResetValue();
            btnBoqua.Enabled = false;
        }
Example #7
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1            = "SELECT * FROM CHI_TIET_HD_NHAP";
            CHI_TIET_HD_BAN = DAO.GetDataToTable(sql1);
            string sql;


            if (CHI_TIET_HD_BAN.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtsoHDB.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtMavach.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập mã vạch", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMavach.Focus();
                    return;
                }
                if (txtSoluong.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập số lượng", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSoluong.Focus();
                    return;
                }
                if (txtDongia.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập đơn giá", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDongia.Focus();
                    return;
                }
                if (txtGiamgia.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập giảm giá", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtGiamgia.Focus();
                    return;
                }
                if (txtThanhtien.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập thành tiền", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtThanhtien.Focus();
                    return;
                }
                sql = "UPDATE CHI_TIET_HD_BAN SET MAVACH=N'" + txtMavach.Text.ToString() + "',SOLUONGBAN=N'" + txtSoluong.Text.ToString()
                      + "',DONGIA=N'" + txtDongia.Text.ToString() + "',GIAMGIA=N'" + txtGiamgia.Text.ToString() + "',THANHTIEN=N'" + txtThanhtien.Text.ToString() + "' WHERE SOHDB=N'" + txtsoHDB.Text + "'";
                DAO.RunSQL(sql);
                hienthi();
                ResetValues();
                btnBoqua.Enabled = false;
            }
        }
Example #8
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            string sql1;

            sql1        = "SELECT * FROM DM_HANG_HOA";
            DM_HANG_HOA = DAO.GetDataToTable(sql1);
            string sql;

            if (DM_HANG_HOA.Rows.Count == 0)
            {
                MessageBox.Show("Không còn dữ liệu!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (txtMavach.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (txtTenhang.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập tên hàng hóa", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTenhang.Focus();
                    return;
                }
                if (txtMachatlieu.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập mã chất liệu", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMachatlieu.Focus();
                    return;
                }
                if (txtSoluong.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập số lượng", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSoluong.Focus();
                    return;
                }
                if (txtDongianhap.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập đơn giá nhập", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDongianhap.Focus();
                    return;
                }
                if (txtDongiaban.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Bạn phải nhập đơn giá bán", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDongiaban.Focus();
                    return;
                }
            }
            sql = "UPDATE DM_HANG_HOA SET TENHANG=N'" + txtTenhang.Text.ToString() + "' WHERE MAVACH=N'" + txtMavach.Text + "'";
            DAO.RunSQL(sql);
            hienthi();
            ResetValues();
            btnBoqua.Enabled = false;
        }