/// <summary> /// 按参数表绑定LookUpEdit控件 /// </summary> /// <param name="control">LookUpEdit控件</param> /// <param name="type">参数类型</param> /// <param name="isRefreshData">是否刷新数据</param> public static void BindLookUpByParameter(LookUpEdit control, string type, AppendType appendType, bool isRefreshData) { //加载数据 if (!dictParameter.ContainsKey(type) || isRefreshData) { List<SysParameter> _lstParameter = WcfServiceHelper.Client.GetParameterListByType(type).ToList(); dictParameter.Add(type, _lstParameter); } List<SysParameter> lstParameter = dictParameter[type].OrderBy(obj => obj.OrderID).ToList(); if (appendType != AppendType.None) { SysParameter para = new SysParameter(); para.Code = ""; if (appendType == AppendType.All) { para.DisplayName = "全部"; para.FullName = "全部"; } else if (appendType == AppendType.Blank) { para.DisplayName = ""; para.FullName = ""; } lstParameter.Insert(0, para); } control.Properties.DataSource = lstParameter; }
public JoinStatement( StatementPosition position, string @string, AppendType appendType, IList<RuleStatement> statements) : base(position) { this.@string = @string; this.appendType = appendType; this.statements = statements ?? new RuleStatement[0]; foreach (var statement in this.statements) { if (statement is ValueStatement) continue; if (statement is ApplyStatement) continue; if (statement is CallStatement) continue; throw new JoinBuildException( "Can't contain statement of type: " + statement.GetType() ); } }
/// <summary> /// 按部门获取员工 /// </summary> public static List<CoEmployee> GetEmployeeByDepartment(AppendType appendType, int deptID, bool isRefreshData) { string key = "Employee_" + deptID; if (!dictData.ContainsKey(key) || isRefreshData) { List<CoEmployee> _lstObjects = WcfServiceHelper.Client.GetEmployeeByDepartment(deptID).ToList(); dictData[key] = _lstObjects; } List<CoEmployee> lstObjects = new List<CoEmployee>((List<CoEmployee>)dictData[key]); if (appendType != AppendType.None) { CoEmployee employee = new CoEmployee(); employee.Name = appendType == AppendType.All ? "全部" : ""; lstObjects.Insert(0, employee); } return lstObjects.Clone(); }
/// <summary> /// 将一个Tween添加到管理器中 /// 这样当有新的请求发生的时候,可以查询 /// /// 当Tween完成后,不会自动清除 /// 需要手动清除 /// </summary> /// <param name="_object"></param> /// <param name="_tween"></param> /// <param name="_appendType"></param> public void AddTween(object _object, Tween _tween, AppendType _appendType) { if (excutingTweens.ContainsKey(_object)) { if (_appendType == AppendType.Kill) { excutingTweens[_object].Kill(false); } else { excutingTweens[_object].Kill(true); } excutingTweens.Remove(_object); } excutingTweens.Add(_object, _tween); }
/// <summary> /// Returns the prefix or suffix text, depending on the supplied <see cref="AppendType"/>. /// If the prefix or suffix is null, it will be returned a string.empty. /// </summary> /// <param name="at">The <see cref="AppendType"/> defines the format of the return value</param> /// <returns>Returns the formated prefix or suffix</returns> private string GetAppendText(AppendType at) { // define a return value string retVal = string.Empty; // if it should be a prefix, the format will be [PREFIX] if (at == AppendType.Prefix && !string.IsNullOrEmpty(m_Prefix)) { retVal = m_Prefix ?? string.Empty; } // if it should be a suffix, the format will be [SUFFIX] else if (at == AppendType.Suffix && !string.IsNullOrEmpty(m_Suffix)) { retVal = m_Suffix ?? string.Empty; } // return the formated prefix or suffix return(retVal); }
/// <summary> /// JSONを見易く整形する /// </summary> /// <param name="json">json.</param> /// <param name="indentType">indentType.</param> /// <param name="indentSize">indentSize.</param> /// <returns>見易く整形したJSON</returns> public static string ToPrettyPrint(string json, IndentType indentType, int indentSize = 4) { json = ToMinifyPrint(json); var stringBuilder = new StringBuilder(); AppendType appendType = AppendType.None; int i = 0; int quoteCount = 0; int indent = 0; int position = 0; int lastIndex = 0; while (i < json.Length) { if (i > 0 && json[i - 1] != '\\' && json[i] == '"') { ++quoteCount; } if (quoteCount % 2 == 0) { switch (json[i]) { case '{': ++indent; position = 1; appendType = AppendType.AppendLine; break; case '[': position = 1; if (json[i + 1] == ']') { appendType = AppendType.Append; } else { ++indent; appendType = AppendType.AppendLine; } break; case '}': case ']': --indent; position = 0; appendType = AppendType.AppendLine; break; case ',': position = 1; appendType = AppendType.AppendLine; break; case ':': position = 1; appendType = AppendType.AppendSpace; break; } switch (appendType) { case AppendType.None: break; case AppendType.Append: stringBuilder.Append(json.Substring(lastIndex, i + position - lastIndex)); lastIndex = i + position; i = lastIndex; break; case AppendType.AppendLine: stringBuilder.AppendLine(json.Substring(lastIndex, i + position - lastIndex)); switch (indentType) { case IndentType.Space: stringBuilder.Append(new string(' ', indent * indentSize)); break; case IndentType.Tab: stringBuilder.Append(new string('\t', indent)); break; default: throw new ArgumentOutOfRangeException("indentType", indentType, null); } lastIndex = i + position; break; case AppendType.AppendSpace: stringBuilder.Append(json.Substring(lastIndex, i + position - lastIndex)).Append(' '); lastIndex = i + position; break; default: throw new ArgumentOutOfRangeException(); } appendType = AppendType.None; } ++i; } stringBuilder.Append(json.Substring(lastIndex)); return(stringBuilder.ToString()); }
/// <summary> /// 获取参数列表 /// </summary> public static List<SysParameter> GetParameterList(string type, bool isRefreshData, AppendType appendType) { if (!dictData.ContainsKey("para_" + type) || isRefreshData) { int version = WcfServiceHelper.Client.GetVersion(type); if (version != -1) //按版本加载 { EF.Version v = LocalStoreHelper.Context.Version.FirstOrDefault(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()); #region 保存到本地 if (v == null || v.Version1 != version) { //下载到本地 List<SysParameter> objs = WcfServiceHelper.Client.GetParameterListByType(type).ToList(); //删除本地的数据 EF.LocalStoreEntities context = LocalStoreHelper.Context; IQueryable<EF.Parameter> paras = LocalStoreHelper.Context.Parameter.Where(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()); foreach (EF.Parameter p in paras) context.Parameter.DeleteObject(p); //加载到本地 foreach (SysParameter p in objs) { EF.Parameter newObj = new EF.Parameter(); newObj.Type = type; newObj.Code = p.Code; newObj.Name = p.DisplayName; newObj.ParentCode = p.ParentCode; newObj.OrderID = p.OrderID; newObj.Valid = p.Valid; context.Parameter.AddObject(newObj); } if (v != null) context.Version.DeleteObject(v); EF.Version newVersion = new EF.Version(); newVersion.Type = type; newVersion.Version1 = version; context.Version.AddObject(newVersion); context.SaveChanges(); } #endregion #region 从本地加载 List<EF.Parameter> lstParameter = LocalStoreHelper.Context.Parameter.Where(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()).OrderBy(obj => obj.OrderID).ToList(); List<SysParameter> _lstParameterType = new List<SysParameter>(); foreach (EF.Parameter p in lstParameter) { SysParameter newObj = new SysParameter(); newObj.Type = p.Type; newObj.Code = p.Code; newObj.DisplayName = p.Name; newObj.ParentCode = p.ParentCode; newObj.OrderID = p.OrderID; newObj.Valid = p.Valid; _lstParameterType.Add(newObj); } dictData["para_" + type] = _lstParameterType; #endregion } else //直接加载 { List<SysParameter> _lstParameterType = WcfServiceHelper.Client.GetParameterListByType(type).ToList(). OrderBy(obj => obj.OrderID).ToList(); dictData["para_" + type] = _lstParameterType; } } List<SysParameter> resultObj = ((List<SysParameter>)dictData["para_" + type]).Clone(); if (appendType != AppendType.None) { SysParameter p = new SysParameter(); p.Code = ""; if (appendType == AppendType.Blank) p.DisplayName = ""; else if (appendType == AppendType.All) p.DisplayName = "全部"; p.Valid = true; resultObj.Insert(0, p); } return resultObj; }
protected UnexpectedAppendTypeWriterException( SerializationInfo info, StreamingContext context, AppendType appendType ) : base(info, context) { this.appendType = appendType; }
public UnexpectedAppendTypeWriterException( string message, System.Exception inner, AppendType appendType ) : base(message, inner) { this.appendType = appendType; }
public UnexpectedAppendTypeWriterException( string message, AppendType appendType ) : base(message) { this.appendType = appendType; }
public UnexpectedAppendTypeWriterException( AppendType appendType ) { this.appendType = appendType; }