| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraTab; |
| | | using System.Text.RegularExpressions; |
| | | using System.Xml; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace Gs.DevApp.ToolBox |
| | | { |
| | |
| | | /// <param name="controls">controls:为groupBox1.Controls/panel1.Controls</param> |
| | | /// <param name="dynamicObject">对像</param> |
| | | /// <param name="isEdt">是否可编辑</param> |
| | | public static void SetValueByObj(ControlCollection controls, dynamic dynamicObject, Boolean isEdt) |
| | | public static void SetValueByObj(ControlCollection controls, dynamic dynamicObject, Boolean isEdt, List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = null) |
| | | { |
| | | |
| | | if (gridViews != null) |
| | | { |
| | | foreach (DevExpress.XtraGrid.Views.Grid.GridView gv in gridViews) |
| | | { |
| | | gv.OptionsBehavior.Editable = isEdt; |
| | | } |
| | | } |
| | | foreach (JProperty property in dynamicObject.Properties()) |
| | | { |
| | | string strName = property.Name; |
| | |
| | | txt.Enabled = isEdt; |
| | | continue; |
| | | } |
| | | //时间 |
| | | if (colType is DateTimePicker) |
| | | { |
| | | DateTimePicker txt = colType as DateTimePicker; |
| | | if (txt != null) |
| | | txt.Checked = (strVal.ToString() == "1" ? true : false); |
| | | txt.Enabled = isEdt; |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// </summary> |
| | | /// <param name="controls">controls:为groupBox1.Controls/panel1.Controls</param> |
| | | /// <param name="isEdt">是否可编辑</param> |
| | | public static void CleanValue(ControlCollection controls, Boolean isEdt) |
| | | public static void CleanValue(ControlCollection controls, Boolean isEdt, List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = null) |
| | | { |
| | | if (gridViews != null) |
| | | { |
| | | foreach (DevExpress.XtraGrid.Views.Grid.GridView gv in gridViews) |
| | | { |
| | | gv.OptionsBehavior.Editable = isEdt; |
| | | } |
| | | } |
| | | foreach (Control ctrl in controls) |
| | | { |
| | | ctrl.Enabled = isEdt; |
| | |
| | | /// </summary> |
| | | /// <param name="controls">controls:为groupBox1.Controls/panel1.Controls</param> |
| | | /// <param name="isEdt">是否可编辑</param> |
| | | public static void ChangeEnable(ControlCollection controls, Boolean isEdt) |
| | | public static void ChangeEnable(ControlCollection controls, Boolean isEdt, List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = null) |
| | | { |
| | | if (gridViews != null) |
| | | { |
| | | foreach (DevExpress.XtraGrid.Views.Grid.GridView gv in gridViews) |
| | | { |
| | | gv.OptionsBehavior.Editable = isEdt; |
| | | } |
| | | } |
| | | foreach (Control ctrl in controls) |
| | | { |
| | | //文本 |
| | |
| | | ctrl.Enabled = isEdt; |
| | | continue; |
| | | } |
| | | |
| | | //日期 |
| | | if (ctrl is DateTimePicker) |
| | | { |
| | | ctrl.Enabled = isEdt; |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | string dd = Regex.Replace(propertyName, @"_([a-z])", m => m.Groups[1].Value.ToUpper()); |
| | | return dd; |
| | | } |
| | | public static void UpdateAppConfig(string key, string newValue) |
| | | { |
| | | string configFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; |
| | | XmlDocument xmlDoc = new XmlDocument(); |
| | | xmlDoc.Load(configFile); |
| | | |
| | | XmlNode node = xmlDoc.SelectSingleNode($"//appSettings//add[@key='{key}']"); |
| | | if (node != null) |
| | | { |
| | | XmlAttribute attribute = node as XmlAttribute; |
| | | attribute.Value = newValue; |
| | | xmlDoc.Save(configFile); |
| | | } |
| | | } |
| | | public class CboItemEntity |
| | | { |
| | | private object _text = 0; |