From b084bd77d01a94c8f0a2d20c86a1f45ba7c8a23c Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 19 四月 2025 14:08:05 +0800
Subject: [PATCH] 页面跳转

---
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs |  134 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 114 insertions(+), 20 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 44b6ce0..3967e2b 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -1,4 +1,18 @@
-锘縰sing System;
+锘縰sing DevExpress.Utils;
+using DevExpress.XtraEditors;
+using DevExpress.XtraEditors.Controls;
+using DevExpress.XtraGrid;
+using DevExpress.XtraGrid.Columns;
+using DevExpress.XtraGrid.Menu;
+using DevExpress.XtraGrid.Views.Grid;
+using DevExpress.XtraGrid.Views.Grid.ViewInfo;
+using DevExpress.XtraTab;
+using DevExpress.XtraTreeList;
+using Gs.DevApp.Entity;
+using Gs.DevApp.UserControl;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Data;
@@ -14,20 +28,7 @@
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using DevExpress.Utils;
-using DevExpress.XtraEditors;
-using DevExpress.XtraEditors.Controls;
-using DevExpress.XtraGrid;
-using DevExpress.XtraGrid.Columns;
-using DevExpress.XtraGrid.Menu;
-using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraGrid.Views.Grid.ViewInfo;
-using DevExpress.XtraTab;
-using DevExpress.XtraTreeList;
-using Gs.DevApp.Entity;
-using Gs.DevApp.UserControl;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
+using System.Windows.Forms.VisualStyles;
 using UserControls.Data;
 using static System.Windows.Forms.Control;
 
@@ -41,7 +42,6 @@
     {
         private static readonly string WebApiUrl =
             ConfigurationManager.AppSettings["WebApiUrl"];
-
 
         public static async Task<string> UploadFileAsync(string filePath)
         {
@@ -726,6 +726,7 @@
                     var txt = ctrl as ButtonEdit;
                     txt.Text = "";
                     txt.Enabled = !isEdt;
+                    txt.ReadOnly = isEdt;
                     continue;
                 }
                 //鏂囨湰
@@ -1351,6 +1352,14 @@
             return false;
         }
 
+        public static bool ToCheck(string str)
+        {
+            if (str.ToUpper() == "true".ToUpper())
+                return true;
+            if (str.ToUpper() == "1".ToUpper())
+                return true;
+            return false;
+        }
 
         /// <summary>
         /// 璇诲彇grid鐨勫綋鍓嶈
@@ -1745,8 +1754,10 @@
                 if (column.Tag == null || column.Tag.ToString().EndsWith("edit"))
                     column.OptionsColumn.ReadOnly = false;
                 else
-                    //column.OptionsColumn.ReadOnly = true;
-                column.OptionsColumn.ReadOnly = !isPostSearch;
+                    column.OptionsColumn.ReadOnly = true;
+
+                //if(isPostSearch==false)
+                //    column.OptionsColumn.ReadOnly = true;
 
                 if (isPostSearch == true)
                 {
@@ -2033,7 +2044,20 @@
             bool isNumeric = decimal.TryParse(input, out number);
             return isNumeric;
         }
-
+        /// <summary>
+        /// 鍒ゆ柇鏄笉鏄竴涓湁鏁堢殑姝f暣鏁�
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static bool IsNumeric3(string str)
+        {
+            string input = str;
+            decimal number;
+            bool isNumeric = decimal.TryParse(input, out number);
+            if (isNumeric && number > 0)
+                return true;
+            return false;
+        }
         public static void PrintJiSuan(DevExpress.XtraEditors.TextEdit box1, DevExpress.XtraEditors.TextEdit box2, string sum, DevExpress.XtraEditors.RadioGroup rd)
         {
             if (rd.SelectedIndex == 2)
@@ -2065,7 +2089,8 @@
             }
 
         }
