From 13e0b579eb4ad6151e2f27b822837be81d3f6143 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 13 十一月 2024 08:10:48 +0800
Subject: [PATCH] 1

---
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs |   77 ++++++++++++++++++++++++++++++--------
 1 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 5b03238..5b0c13b 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -12,7 +12,6 @@
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using DevExpress.Office.Model;
 using DevExpress.XtraEditors;
 using DevExpress.XtraEditors.Controls;
 using DevExpress.XtraGrid;
@@ -283,9 +282,11 @@
         {
             isEdt = !isEdt;
             if (gridViews != null)
-                foreach (var gv in gridViews) {
-                    foreach (GridColumn colmn in gv.Columns) {
-                        if (colmn.Name == "gvMxDel")
+                foreach (var gv in gridViews)
+                {
+                    foreach (GridColumn colmn in gv.Columns)
+                    {
+                        if (colmn.Name.ToString().Contains("gvMxDel"))
                         {
                             colmn.Visible = !isEdt;
                             break;
@@ -293,8 +294,9 @@
                     }
                     gv.OptionsBehavior.Editable = !isEdt;
                 }
-           var _btnAry=  controls.Find("btnSelect", false);
-            if (_btnAry.Length > 0) {
+            var _btnAry = controls.Find("btnSelect", false);
+            if (_btnAry.Length > 0)
+            {
                 var _btnType = _btnAry[0];
                 _btnType.Enabled = !isEdt;
             }
@@ -389,7 +391,7 @@
                             txt.ReadOnly = isEdt;
                             continue;
                         }
-                        
+
                         //鏁板瓧鍗�
                         if (colType is NumericUpDown)
                         {
@@ -457,9 +459,9 @@
                             var txt = colType as Label;
                             if (_dddddd == "txt_checkStatus")
                             {
-                                if (strVal == "True" || strVal=="1")
+                                if (strVal == "True" || strVal == "1")
                                     txt.Text = "宸插鏍�";
-                                if (strVal == "False" || strVal=="0" || strVal=="")
+                                if (strVal == "False" || strVal == "0" || strVal == "")
                                     txt.Text = "鏈鏍�";
                             }
                             else
@@ -471,8 +473,11 @@
                         if (colType is UcLookCk)
                         {
                             var txt = colType as UcLookCk;
-                            txt.SetIdOrCode( strVal);
-                            txt.Enabled = !isEdt;
+                            txt.SetIdOrCode(strVal);
+                            if (txt.IsReadly == false)
+                                txt.Enabled = !isEdt;
+                            else
+                                txt.Enabled = false;
                             continue;
                         }
                         //鑷畾涔変緵搴斿晢
@@ -480,7 +485,10 @@
                         {
                             var txt = colType as UcLookSupplier;
                             txt.SetIdOrCode(strVal);
-                            txt.Enabled = !isEdt;
+                            if (txt.IsReadly == false)
+                                txt.Enabled = !isEdt;
+                            else
+                                txt.Enabled = false;
                             continue;
                         }
                         //鑷畾涔夌墿鏂�
@@ -488,7 +496,10 @@
                         {
                             var txt = colType as UcLookItems;
                             txt.SetIdOrCode(strVal);
-                            txt.Enabled = !isEdt;
+                            if (txt.IsReadly == false)
+                                txt.Enabled = !isEdt;
+                            else
+                                txt.Enabled = false;
                             continue;
                         }
                         if (colType is SimpleButton)
@@ -518,7 +529,17 @@
             isEdt = !isEdt;
             if (gridViews != null)
                 foreach (var gv in gridViews)
+                {
+                    foreach (GridColumn colmn in gv.Columns)
+                    {
+                        if (colmn.Name.ToString().Contains("gvMxDel"))
+                        {
+                            colmn.Visible = !isEdt;
+                            break;
+                        }
+                    }
                     gv.OptionsBehavior.Editable = !isEdt;
+                }
             foreach (Control ctrl in controls)
             {
                 //澶氳鏂囨湰
@@ -635,7 +656,17 @@
             isEdt = !isEdt;
             if (gridViews != null)
                 foreach (var gv in gridViews)
+                {
+                    foreach (GridColumn colmn in gv.Columns)
+                    {
+                        if (colmn.Name.ToString().Contains("gvMxDel"))
+                        {
+                            colmn.Visible = !isEdt;
+                            break;
+                        }
+                    }
                     gv.OptionsBehavior.Editable = !isEdt;
+                }
             foreach (Control ctrl in controls)
             {
                 //鏂囨湰
@@ -675,7 +706,8 @@
                 }
 
                 //鍗曢��
-                if (ctrl is CheckBox) {
+                if (ctrl is CheckBox)
+                {
                     ctrl.Enabled = !isEdt;
                     continue;
                 }
@@ -788,10 +820,23 @@
             return Guid.Parse(str);
         }
 
-        public static int ToInt(string str) {
+        public static int ToInt(string str)
+        {
             try
             {
                 return int.Parse(str);
+            }
+            catch (Exception)
+            {
+
+                return 0;
+            }
+        }
+        public static long ToLong(string str)
+        {
+            try
+            {
+                return long.Parse(str);
             }
             catch (Exception)
             {
@@ -832,7 +877,7 @@
                 else
                 {
                     _strGuid = dr["guid"].ToString();
-                      _strName = dr[1].ToString();
+                    _strName = dr[1].ToString();
                 }
             }
 

--
Gitblit v1.9.3