From 291b43124d537daccc25e4e1613b5ff0cd749050 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 13 十一月 2024 15:55:11 +0800
Subject: [PATCH] 线程
---
DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs | 140 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 125 insertions(+), 15 deletions(-)
diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 299df99..a02baec 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -5,6 +5,7 @@
using System.Drawing;
using System.IO;
using System.Net;
+using System.Net.Cache;
using System.Net.Http;
using System.Reflection;
using System.Resources;
@@ -12,7 +13,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;
@@ -76,6 +76,9 @@
request.Accept = "*/*";
request.Timeout = 15000;
request.AllowAutoRedirect = false;
+ request.ServicePoint.Expect100Continue = false;
+ HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
+ request.CachePolicy = noCachePolicy;
using (Stream requestStream = await request.GetRequestStreamAsync())
{
byte[] dataBytes = Encoding.UTF8.GetBytes(param);
@@ -110,6 +113,9 @@
request.Accept = "*/*";
request.Timeout = 15000;
request.AllowAutoRedirect = false;
+ request.ServicePoint.Expect100Continue = false;
+ HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
+ request.CachePolicy = noCachePolicy;
StreamWriter requestStream = null;
WebResponse response = null;
string responseStr = null;
@@ -284,14 +290,29 @@
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;
-
- 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;
}
-
+ var _btnAry2 = controls.Find("btnTui", false);
+ if (_btnAry2.Length > 0)
+ {
+ var _btnType = _btnAry2[0];
+ _btnType.Enabled = !isEdt;
+ }
foreach (JProperty property in dynamicObject.Properties())
{
var strName = property.Name;
@@ -369,6 +390,14 @@
txt.ReadOnly = isEdt;
continue;
}
+ if (colType is MemoEdit)
+ {
+ var txt = colType as MemoEdit;
+ if (txt != null)
+ txt.Text = strVal;
+ txt.ReadOnly = isEdt;
+ continue;
+ }
//鏁板瓧鍗�
if (colType is NumericUpDown)
@@ -437,9 +466,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
@@ -451,8 +480,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;
}
//鑷畾涔変緵搴斿晢
@@ -460,7 +492,21 @@
{
var txt = colType as UcLookSupplier;
txt.SetIdOrCode(strVal);
- txt.Enabled = !isEdt;
+ if (txt.IsReadly == false)
+ txt.Enabled = !isEdt;
+ else
+ txt.Enabled = false;
+ continue;
+ }
+ //鑷畾涔夌墿鏂�
+ if (colType is UcLookItems)
+ {
+ var txt = colType as UcLookItems;
+ txt.SetIdOrCode(strVal);
+ if (txt.IsReadly == false)
+ txt.Enabled = !isEdt;
+ else
+ txt.Enabled = false;
continue;
}
if (colType is SimpleButton)
@@ -490,7 +536,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)
{
//澶氳鏂囨湰
@@ -532,7 +588,14 @@
txt.ReadOnly = isEdt;
continue;
}
-
+ if (ctrl is MemoEdit)
+ {
+ var txt = ctrl as MemoEdit;
+ if (txt != null)
+ txt.Text = "";
+ txt.ReadOnly = isEdt;
+ continue;
+ }
//鏃堕棿
if (ctrl is DateTimePicker)
{
@@ -570,6 +633,14 @@
txt.Enabled = !isEdt;
continue;
}
+ //鑷畾涔夌墿鏂�
+ if (ctrl is UcLookItems)
+ {
+ var txt = ctrl as UcLookItems;
+ txt.SetIdOrCode("-1");
+ txt.Enabled = !isEdt;
+ continue;
+ }
if (ctrl is SimpleButton)
{
var txt = ctrl as SimpleButton;
@@ -592,7 +663,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)
{
//鏂囨湰
@@ -602,7 +683,12 @@
txt.ReadOnly = isEdt;
continue;
}
-
+ if (ctrl is MemoEdit)
+ {
+ var txt = ctrl as MemoEdit;
+ txt.ReadOnly = isEdt;
+ continue;
+ }
//鏁板瓧鍗�
if (ctrl is NumericUpDown)
{
@@ -610,7 +696,6 @@
txt.ReadOnly = isEdt;
continue;
}
-
//涓嬫媺
if (ctrl is UcComBox)
{
@@ -628,7 +713,8 @@
}
//鍗曢��
- if (ctrl is CheckBox) {
+ if (ctrl is CheckBox)
+ {
ctrl.Enabled = !isEdt;
continue;
}
@@ -741,6 +827,30 @@
return Guid.Parse(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)
+ {
+
+ return 0;
+ }
+ }
/// <summary>
/// 璇诲彇grid鐨勫綋鍓嶈
/// </summary>
@@ -774,7 +884,7 @@
else
{
_strGuid = dr["guid"].ToString();
- _strName = dr[1].ToString();
+ _strName = dr[1].ToString();
}
}
--
Gitblit v1.9.3