Example #1
0
        public void suadichvu(Dichvuobject dichvu)
        {
            kn.connect();
            SqlCommand cmd = new SqlCommand("UPDATEDV", kn.con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p = new SqlParameter("@MADV", dichvu.Madv);

            cmd.Parameters.Add(p);
            p = new SqlParameter("@TENDV", dichvu.Tendv);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@GIADV", dichvu.Giadv);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@GHICHU", dichvu.Ghichu);
            cmd.Parameters.Add(p);
            int count = cmd.ExecuteNonQuery();

            if (count > 0)
            {
                MessageBox.Show("Sửa thành công");
            }
            else
            {
                MessageBox.Show("Không thể sửa!!!");
            }
            kn.disconnect();
        }
 private void btnsuadv_Click(object sender, EventArgs e)
 {
     try
     {
         Dichvuobject dv = new Dichvuobject();
         dv.Madv   = txtMADV.Text;
         dv.Tendv  = txtTENDV.Text;
         dv.Giadv  = Int32.Parse(txtGIADV.Text);
         dv.Ghichu = txtghichudv.Text;
         Dichvucontrol.updatedv(dv);
         dataGridView3.DataSource = Dichvucontrol.getdatadv();
     }
     catch { }
 }
 private void btnxoadv_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dg = new DialogResult();
         dg = MessageBox.Show("Bạn có muốn xóa không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dg == DialogResult.Yes)
         {
             Dichvuobject dv = new Dichvuobject();
             dv.Madv = txtMADV.Text;
             Dichvucontrol.deletedv(dv);
             dataGridView3.DataSource = Dichvucontrol.getdatadv();
         }
     }
     catch { }
 }
Example #4
0
        public void xoadichvu(Dichvuobject dichvu)
        {
            kn.connect();
            SqlCommand cmd = new SqlCommand("DELETEDV", kn.con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p = new SqlParameter("@MADV", dichvu.Madv);

            cmd.Parameters.Add(p);
            int count = cmd.ExecuteNonQuery();

            if (count > 0)
            {
                MessageBox.Show("Xóa thành công");
            }
            else
            {
                MessageBox.Show("Không thể xóa!!!");
            }
            kn.disconnect();
        }
Example #5
0
        public static void deletedv(Dichvuobject dichvu)
        {
            Dichvumodel dv = new Dichvumodel();

            dv.xoadichvu(dichvu);
        }
Example #6
0
        public static void updatedv(Dichvuobject dichvu)
        {
            Dichvumodel dv = new Dichvumodel();

            dv.suadichvu(dichvu);
        }
Example #7
0
        public static void adddv(Dichvuobject dichvu)
        {
            Dichvumodel dv = new Dichvumodel();

            dv.themdichvu(dichvu);
        }