Exemplo n.º 1
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            string hieuXe   = this.txtHieuXe.Text;
            string dongXeId = this.txtID.Text;
            string tskt     = this.rbThongSoKyThuat.Text;

            if (hieuXe == "" || dongXeId == "" || tskt == "")
            {
                MessageBox.Show("Vui lòng điền đầy đủ thông tin!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Entity_DongXe _dx = new Entity_DongXe(dongXeId, hieuXe, tskt);

            if (dx.insertDongXe(_dx))
            {
                MessageBox.Show("Thêm thành công!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                gwDongXe.DataSource  = dx.getData();
                this.btn_Luu.Enabled = false;
            }
            else if (dx.updateDongXe(_dx))
            {
                MessageBox.Show("Sửa thành công!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                gwDongXe.DataSource = dx.getData();
                btn_Luu.Enabled     = false;
            }
            else
            {
                MessageBox.Show("Có lỗi xảy ra,vui lòng kiểm tra lại!", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 public bool updateDongXe(Entity_DongXe _dx)
 {
     try
     {
         const string strSQL  = "SP_UPDATE_DONGXE";
         string[]     pNames  = { "@id", "@hieuXe", "@tskt" };
         object[]     pValues = { _dx.DongXeId, _dx.HieuXe, _dx.Tskt };
         int          count   = con.ExecuteStoredProcedure(strSQL, pNames, pValues);
         if (count >= 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 public bool updateDongXe(Entity_DongXe _dx)
 {
     return(dx.updateDongXe(_dx));
 }
Exemplo n.º 4
0
 public bool insertDongXe(Entity_DongXe _dx)
 {
     return(dx.insertDongXe(_dx));
 }