public static IEnumerable <Range <DateTime> > QueryDateTimeRanges(SystemParamType paramType) { var data = QueryParam(paramType); var result = new List <Range <DateTime> >(); if (data != null) { if (!string.IsNullOrWhiteSpace(data.Value)) { var rangeArray = data.Value.Trim().Split(';'); foreach (var range in rangeArray) { if (!string.IsNullOrWhiteSpace(range)) { var timeArray = range.Trim().Split('|'); if (timeArray.Length == 2) { DateTime beginTime, endTime; if (DateTime.TryParse(timeArray[0], out beginTime) && DateTime.TryParse(timeArray[1], out endTime)) { result.Add(new Range <DateTime>(beginTime, endTime)); } } } } } return(result); } throw new CustomException("参数格式错误"); }
public void Update(SystemParamType paramType, string value) { var data = this[paramType]; data.Value = value; _repositoryCache.Update(paramType, data); }
public int Update(SystemParamType type, string value) { string sql = "UPDATE [T_SystemParam] SET [VALUE]=@VALUE WHERE [ID]=@ID"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("ID", (int)type); dbOperator.AddParameter("VALUE", value); return(dbOperator.ExecuteNonQuery(sql)); } }
public static SystemParam QueryParam(SystemParamType paramType) { var data = SystemParams.Instance[paramType]; if (data == null) { throw new CustomException("无该参数"); } return(data); }
public static float QueryFloat(SystemParamType paramType) { var data = QueryParam(paramType); float result = 0; if (data != null && float.TryParse(data.Value, out result)) { return(result); } throw new CustomException("参数格式错误"); }
public static decimal QueryDecimal(SystemParamType paramType) { var data = QueryParam(paramType); decimal result = 0; if (data != null && decimal.TryParse(data.Value, out result)) { return(result); } throw new CustomException("参数格式错误"); }
protected void btnSubmit_Click(object sender, EventArgs e) { SystemParamType systemParamType = (SystemParamType)Enum.Parse(typeof(SystemParamType), Request.QueryString["type"].ToString()); try { SystemParamService.Update(systemParamType, this.txtValue.Text.ToString(), CurrentUser.UserName); RegisterScript("alert('修改成功!'); window.location.href='SystemParameter.aspx';"); } catch (Exception ex) { ShowExceptionMessage(ex, "修改"); } }
public static void Update(SystemParamType paramType, string value, string account) { string originalValue = QueryString(paramType); // 修改数据 SystemParams.Instance.Update(paramType, value); // 记录日志 var content = "将参数 [" + paramType.GetDescription() + "] 的值由 " + (originalValue ?? string.Empty) + " 修改为 " + (value ?? string.Empty); var log = new Service.Log.Domain.OperationLog(OperationModule.系统参数, OperationType.Update, account, OperatorRole.Platform, ((int)paramType).ToString(), content, DateTime.Now); Service.LogService.SaveOperationLog(log); }
public BaseEntity BuildObject(Dictionary <string, object> row) { var ParamType = new SystemParamType { IdParamType = GetIntValue(row, IDPARAMTYPE) }; var Param = new SystemParam { IdSystemParam = GetIntValue(row, IDPARAM), Name = GetStringValue(row, PARAMNAME), Value = GetStringValue(row, PARAMVALUE), ParamType = ParamType }; return(Param); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["type"] != null) { SystemParamType systemParamType = (SystemParamType)Enum.Parse(typeof(SystemParamType), Request.QueryString["type"].ToString()); SystemParam systemParam = SystemParamService.QueryParam(systemParamType); if (systemParam != null) { this.txtType.Text = Request.QueryString["TypeName"].ToString(); this.txtValue.Text = systemParam.Value; this.ttRemark.InnerText = systemParam.Remark; this.txtType.Enabled = false; this.ttRemark.Disabled = true; } } } }
public SystemParam this[SystemParamType paramType] { get { return(_repositoryCache[paramType]); } }
internal SystemParam(SystemParamType type, string value, string remark) { this.Type = type; this.Value = value; this.Remark = remark; }
public static string QueryString(SystemParamType paramType) { return(QueryParam(paramType).Value); }