Exemplo n.º 1
0
 public override void SaveModel()
 {
     if (this.Validation())
     {
         ChuyenKhoa    chuyenKhoa = (ChuyenKhoa)this.GetModel();
         SqlResultType flag;
         if (this.actions == Common.Common.Class.Actions.AddNew)
         {
             flag = new SpecialtyProvider().Insert(chuyenKhoa);
         }
         else
         {
             flag = new SpecialtyProvider().Update(chuyenKhoa);
         }
         SaveCompleteEventArgs args = new SaveCompleteEventArgs();
         args.Result  = flag == SqlResultType.OK;
         args.Model   = chuyenKhoa;
         args.Message = "Không lưu được thông tin chuyên khoa";
         this.SaveCompleteSuccess(chuyenKhoa, args);
     }
     else
     {
         XtraMessageBox.Show("Thông tin chưa hợp lệ kiểm tra lại thông tin.");
     }
 }
Exemplo n.º 2
0
 public override bool DeleteModel()
 {
     if (this.Model != null)
     {
         if (XtraMessageBox.Show("Bạn có muốn xóa bản ghi này không?", "Xóa bản ghi", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
         {
             ChuyenKhoa    ChuyenKhoa = (ChuyenKhoa)this.Model;
             SqlResultType resultType = new SpecialtyProvider().Delete(ChuyenKhoa);
             if (resultType == SqlResultType.OK)
             {
                 this.ClearModel();
                 this.DisabledLayout(true);
             }
             return(resultType == SqlResultType.OK);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
        protected override void SetDataSource()
        {
            SpecialtyProvider specialtyProvider = new SpecialtyProvider();

            this.dataSource = specialtyProvider.GetAll();
        }