فهرست منبع

Merge branch 'Release2.3' of http://36.129.163.148:10080/gaoshipeng/OTS2_0 into Release2.3

gsp 3 سال پیش
والد
کامیت
3f083d95c7
1فایلهای تغییر یافته به همراه58 افزوده شده و 16 حذف شده
  1. 58 16
      OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

+ 58 - 16
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -81,6 +81,8 @@ namespace OTSIncAReportGrids
 		DataTable particlesAll;
         ParticleData Particledata;
 
+        NLog.Logger log= NLog.LogManager.GetCurrentClassLogger();
+
         #region 分页器相关
 
         #region 分页字段和属性
@@ -172,25 +174,42 @@ namespace OTSIncAReportGrids
             Type dgvType = this.dgV_ParticlesDevidePage.GetType();
             PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
             pi.SetValue(this.dgV_ParticlesDevidePage, true, null);
+        }
+        bool Init()
+        {
+            try
+            {
+                lan = new Language(this);
+                table = lan.GetNameTable(this.Name);
 
-            lan = new Language(this);
-            table = lan.GetNameTable(this.Name);
+                m_mythread_state = false;
+                m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
+                //m_frm_userprogress = new Frm_UserProgress();
+                fieldData = new FieldData(result.FilePath);
+                Particledata = new ParticleData(result.FilePath);
+                //初始化底层操作类
+                m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
+                return true;
+            }
+            catch(Exception ex)
+            {
+                log.Error(ex.ToString());
+                return false;
+            }
 
-            m_mythread_state = false;
-            m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
-            //m_frm_userprogress = new Frm_UserProgress();
-            fieldData = new FieldData(result.FilePath);
-            Particledata = new ParticleData(result.FilePath);
         }
-
         private void ParticlesGridDevidePage_Load(object sender, EventArgs e)
         {
-            //初始化底层操作类
-            m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
-
-            ProgressStart();
+            if (!Init())
+            {
+                return;
+            }
+            ProgressStart();//进度条关闭通过cbB_PageSize.SelectedIndex事件
 
-            UpdateTable();
+            if (!UpdateTable())
+            {
+                return;
+            }
 
             cbB_PageSize.Items.Add("20");
             cbB_PageSize.Items.Add("100");
@@ -203,7 +222,7 @@ namespace OTSIncAReportGrids
         }
 
         #region 自定义方法
-        void UpdateTable()
+        bool UpdateTable()
         {
             int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
             if (sel == 1)
@@ -254,7 +273,17 @@ namespace OTSIncAReportGrids
                 particlesAll = Particledata.GetInfoForPartucleDevidePage2(condition);
                 btn_Sel.Enabled = true;
             }
-                
+            if(particlesAll==null)
+            {
+                log.Error("There is an exception in the data of the database!");
+                #region 加载进度条进度部份结束
+                //加载完成设置鼠标为默认
+                this.Cursor = Cursors.Default;
+                //加载完成,关闭进度条
+                m_frm_userprogress.Close();
+                #endregion
+                return false;
+            }
             DataTable elementchemistry = Particledata.GetElementChemistry();
             for (int i = 0; i < particlesAll.Rows.Count; i++)
             {
@@ -267,6 +296,7 @@ namespace OTSIncAReportGrids
                 }
                 particlesAll.Rows[i]["Element"] = ConcatenatedString;
             }
+            return true;
         }
 
         /// <summary>
@@ -1604,7 +1634,7 @@ namespace OTSIncAReportGrids
         private void testToolStripMenuItem1_Click(object sender, EventArgs e)
         {
             //SaveMarkParticleRectangleOnFieldFile();
-            MessageBox.Show("导出完成!");
+            MessageBox.Show("Export completed!");
         }
 
         private void EXCELToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1738,6 +1768,18 @@ namespace OTSIncAReportGrids
             return ms.ToArray();
         }
 
+        public bool CheckParamExist<T>(T Param)
+        {
+            if (Param == null)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+
     }