Ejemplo n.º 1
0
 private void btn_ghi_Click(object sender, EventArgs e)
 {
     if (check2())
     {
         if (isInsert == 1)
         {
             Phong_Info dv = new Phong_Info(0, txtTenPhong.Text, txtDiaChi.Text);
             if (dv.Insert())
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác thành công!");
                 load();
             }
             else
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác không thành công!");
             }
         }
         else if (isInsert == 2)
         {
             Phong_Info dv = new Phong_Info(Convert.ToInt32(gridDanhSach.ActiveRow.Cells["PhongID"].Value), txtTenPhong.Text, txtDiaChi.Text);
             if (dv.Update())
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác thành công!");
                 load();
             }
             else
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác không thành công!");
             }
         }
         load();
     }
 }
Ejemplo n.º 2
0
        private void load()
        {
            gridDanhSach.DataSource = Phong_Info.SelectAllTable();

            Util.FormHandler.SetSourceForGridCustomCollumns(gridDanhSach, new string[] { "TenPhong", "DiaChi" }, new string[] { "Tên phòng", "Địa chỉ" });
            Util.ResetControl.ReadOnly_Control(this);
            isInsert = 0;
        }
Ejemplo n.º 3
0
 private void frmDichVu_Load(object sender, EventArgs e)
 {
     load();
     cbx_Phong.DataSource    = Phong_Info.SelectAllTable();
     cbx_Phong.ValueMember   = "TenPhong";
     cbx_Phong.DisplayMember = "PhongID";
     Util.FormHandler.SetEnterKeyForAllControlsLevel(txtMaDV.GetType(), this.Controls);
     Util.FormHandler.SetEnterKeyForAllControlsLevel(txtDonGia.GetType(), this.Controls);
     Util.ResetControl.SetEnterForUltraComboUltraTextBox(new UltraCombo[] { cbx_Phong }, new TextBox[] { txtPhong });
 }
Ejemplo n.º 4
0
 private void xóaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (gridDanhSach.ActiveRow != null)
     {
         if (MessageBox.Show("Bạn có muốn thực hiện thao tác này không?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             Phong_Info dv = new Phong_Info();
             dv.PhongID = Convert.ToInt32(gridDanhSach.ActiveRow.Cells["PhongID"].Value);
             if (dv.Delete())
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác thành công!");
                 load();
             }
             else
             {
                 Util.MESSAGE.MSG("Thực hiện thao tác không thành công!");
             }
         }
     }
 }