示例#1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            HangXe_DTO kh_DTO = new HangXe_DTO(txtTenXe.Text);

            if (hx_BUS.Insert(kh_DTO))
            {
                MessageBox.Show("Thêm thành công!");
                QLXe_GUI_Load(sender, e);
            }
            else
            {
                MessageBox.Show("Thêm thất bại!");
            }
        }
示例#2
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (txtMaXe.Text != "")
            {
                HangXe_DTO kh_DTO = new HangXe_DTO(int.Parse(txtMaXe.Text), txtTenXe.Text);

                if (hx_BUS.Update(kh_DTO))
                {
                    MessageBox.Show("Sửa thành công!");
                    QLXe_GUI_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("Sửa thất bại!");
                }
            }
            else
            {
                MessageBox.Show("Vui lòng chọn dữ liệu!");
            }
        }
示例#3
0
        public bool Update(HangXe_DTO hx)
        {
            try
            {
                con.Open();

                string     SQL = "UPDATE HANGXE SET TENHANGXE = N'" + hx.TENHANGXE + "' WHERE MAHANGXE =" + hx.MAHANGXE;
                SqlCommand cmd = new SqlCommand(SQL, con);
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }

            catch (Exception e)
            { }

            finally
            {
                con.Close();
            }

            return(false);
        }
示例#4
0
        public bool Insert(HangXe_DTO hx)
        {
            try
            {
                con.Open();

                string     SQL = "Insert into HANGXE values(N'" + hx.TENHANGXE + "');";
                SqlCommand cmd = new SqlCommand(SQL, con);
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }

            catch (Exception e)
            { }

            finally
            {
                con.Close();
            }

            return(false);
        }
 public bool Update(HangXe_DTO hx)
 {
     return(hx_dal.Update(hx));
 }
 public bool Insert(HangXe_DTO hx)
 {
     return(hx_dal.Insert(hx));
 }