| | |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using DevExpress.RichEdit.Export; |
| | | using DevExpress.XtraBars.Customization; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using DevExpress.XtraGrid; |
| | |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using DevExpress.XtraTab; |
| | | using DevExpress.XtraTreeList; |
| | | using DevExpress.XtraWaitForm; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | |
| | | /// <returns></returns> |
| | | public static string HttpPost(string url, string meth, string param) |
| | | { |
| | | DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm("拼命加载中,请稍后..." + meth, "友情提示"); |
| | | string _caption = "拼命加载中,请稍后..."; |
| | | DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm(_caption + meth, "友情提示"); |
| | | wdf.BackColor = System.Drawing.Color.LightSkyBlue; |
| | | wdf.Padding = new Padding(15); |
| | | HttpWebRequest request = null; |
| | | StreamWriter requestStream = null; |
| | | WebResponse response = null; |
| | |
| | | request.Timeout = 15000; |
| | | request.AllowAutoRedirect = false; |
| | | request.ServicePoint.Expect100Continue = false; |
| | | wdf.SetCaption("加载进度(10/100)"); |
| | | wdf.SetCaption(_caption+"(10/100)" + meth); |
| | | HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); |
| | | request.CachePolicy = noCachePolicy; |
| | | wdf.SetCaption("加载进度(20/100)"); |
| | | wdf.SetCaption(_caption + "(20/100)" + meth); |
| | | requestStream = new StreamWriter(request.GetRequestStream()); |
| | | requestStream.Write(param); |
| | | requestStream.Close(); |
| | | wdf.SetCaption(_caption + "30/100)" + meth); |
| | | response = request.GetResponse(); |
| | | wdf.SetCaption(_caption + "(40/100)"); |
| | | if (response != null) |
| | | { |
| | | wdf.SetCaption(_caption + "(50/100)" + meth); |
| | | var reader = new StreamReader(response.GetResponseStream(), |
| | | Encoding.UTF8); |
| | | responseStr = reader.ReadToEnd(); |
| | | //File.WriteAllText(Server.MapPath("~/") + @"\test.txt", responseStr); |
| | | reader.Close(); |
| | | wdf.SetCaption(_caption + "(60/100)" + meth); |
| | | } |
| | | wdf.SetCaption("加载进度(80/100)"); |
| | | wdf.SetCaption(_caption + "(80/100)" + meth); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | requestStream = null; |
| | | response = null; |
| | | } |
| | | wdf.SetCaption("加载进度(90/100)"); |
| | | wdf.SetCaption(_caption + "(90/100)"); |
| | | wdf.Close(); |
| | | return responseStr; |
| | | } |
| | |
| | | var dt = new DataTable(); |
| | | foreach (GridColumn col in gv.Columns) |
| | | { |
| | | if (col.UnboundDataType == typeof(bool)) |
| | | if (col.UnboundDataType == typeof(System.Boolean)) |
| | | dt.Columns.Add(col.FieldName, typeof(System.Boolean)); |
| | | else |
| | | { |
| | |
| | | /// <param name="icoName">图标路径</param> |
| | | public static void SetGridSear(GridView gridView1, PictureBox btnChkIco = null, Form fm = null, string fileName = "checkStatus", string icoName = "") |
| | | { |
| | | // gridView1.OptionsView.ColumnAutoWidth = false;自动调整列宽 |
| | | |
| | | foreach (GridColumn column in gridView1.Columns) |
| | | { |
| | | column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; |
| | |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置明细grid样式 |
| | | /// </summary> |
| | | /// <param name="gridView1"></param> |
| | | /// <param name="btnChkIco"></param> |
| | | /// <param name="fm"></param> |
| | | /// <param name="fileName"></param> |
| | | /// <param name="icoName"></param> |
| | | public static void SetGridSearMx(GridView gridView1) |
| | | { |
| | | gridView1.OptionsFilter.AllowFilterEditor = false; |
| | | gridView1.OptionsFilter.ShowCustomFunctions = DevExpress.Utils.DefaultBoolean.False; |
| | | gridView1.OptionsCustomization.AllowFilter = false; |
| | | gridView1.OptionsFind.ShowSearchNavButtons = false; |
| | | gridView1.OptionsView.ShowAutoFilterRow = false; |
| | | gridView1.OptionsView.ShowGroupPanel = false; |
| | | gridView1.IndicatorWidth = 40; |
| | | gridView1.CustomDrawRowIndicator += (s, e) => |
| | | { |
| | | if (e.Info.IsRowIndicator && e.RowHandle >= 0) |
| | | e.Info.DisplayText = (e.RowHandle + 1).ToString(); |
| | | }; |
| | | gridView1.CustomDrawEmptyForeground += (s, e) => |
| | | { |
| | | var str = "暂无明细数据!"; |
| | | var f = new Font("微软雅黑", 16); |
| | | var r = new Rectangle(gridView1.GridControl.Width / 2 - 100, |
| | | e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); |
| | | e.Graphics.DrawString(str, f, Brushes.Gray, r); |
| | | }; |
| | | gridView1.ValidatingEditor += (sender, e) => |
| | | { |
| | | //yz_quantity_0 |
| | | GridView view = sender as GridView; |
| | | if (view.FocusedColumn.Tag != null && view.FocusedColumn.Tag.ToString().StartsWith("yz_")) |
| | | { |
| | | string[] _ary = view.FocusedColumn.Tag.ToString().Split('_'); |
| | | if (_ary.Length > 2) |
| | | { |
| | | if (_ary[2] == "0") |
| | | { |
| | | double price = 0; if (!Double.TryParse(e.Value as String, out price)) |
| | | { e.Valid = false; e.ErrorText = "请输入正确的数字."; } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public static bool IsNumeric(string str) |
| | |
| | | return regex.IsMatch(str); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// yz_quantity_0,yz_字段_类型 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | public static void SetValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e) |
| | | { |
| | | //yz_quantity_0 |
| | | GridView view = sender as GridView; |
| | | if (view.FocusedColumn.Tag != null && view.FocusedColumn.Tag.ToString().StartsWith("yz_")) |
| | | { |
| | | string[] _ary = view.FocusedColumn.Tag.ToString().Split('_'); |
| | | if (_ary.Length > 2) |
| | | { |
| | | if (_ary[2] == "0") |
| | | { |
| | | double price = 0; if (!Double.TryParse(e.Value as String, out price)) |
| | | { e.Valid = false; e.ErrorText = "请输入正确的数字."; } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |