Exemplo n.º 1
0
        private void tbs_edit_Click(object sender, EventArgs e)
        {
            if (txt_mathietbi.Text == "")
            {
                MessageBox.Show("Dữ liệu chưa được nhập.");
                return;
            }
            thietbi t = new thietbi();

            t.maloaithietbi = cmb_maloai.SelectedValue.ToString();
            t.mathietbi     = txt_mathietbi.Text;
            t.tenthietbi    = txt_tenthietbi.Text;
            t.giathietbi    = int.Parse(txt_giathietbi.Text.ToString());
            t.tinhtrang     = txt_tinhtrang.Text;
            if (MessageBox.Show(string.Format("Bạn có muốn sửa thiết bị ?"), "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (Bus.UpdateProfile(t) > 0)
                {
                    MessageBox.Show("Thao tác đã được thực hiện.");
                    Thietbi_Load(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Lỗi!");
            }
        }
Exemplo n.º 2
0
        private void tbs_delete_Click(object sender, EventArgs e)
        {
            if (txt_mathietbi.Text == "")
            {
                MessageBox.Show("Dữ liệu chưa được chọn.");
            }
            thietbi t = new thietbi();

            t.mathietbi     = txt_mathietbi.Text;
            t.tenthietbi    = txt_tenthietbi.Text;
            t.maloaithietbi = cmb_maloai.SelectedValue.ToString();
            t.giathietbi    = int.Parse(txt_giathietbi.Text.ToString());
            t.tinhtrang     = txt_tinhtrang.Text;
            if (MessageBox.Show(string.Format("Bạn có muốn xóa thiết bị ?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult)
            {
                if (Bus.DeleteProfile(t) > 0)
                {
                    MessageBox.Show("Thực hiện thành công!");
                    Thietbi_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("Lỗi.");
                }
            }
        }
Exemplo n.º 3
0
 public static int DeleteProfile(thietbi t)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@mathietbi", t.mathietbi)
     };
     return(DataProvider.ExecuteNonQuery("xoathietbi", para));
 }
Exemplo n.º 4
0
 public static int UpdateProfile(thietbi t)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@mathietbi", t.mathietbi),
         new SqlParameter("@gia", t.giathietbi)
     };
     return(DataProvider.ExecuteNonQuery("suathietbi", para));
 }
Exemplo n.º 5
0
 //THIẾT BỊ
 #region
 public static int InsertProfile(thietbi t)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@mathietbi", t.mathietbi),
         new SqlParameter("@tenthietbi", t.tenthietbi),
         new SqlParameter("@maloai", t.maloaithietbi),
         new SqlParameter("@gia", t.giathietbi)
     };
     return(DataProvider.ExecuteNonQuery("themthietbi", para));
 }
Exemplo n.º 6
0
 public static int DeleteProfile(thietbi t)
 {
     return(Dao.DeleteProfile(t));
 }
Exemplo n.º 7
0
 public static int UpdateProfile(thietbi t)
 {
     return(Dao.UpdateProfile(t));
 }
Exemplo n.º 8
0
 // THIẾT BỊ
 #region
 public static int InsertProfile(thietbi t)
 {
     return(Dao.InsertProfile(t));
 }