Exemple #1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (them)
            {
                try
                {
                    BLMonHoc blMH = new BLMonHoc();
                    blMH.ThemMonHoc(this.txtMaMH.Text, this.txtTenMH.Text.TrimEnd(), (int)this.spinSoTC.Value, this.lookUpMaGV.Text, ref err);

                    LoadData();

                    XtraMessageBox.Show("Đã thêm xong!");
                }
                catch
                {
                    XtraMessageBox.Show("Không thêm được. Lỗi rồi!");
                }
            }
            else
            {
                BLMonHoc blMH = new BLMonHoc();
                blMH.CapNhatMonHoc(this.txtMaMH.Text, this.txtTenMH.Text.TrimEnd(), (int)this.spinSoTC.Value, this.lookUpMaGV.Text, ref err);

                LoadData();

                XtraMessageBox.Show("Đã sửa xong!");
            }
        }
Exemple #2
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (Them)
     {
         if (this.txtMaMon.Text == "")
         {
             epvMaMon.SetError(this.txtMaMon, "!");
             MessageBox.Show("Bạn chưa nhập Mã môn!", "Thông báo",
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
             epvMaMon.Clear();
             this.txtMaMon.Focus();
         }
         else if (dbMonHoc.KiemTraMaMonTonTai(this.txtMaMon.Text, ref err) == true)
         {
             epvMaMon.SetError(this.txtMaMon, "!");
             MessageBox.Show("Mã môn đã tồn tại!", "Thông báo",
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
             epvMaMon.Clear();
             txtMaMon.Focus();
         }
         else
         {
             if (dbMonHoc.ThemMonHoc(this.txtMaMon.Text, this.txtTenMon.Text, this.txtSoTinChi.Text, ref err))
             {
                 LoadData();
                 MessageBox.Show("Đã thêm xong!");
             }
             else
             {
                 MessageBox.Show("Không thêm được. Lỗi rồi!" + err);
             }
         }
     }
     else
     {
         if (dbMonHoc.CapNhatMonHoc(this.txtMaMon.Text, this.txtTenMon.Text, this.txtSoTinChi.Text, ref err))
         {
             LoadData();
             MessageBox.Show("Đã sửa xong!");
         }
         else
         {
             MessageBox.Show("Không sửa được. Lỗi rồi!!! " + err);
         }
     }
 }