예제 #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            try
            {
                if (KiemTra())
                {
                    try
                    {
                        DichVu dv = new DichVu();
                        dv.MaDV = DichVuBUS.XuLyMa();
                        dv.TenDV = txtTenDV.Text;
                        dv.MoTa = txtMoTa.Text;
                        dv.GiaDV = txtGiaDV.Text;
                        DichVuBUS.Insert(dv);
                        frmThemDichVu_Load(sender, e);
                        MessageBox.Show("Thêm thành công.", "Thông báo");

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
 public void DichVu_Update(DichVu dv)
 {
     using (var cmd = new SqlCommand("SP_DichVu_Update", GetConnection()))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@MaDV", dv.MaDV));
         cmd.Parameters.Add(new SqlParameter("@TenDV", dv.TenDV));
         cmd.Parameters.Add(new SqlParameter("@GiaDV", dv.GiaDV));
         cmd.Parameters.Add(new SqlParameter("@MoTa", dv.MoTa));
         cmd.ExecuteNonQuery();
     }
 }
예제 #3
0
 public static void Update(DichVu dv)
 {
     db.DichVu_Update(dv);
 }
예제 #4
0
 public static void Insert(DichVu dv)
 {
     db.DichVu_Insert(dv);
 }
예제 #5
0
        private void btnChinhSua_Click(object sender, EventArgs e)
        {
            try
            {
                if (KiemTraMa() && KiemTra())
                {
                    try
                    {
                        DichVu dv = new DichVu();
                        dv.MaDV = txtMaDV.Text;
                        dv.TenDV = txtTenDV.Text;
                        dv.MoTa = txtMoTa.Text;
                        dv.GiaDV = txtGiaDV.Text;
                        DichVuBUS.Update(dv);
                        frmThemDichVu_Load(sender, e);
                        MessageBox.Show("Chỉnh sửa thành công.", "Thông báo");

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
 
        }
예제 #6
0
        private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                DichVu dv = new DichVu();
                dv.MaDV = gridView1.GetFocusedRowCellValue(colMaDV).ToString();
                dv.TenDV = gridView1.GetFocusedRowCellValue(colTenDichVu).ToString();
                dv.GiaDV = gridView1.GetFocusedRowCellValue(colGiaDichVu).ToString();
                dv.MoTa = gridView1.GetFocusedRowCellValue(colMoTa).ToString();
                DichVuBUS.Update(dv);
                frmThemDichVu_Load(sender, e);
                MessageBox.Show("Chỉnh sửa thành công.", "Thông báo");
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }