public CodeItem(IDecoderItem item) { TkDebug.AssertArgumentNull(item, "item", null); Value = item.Value; Name = item.Name; }
public void Decode(IEnumerable <IFieldInfoEx> fields) { if (fields == null) { return; } var decodeFields = from item in fields where item.Decoder != null && item.Decoder.Type != DecoderType.None select item; if (Decoder == null) { Decoder = new ObjectDecoderContainer(); } foreach (var item in decodeFields) { IDecoder coder = GetDecoder(item.Decoder); if (coder != null) { IDecoderItem decodeItem = coder.Decode( MainObject.MemberValue(item.NickName).ConvertToString()); if (decodeItem != null) { Decoder.Add(item.NickName, decodeItem); } } } }
public override IDecoderItem[] SearchByName(string name, params object[] args) { TkDbContext context; bool createContext; GetContext(args, out context, out createContext); try { IParamBuilder builder = SqlParamBuilder.CreateEqualSql(context, NameField, name); DataTable table = FetchRows(context, fDataSet, builder, 2); if (table == null || table.Rows.Count == 0) { return(null); } IDecoderItem[] result = new IDecoderItem[table.Rows.Count]; int index = 0; DataColumnCollection columns = table.Columns; foreach (DataRow row in table.Rows) { result[index++] = new DataRowDecoderItem(columns, row, DecoderConst.CODE_NICK_NAME, fExpression, fDisplayExpression); } return(result); } finally { if (createContext) { context.Dispose(); } } }
public IDecoderItem this[string nickName] { get { IDecoderItem result = ObjectUtil.TryGetValue(fDictionary, nickName); return(result); } }
public void Add(string nickName, IDecoderItem item) { TkDebug.AssertArgumentNullOrEmpty(nickName, "nickName", this); if (item == null) { return; } fDictionary[nickName] = item; }
public MultipleDecodeItem(string code, IDecoder decoder, params object[] args) { fDecodeData = new MultipleDecoderData(); QuoteStringList list = QuoteStringList.FromString(code); var items = list.CreateEnumerable(); foreach (string item in items) { IDecoderItem dItem = decoder.Decode(item, args); fDecodeData.AddItem(dItem); } Name = fDecodeData.ToJson(); DisplayName = Name; }
public void AddItem(IDecoderItem item) { if (item == null) { return; } CodeItem codeItem = item as CodeItem; if (codeItem == null) { codeItem = new CodeItem(item); } Data.Add(codeItem); }
public void AddData(IDecoderItem row, IEnumerable <DecoderAdditionInfo> infos) { if (row == null || infos == null) { return; } foreach (var info in infos) { try { string columnName = info.DecoderNickName; string value = row[columnName].ToString(); AdditionData.Add(columnName, value); } catch { } } }
public EasySearchErrorType CheckName(string name, ref string value, params object[] args) { if (!string.IsNullOrEmpty(value)) { IDecoderItem item = Decode(value, args); // YJC 2012.9.21修改,此处为适应IE提交自动删除空格的问题 //DataRow row = FindByKey(selector, tableName, value); if (item == null || SafeTrim(item.Name) != SafeTrim(name)) { value = string.Empty; return(EasySearchErrorType.NotExist); } else { return(EasySearchErrorType.None); } } if (string.IsNullOrEmpty(value)) { IDecoderItem[] result = SearchByName(name, args); if (result == null || result.Length == 0) { value = string.Empty; return(EasySearchErrorType.NotExist); } switch (result.Length) { case 1: value = result[0].Value; return(EasySearchErrorType.None); default: value = string.Empty; return(EasySearchErrorType.VariousTwo); } } value = string.Empty; return(EasySearchErrorType.NotExist); }
internal DataRowDecoderItem(IDecoderItem item) { Value = item.Value; Name = item.Name; DisplayName = item.DisplayName; }