lu
2024-11-20 23e55c258ae5ef93a8d684be60271d1af9e730c9
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;
@@ -75,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);
@@ -109,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;
@@ -1008,6 +1015,28 @@
            return "";
        }
        public static void SetCheckIco(object s, PictureBox btnChkIco, Form fm,string icoName="")
        {
            GridView dgv = s as GridView;
            if (dgv != null) {
                if (dgv.GetSelectedRows() != null) {
                    var selectedRow = dgv.GetSelectedRows()[0]; // 获取第一个选中行的索引
                    if (selectedRow >= 0) {
                        var checkStatus = dgv.GetRowCellValue(selectedRow, "checkStatus").ToString(); // 获取指定列的值
                        btnChkIco.Text = checkStatus;
                        btnChkIco.Visible = true;
                        if (checkStatus == "1" || checkStatus.ToUpper() == true.ToString().ToUpper())
                            btnChkIco.Image = global::Gs.DevApp.Properties.Resources.ico_check;
                        else
                            btnChkIco.Image = global::Gs.DevApp.Properties.Resources.ico_noCheck;
                        btnChkIco.Anchor = AnchorStyles.Top | AnchorStyles.Right; // 靠右
                        btnChkIco.Location = new Point(fm.ClientSize.Width - btnChkIco.Width - 20, 80); // 距离顶部10像素
                    }
                }
            }
        }
    }
    /// <summary>