-        public static void PrintAuto(DevExpress.XtraEditors.TextEdit txt_psnQty_1, DevExpress.XtraEditors.TextEdit txt_iCount_1, DevExpress.XtraEditors.RadioGroup radOut) {
+        public static void PrintAuto(DevExpress.XtraEditors.TextEdit txt_psnQty_1, DevExpress.XtraEditors.TextEdit txt_iCount_1, DevExpress.XtraEditors.RadioGroup radOut)
+        {
             txt_psnQty_1.Text = "";
             txt_iCount_1.Text = "";
             radOut.Properties.Items[0].Description = "鍏ㄨ嚜鍔�";
@@ -2086,6 +2111,75 @@
                 return 0;
             return decimal.Parse(txt);
         }
+
+        #region 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
+        /// <summary>
+        /// 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
+        /// </summary>
+        //  private Rectangle checkBoxColumnHeaderRect = Rectangle.Empty;
+        // private GridColumn checkBoxColumn = null;
+        public static void CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
+        {
+
+            Rectangle checkBoxColumnHeaderRect = new Rectangle(51, 1, 37, 57);
+            if (e.Column != null && e.Column.AbsoluteIndex == 0)
+            {
+                //X = 51 Y = 1 Width = 37 Height = 57
+                e.Column.Caption = ".";
+                checkBoxColumnHeaderRect = e.Bounds;
+                // checkBoxColumn = e.Column;
+                //椤绘妸鍒楀ご鏍囬璁剧疆涓虹┖
+                e.Painter.DrawObject(e.Info);
+                //鍦ㄥ垪澶翠腑蹇冩樉绀哄閫夋
+                int x = e.Bounds.X + (int)((e.Bounds.Width - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Width) * 0.5);
+                int y = e.Bounds.Y + (int)((e.Bounds.Height - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Height) * 0.5);
+                Point location = new Point(x, y);
+                CheckBoxState checkBoxState;
+                if (e.Column.Tag != null && e.Column.Tag.ToString() == "1")
+                    checkBoxState = CheckBoxState.CheckedPressed;
+                else
+                    checkBoxState = CheckBoxState.UncheckedNormal;
+                CheckBoxRenderer.DrawCheckBox(e.Graphics, location, checkBoxState);
+                e.Handled = true;
+            }
+        }
+
+        public static void CustomMouseUp(object sender, MouseEventArgs e, DevExpress.XtraGrid.GridControl gcMain, DevExpress.XtraGrid.Views.Grid.GridView gridView1)
+        {
+            GridColumn checkBoxColumn = gridView1.Columns[0];
+            Rectangle checkBoxColumnHeaderRect = new Rectangle(51, 1, 37, 57);
+            if (checkBoxColumnHeaderRect != Rectangle.Empty)
+            {
+                if (e.X > checkBoxColumnHeaderRect.X && e.X < (checkBoxColumnHeaderRect.X + checkBoxColumnHeaderRect.Width) && e.Y > checkBoxColumnHeaderRect.Y && e.Y < (checkBoxColumnHeaderRect.Y + checkBoxColumnHeaderRect.Height))
+                {
+                    DataTable _Table = (DataTable)gcMain.DataSource;
+                    if (checkBoxColumn.Tag != null && checkBoxColumn.Tag.ToString() == "1")
+                    {
+                        checkBoxColumn.Tag = "0";
+                        foreach (DataRow row in _Table.Rows)
+                        {
+                            row["chkInt"] = false;
+                        }
+                    }
+                    else
+                    {
+                        checkBoxColumn.Tag = "1";
+                        foreach (DataRow row in _Table.Rows)
+                        {
+                            row["chkInt"] = true;
+                        }
+                    }
+                    gcMain.BindingContext = new BindingContext();
+                    gcMain.DataSource = _Table;
+                    gcMain.ForceInitialize();
+                    gridView1.CloseEditor();
+                    gridView1.PostEditor();
+                    gridView1.UpdateCurrentRow();
+                    gridView1.InvalidateColumnHeader(checkBoxColumn);
+                }
+            }
+        }
+        #endregion
     }
 
     /// <summary>

--
Gitblit v1.9.3