예제 #1
0
        public Boolean ThemDVhdv(DVhdv_DTO DVhdv)
        {
            string sql = "INSERT INTO DichVuHDV VALUES(N'" + DVhdv.IDDVhdv + "', N'" + DVhdv.MaKH + "', N'" + DVhdv.MaHDV
                         + "', '" + DVhdv.NgayThue.ToString("yyyy-MM-dd") + "', '" + DVhdv.SoNgayThue
                         + "', '" + DVhdv.GiaThue + "', '" + DVhdv.TraTruoc + "', N'" + DVhdv.GhiChu + "')";

            return(new ExecuteDB().ExecuteData(sql));
        }
예제 #2
0
        public Boolean SuaDVhdv(DVhdv_DTO DVhdv)
        {
            string sql = "UPDATE DichVuHDV SET MaKH = N'" + DVhdv.MaKH + "', MaHDV = N'" + DVhdv.MaHDV
                         + "', NgayThue = '" + DVhdv.NgayThue.ToString("yyyy-MM-dd") + "', SoNgayThue = '" + DVhdv.SoNgayThue + "', GiaThue = '" + DVhdv.GiaThue
                         + "', TraTruoc = '" + DVhdv.TraTruoc + "', GhiChu = N'" + DVhdv.GhiChu + "'WHERE IDDVhdv = N'" + DVhdv.IDDVhdv + "'";

            return(new ExecuteDB().ExecuteData(sql));
        }
예제 #3
0
 public Boolean SuaDVhdv(DVhdv_DTO DVhdv)
 {
     try
     {
         if (DVhdv.IDDVhdv == "")
         {
             throw new Exception("Field \"IDDVhdv\" không thể trống.");
         }
         return(new DVhdv_DAL().SuaDVhdv(DVhdv));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 private void btSua_Click(object sender, EventArgs e)
 {
     try
     {
         DVhdv_DTO DVhdv = new DVhdv_DTO(txtIDDVhdv.Text, cbbMaKH.Text, cbbMaHDV.Text, dtpNgayThue.Text, txtSoNgayThue.Text, txtGiaThue.Text, txtTraTruoc.Text, txtGhiChu.Text);
         if (MessageBox.Show("Lưu sửa đổi?", "Chú ý!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             BUS.SuaDVhdv(DVhdv);
             MessageBox.Show("Sửa thành công!");
             dgvDVhdv.DataSource = BUS.GetDataDVhdv();
             Init();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }