コード例 #1
0
 private void themThietBi()
 {
     bool show = true;
     bool open = false;
     Guid id = Guid.Empty;
     try
     {
         List<ThietBi> list = new List<ThietBi>();
         list = _ucQuanLyThietBi.getListThietBi();
         if (list != null && list.Count > 0)
         {
             foreach (ThietBi obj in list)
             {
                 if (obj != null)
                 {
                     if (!yestoall)
                     {
                         frmTinhTrangVaSoLuong frm = new frmTinhTrangVaSoLuong(loaichung);
                         frm.Text += " " + obj.ten;
                         frm.setTinhTrangAndSoLuong = new frmTinhTrangVaSoLuong.SetTinhTrangAndSoLuong(setTinhTrangAndSoLuong);
                         if (!frm.ShowDialog().Equals(System.Windows.Forms.DialogResult.No))
                         {
                             text = "";
                             id = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                             if(!yestoall)
                                 showToolTip(text);
                             if (reLoadAndFocused_phong_thietbi != null && id != Guid.Empty)
                                 reLoadAndFocused_phong_thietbi(id);
                         }
                     }
                     else
                     {
                         if (show)
                         {
                             DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                             DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang xử lý...");
                             open = true;
                             show = false;
                         }
                         Guid id2 = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                         id = id2 != Guid.Empty ? id2 : id;
                     }
                 }
             }
             if (reLoadAndFocused_phong_thietbi != null && yestoall)
                 reLoadAndFocused_phong_thietbi(id);
             _ucQuanLyThietBi.loadData(loaichung);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->themThietBi: " + ex.Message);
         XtraMessageBox.Show("Lỗi khi thêm thiết bị vào phòng!");
     }
     finally
     {
         if (open)
         {
             DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false);
         }
         if (yestoall)
         {
             showToolTip(text);
             yestoall = false;
         }
     }
 }
コード例 #2
0
        private void themThietBi()
        {
            bool show = true;
            bool open = false;
            Guid id   = Guid.Empty;

            try
            {
                List <ThietBi> list = new List <ThietBi>();
                list = _ucQuanLyThietBi.getListThietBi();
                if (list != null && list.Count > 0)
                {
                    foreach (ThietBi obj in list)
                    {
                        if (obj != null)
                        {
                            if (!yestoall)
                            {
                                frmTinhTrangVaSoLuong frm = new frmTinhTrangVaSoLuong(loaichung);
                                frm.Text += " " + obj.ten;
                                frm.setTinhTrangAndSoLuong = new frmTinhTrangVaSoLuong.SetTinhTrangAndSoLuong(setTinhTrangAndSoLuong);
                                if (!frm.ShowDialog().Equals(System.Windows.Forms.DialogResult.No))
                                {
                                    text = "";
                                    id   = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                                    if (!yestoall)
                                    {
                                        showToolTip(text);
                                    }
                                    if (reLoadAndFocused_phong_thietbi != null && id != Guid.Empty)
                                    {
                                        reLoadAndFocused_phong_thietbi(id);
                                    }
                                }
                            }
                            else
                            {
                                if (show)
                                {
                                    DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                                    DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang xử lý...");
                                    open = true;
                                    show = false;
                                }
                                Guid id2 = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                                id = id2 != Guid.Empty ? id2 : id;
                            }
                        }
                    }
                    if (reLoadAndFocused_phong_thietbi != null && yestoall)
                    {
                        reLoadAndFocused_phong_thietbi(id);
                    }
                    _ucQuanLyThietBi.loadData(loaichung);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(this.Name + "->themThietBi: " + ex.Message);
                XtraMessageBox.Show("Lỗi khi thêm thiết bị vào phòng!");
            }
            finally
            {
                if (open)
                {
                    DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false);
                }
                if (yestoall)
                {
                    showToolTip(text);
                    yestoall = false;
                }
            }
        }