public async Task <DictionaryEntity <int> > ExecuteAsync(DictionaryType dictionaryType, int id) { var repo = Uow.GetRepository(); var entityClrType = repo.GetEntityClrType(dictionaryType.ToString()); dynamic entity = Activator.CreateInstance(entityClrType); IQueryable dicData = repo.AsQueriable(entity); return(await dicData.Cast <DictionaryEntity <int> >().FirstOrDefaultAsync(r => r.Id == id)); }
public async Task <List <DictionaryEntity <int> > > ExecuteAsync(DictionaryType dictionaryType, List <string> codes) { var repo = Uow.GetRepository(); var entityClrType = repo.GetEntityClrType(dictionaryType.ToString()); dynamic entity = Activator.CreateInstance(entityClrType); IQueryable dicData = repo.AsQueriable(entity); return(await dicData.Cast <DictionaryEntity <int> >().Where(r => codes.Contains(r.Code)).ToListAsync()); }
/// <summary> /// Return the TypeScript type (as a string) for specified type. /// </summary> /// <param name="type">IType to query</param> /// <param name="inModelsModule">Pass true if generating the code for the models module, thus model types don't need a "models." prefix</param> /// <returns>TypeScript type string for type</returns> public static string TSType(this IType type, bool inModelsModule) { CompositeType composite = type as CompositeType; SequenceType sequence = type as SequenceType; DictionaryType dictionary = type as DictionaryType; PrimaryType primary = type as PrimaryType; EnumType enumType = type as EnumType; string tsType; if (primary != null) { tsType = primary.PrimaryTSType(); } else if (enumType != null) { tsType = "string"; } else if (composite != null) { // ServiceClientCredentials starts with the "msRest." prefix, so strip msRest./msRestAzure. as we import those // types with no module prefix needed var compositeName = composite.Name; if (compositeName.StartsWith("msRest.", StringComparison.Ordinal) || compositeName.StartsWith("msRestAzure.", StringComparison.Ordinal)) { tsType = compositeName.Substring(compositeName.IndexOf('.') + 1); } else if (inModelsModule || compositeName.Contains('.')) { tsType = compositeName; } else { tsType = "models." + compositeName; } } else if (sequence != null) { tsType = sequence.ElementType.TSType(inModelsModule) + "[]"; } else if (dictionary != null) { // TODO: Confirm with Mark exactly what cases for additionalProperties AutoRest intends to handle (what about // additonalProperties combined with explicit properties?) and add support for those if needed to at least match // C# target level of functionality tsType = "{ [propertyName: string]: " + dictionary.ValueType.TSType(inModelsModule) + " }"; } else { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, "Type '{0}' not implemented", type)); } return(tsType); }
public StringDictionaryArray(int length, int uniqueValues, ArrowBuffer nullBitmapBuffer, ArrowBuffer indices, ArrowBuffer dataBuffer, ArrowBuffer dataOffsets, int nullCount = 0, int offset = 0) : this(new ArrayData(DictionaryType.Default(ArrowTypeId.String), length, nullCount, offset, new[] { nullBitmapBuffer, indices, dataBuffer, dataOffsets }), uniqueValues) { }
private void CreateDictionaryType() { DictionaryType dictionaryType = new DictionaryType(); DictionaryTypeEditWindow target = new DictionaryTypeEditWindow(dictionaryType) { Owner = this.SourceWindow }; SwitchWindows(target, true); this.DictionaryTypeList = ReloadDictionaryTypeList(); }
public async Task <List <dynamic> > ExecuteAsync(DictionaryType dictionaryType) { var repo = Uow.GetRepository(); var entityClrType = repo.GetEntityClrType(dictionaryType.ToString()); dynamic entity = Activator.CreateInstance(entityClrType); IQueryable dictionary = repo.AsQueriable(entity); return(await dictionary.Cast <dynamic>().ToListAsync()); }
public DictionaryArray(DictionaryType dataType, IArrowArray indicesArray, IArrowArray dictionary) : base(new ArrayData(dataType, indicesArray.Length, indicesArray.Data.NullCount, indicesArray.Data.Offset, indicesArray.Data.Buffers, indicesArray.Data.Children, dictionary.Data)) { Data.EnsureBufferCount(2); indicesArray.Data.EnsureDataType(dataType.IndexType.TypeId); dictionary.Data.EnsureDataType(dataType.ValueType.TypeId); Indices = indicesArray; Dictionary = dictionary; }
/// <summary> /// Получение элементов словаря /// </summary> /// <param name="type">тип словаря</param> /// <returns>элементы словаря</returns> public IEnumerable <string> GetDictionaryElements(DictionaryType type) { IEnumerable <string> elements; if (!_dictionaryCollection.TryGetValue(type, out elements)) { elements = new string[] { } } ; return(elements); } }
public void Remove(DictionaryType type, int id) { using (var db = new UserDataContext()) { var history = db.Histories.FirstOrDefault(t => t.Type == type && t.Id == id); if (history != null) { db.Histories.Remove(history); db.SaveChanges(); } } }
public ActionResult QueryDictionary(DictionaryType dictionary, int page = 1, int rows = 20) { var pageInfo = new PageInfo() { Page = page, Rows = rows }; int totalCount = 0; var result = svc.FilterDictionary(dictionary, out totalCount, pageInfo); GridJsonModel djson = new GridJsonModel(totalCount, result); return(Json(djson)); }
public async Task <List <DictionaryEntity <int> > > ExecuteAsync(DictionaryType dictionaryType) { var repo = Uow.GetRepository(); var entityClrType = repo.GetEntityClrType(dictionaryType.ToString()); dynamic entity = Activator.CreateInstance(entityClrType); IQueryable dictionaries = repo.AsQueriable(entity); var query = await dictionaries.Cast <DictionaryEntity <int> >().AsQueryable().ToListAsync(); return(query.Where(r => r.GetType().GetProperty("ParentId")?.GetValue(r, null) == null).ToList()); }
private DictionaryMappingConfigurator <TValue> CreateDictionaryConfigurator <TValue>( DictionaryType dictionaryType, Type sourceType = null, Type sourceValueType = null) { var configInfo = _configInfo .ForSourceType(sourceType ?? AllTypes) .ForSourceValueType(sourceValueType ?? typeof(TValue)) .Set(dictionaryType); return(new DictionaryMappingConfigurator <TValue>(configInfo)); }
protected void Page_Load(object sender, EventArgs e) { string input_term; if (PageAssemblyContext.Current.DisplayVersion == DisplayVersions.Web) { urlArgs = Request.Url.Query.Substring(1); input_term = Strings.Clean(Request.Params["term"]); CdrID = Strings.IfNull(Strings.Clean(Request.Params["id"]), Strings.Clean(Request.Params["cdrid"])); AudienceType audience = GetAudienceType(Strings.Clean(Request.Params["version"])); DictionaryType dictionary = GetDictionaryType(Strings.Clean(Request.Params["dictionary"])); //load the definition DictionaryAppManager _dictionaryAppManager = new DictionaryAppManager(); DictionaryTerm dataItem = null; if (!string.IsNullOrEmpty(CdrID)) { CdrID = Regex.Replace(CdrID, "^CDR0+", "", RegexOptions.Compiled); // call appropriate method if dictionary type is known // the language is set to English = en by default if (dictionary == DictionaryType.Unknown) { dataItem = _dictionaryAppManager.GetTermForAudience(Convert.ToInt32(CdrID), dictionaryLanguage, "v1", audience); } else { dataItem = _dictionaryAppManager.GetTerm(Convert.ToInt32(CdrID), dictionary, dictionaryLanguage, "v1", audience); } } if (dataItem != null && dataItem.Term != null) { ActivateDefinitionView(dataItem); } else { phDefinition.Visible = false; phNoResult.Visible = true; } // Web Analytics ************************************************* WebAnalyticsPageLoad webAnalyticsPageLoad = new WebAnalyticsPageLoad(); webAnalyticsPageLoad.SetChannel("Dictionary of Cancer Terms"); webAnalyticsPageLoad.SetLanguage("en"); webAnalyticsPageLoad.AddEvent(WebAnalyticsOptions.Events.event11); // Dictionary Term view (event11) litOmniturePageLoad.Text = webAnalyticsPageLoad.Tag(); // Load page load script // End Web Analytics ********************************************* } }
public Command CommandRemove(string command, DictionaryType type = DictionaryType.Unknown) { Command remove = FindCommand(command, type); if (remove == null) { return(null); } remove.Remove(); return(remove); }
public Command CommandAcquire(string command, DictionaryType type = DictionaryType.Unknown) { Command acquire = FindCommand(command, type); if (acquire == null) { return(null); } acquire.Acquire(); return(acquire); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public DictionaryType GetById(int Id) { DictionaryType obj = NSession.Get <DictionaryType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public Command CommandExecute(string command, DictionaryType type = DictionaryType.Unknown) { Command execute = FindCommand(command, type); if (execute == null) { return(null); } execute.Execute(); return(execute); }
public ActionResult Save(DictionaryType obj) { try { NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public void Visit(DictionaryType type) { Int32Array.Builder indicesBuilder = new Int32Array.Builder().Reserve(Length); StringArray.Builder valueBuilder = new StringArray.Builder().Reserve(Length); for (int i = 0; i < Length; i++) { indicesBuilder.Append(i); valueBuilder.Append($"{i}"); } Array = new DictionaryArray(type, indicesBuilder.Build(), valueBuilder.Build()); }
private IType NormalizeDictionaryType(DictionaryType dictionaryType) { dictionaryType.ValueType = NormalizeTypeReference(dictionaryType.ValueType); if (dictionaryType.ValueType.IsValueType()) { dictionaryType.NameFormat = "System.Collections.Generic.IDictionary<string, {0}?>"; } else { dictionaryType.NameFormat = "System.Collections.Generic.IDictionary<string, {0}>"; } return(dictionaryType); }
public void UpdateDictionaryType(DictionaryType dictionaryType) { Check.Argument.IsNotNull(dictionaryType, "字典类型"); Check.Argument.IsNullOrWhiteSpace(dictionaryType.DicTypeId, "字典类型ID"); if (_dictionaryTypeRepository.Exists(p => p.DicTypeId == dictionaryType.DicTypeId)) { throw new ArgumentException("该字典类型表:不存在ID为:{0}".FormatWith(dictionaryType.DicTypeId)); } dictionaryType.LastUpdatedBy = _workContext.User.UserUame; dictionaryType.LastUpdatedOn = DateTime.Now; _dictionaryTypeRepository.Modify(dictionaryType); _dictionaryTypeRepository.UnitOfWork.Commit(); }
/// <summary> /// Generate code to perform required validation on a type /// </summary> /// <param name="type">The type to validate</param> /// <param name="scope">A scope provider for generating variable names as necessary</param> /// <param name="valueReference">A reference to the value being validated</param> /// <returns>The code to validate the reference of the given type</returns> public static string ValidateType(this IType type, IScopeProvider scope, string valueReference) { if (scope == null) { throw new ArgumentNullException("scope"); } CompositeType model = type as CompositeType; SequenceType sequence = type as SequenceType; DictionaryType dictionary = type as DictionaryType; if (model != null && model.ShouldValidateChain()) { return(CheckNull(valueReference, string.Format(CultureInfo.InvariantCulture, "{0}.Validate();", valueReference))); } if (sequence != null && sequence.ShouldValidateChain()) { var elementVar = scope.GetVariableName("element"); var innerValidation = sequence.ElementType.ValidateType(scope, elementVar); if (!string.IsNullOrEmpty(innerValidation)) { var sb = new IndentedStringBuilder(); sb.AppendLine("foreach (var {0} in {1})", elementVar, valueReference) .AppendLine("{").Indent() .AppendLine(innerValidation).Outdent() .AppendLine("}"); return(CheckNull(valueReference, sb.ToString())); } } else if (dictionary != null && dictionary.ShouldValidateChain()) { var valueVar = scope.GetVariableName("valueElement"); var innerValidation = dictionary.ValueType.ValidateType(scope, valueVar); if (!string.IsNullOrEmpty(innerValidation)) { var sb = new IndentedStringBuilder(); sb.AppendLine("if ({0} != null)", valueReference) .AppendLine("{").Indent() .AppendLine("foreach (var {0} in {1}.Values)", valueVar, valueReference) .AppendLine("{").Indent() .AppendLine(innerValidation).Outdent() .AppendLine("}").Outdent() .AppendLine("}"); return(CheckNull(valueReference, sb.ToString())); } } return(null); }
public JsonResult DeleteConfirmed(int id) { try { DictionaryType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
/// <summary> /// Returns serialization settings reference. /// </summary> /// <param name="serializationType"></param> /// <returns></returns> public string GetSerializationSettingsReference(IType serializationType) { SequenceType sequenceType = serializationType as SequenceType; DictionaryType dictionaryType = serializationType as DictionaryType; if (serializationType == PrimaryType.Date || (sequenceType != null && sequenceType.ElementType == PrimaryType.Date) || (dictionaryType != null && dictionaryType.ValueType == PrimaryType.Date)) { return("new DateJsonConverter()"); } return(ClientReference + ".SerializationSettings"); }
/// <summary> /// Retrieves a single dictionary Term based on its specific Term ID. /// </summary> /// <param name="termId">The ID of the Term to be retrieved</param> /// <param name="dictionary">The dictionary to retreive the Term from. /// Valid values are /// Term - Dictionary of Cancer Terms /// drug - Drug Dictionary /// genetic - Dictionary of Genetics Terms /// </param> /// <param name="language">The Term's desired language. /// Supported values are: /// en - English /// es - Spanish /// </param> /// <returns></returns> public TermReturn GetTerm(int termId, DictionaryType dictionary, Language language) { log.DebugFormat("Enter GetTerm( {0}, {1}, {2}).", termId, dictionary, language); AudienceType audience = AudienceType.Patient; // determine what audience to use based on the dictionary DictionaryManager dictionaryManager = new DictionaryManager(); audience = dictionaryManager.GetDefaultAudienceFromDictionaryType(dictionary); // route to GetTerm with all arguments return(GetTerm(termId, dictionary, language, audience)); }
public async Task <IActionResult> GetSelectOptions(DictionaryType dictionaryType) { if (!cache.TryGetValue(dictionaryType, out List <dynamic> dictionaries)) { dictionaries = await _executor.GetQuery <GetDictionaryByEntityNameQuery>().Process(r => r.ExecuteAsync(dictionaryType)); if (dictionaries != null) { cache.Set(dictionaryType, dictionaries, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); } } return(Ok((dictionaries ?? throw new InvalidOperationException()).Where(d => d.IsDeleted != true))); }
/// <summary> /// Constructs blueprint of the given <paramref name="type"/>. /// </summary> /// <param name="type">Type for which mapper being generated.</param> /// <param name="serializedName">Serialized name to be used.</param> /// <param name="parameter">Parameter of the composite type to construct the parameter constraints.</param> /// <param name="expandComposite">Expand composite type if <c>true</c> otherwise specify class_name in the mapper.</param> /// <returns>Mapper for the <paramref name="type"/> as string.</returns> /// <exception cref="ArgumentNullException">Thrown when a required parameter is null.</exception> /// <example> /// One of the example of the mapper is /// { /// required: false, /// serialized_name: 'Fish', /// type: { /// name: 'Composite', /// polymorphic_discriminator: 'fishtype', /// uber_parent: 'Fish', /// class_name: 'Fish', /// model_properties: { /// species: { /// required: false, /// serialized_name: 'species', /// type: { /// name: 'String' /// } /// }, /// length: { /// required: true, /// serialized_name: 'length', /// type: { /// name: 'Double' /// } /// }, /// siblings: { /// required: false, /// serialized_name: 'siblings', /// type: { /// name: 'Sequence', /// element: { /// required: false, /// serialized_name: 'FishElementType', /// type: { /// name: 'Composite', /// polymorphic_discriminator: 'fishtype', /// uber_parent: 'Fish', /// class_name: 'Fish' /// } /// } /// } /// } /// } /// } /// } /// </example> public static string ConstructMapper(this IType type, string serializedName, IParameter parameter, bool expandComposite) { if (type == null) { throw new ArgumentNullException(nameof(type)); } var builder = new IndentedStringBuilder(" "); CompositeType composite = type as CompositeType; SequenceType sequence = type as SequenceType; DictionaryType dictionary = type as DictionaryType; PrimaryType primary = type as PrimaryType; EnumType enumType = type as EnumType; if (enumType != null && enumType.ModelAsString) { primary = new PrimaryType(KnownPrimaryType.String); } builder.AppendLine("").Indent(); builder.AppendLine(type.AddMetaData(serializedName, parameter)); if (primary != null) { builder.AppendLine(primary.ContructMapperForPrimaryType()); } else if (enumType != null && enumType.Name != null) { builder.AppendLine(enumType.ContructMapperForEnumType()); } else if (sequence != null) { builder.AppendLine(sequence.ContructMapperForSequenceType()); } else if (dictionary != null) { builder.AppendLine(dictionary.ContructMapperForDictionaryType()); } else if (composite != null) { builder.AppendLine(composite.ContructMapperForCompositeType(expandComposite)); } else { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, "{0} is not a supported Type.", type)); } return(builder.ToString()); }
private static JsonSchema ParseDictionaryType(Property property, DictionaryType dictionaryType, IDictionary <string, JsonSchema> definitions, IEnumerable <CompositeType> modelTypes) { JsonSchema result = new JsonSchema() { JsonType = "object", AdditionalProperties = ParseType(null, dictionaryType.ValueType, definitions, modelTypes) }; if (property != null) { result.Description = RemovePossibleValuesFromDescription(property.Documentation); } return(result); }
private DataView GetDataViewForDictionary(View view, string pk, DictionaryType dictionaryType) { switch (dictionaryType) { case DictionaryType.PlaceHolders: return(GetPlaceHolderDictionary()); case DictionaryType.InternalNames: return(GetInternalNameDictionary(view, null)); default: return(GetDisplayNameDictionary(view, pk)); } }
//init with an expected size (the larger the size lesser the collission, but memory matters!) public AsDictionary(DictionaryType type = DictionaryType.SeparateChaining, int initialBucketSize = 2) { if (initialBucketSize < 2) { throw new Exception("Bucket Size must be greater than 2."); } if (type == DictionaryType.SeparateChaining) { Dictionary = new SeparateChainingDictionary <K, V>(initialBucketSize); } else { Dictionary = new OpenAddressDictionary <K, V>(initialBucketSize); } }
protected override void Render(HtmlTextWriter writer) { if (String.IsNullOrEmpty(listFormat)) { return; } if (this.Page.Request["type"] != null) { dicType = Dictionary.ConvertTypeFromString(this.Page.Request["type"].Trim().ToUpper()); } foreach (DictionaryItem dicItem in Dictionary.List(dicType)) { writer.WriteLine(String.Format(listFormat, dicItem.Type.ToString(), dicItem.Key, dicItem.Value)); } }
/// <summary> /// ���캯�� /// </summary> /// <param name="type">�ֵ�����</param> public DictionaryItem(DictionaryType dicType) { type = dicType; key = ""; value = ""; children = new ArrayList(); }
/// <summary> /// ���ۺ��� /// </summary> /// <param name="type">�ֵ�����</param> /// <param name="key">�ֵ����</param> /// <param name="value">�ֵ�ֵ</param> /// <param name="dep">���</param> public DictionaryItem(DictionaryType dicType, string itemKey, string itemValue,int dep) { type = dicType; key = itemKey; value = itemValue; depth = dep; children = new ArrayList(); }
/// <summary> /// �����ݿ�ɾ��һ���ֵ��� /// </summary> /// <param name="type">�ֵ�����</param> /// <param name="key">����</param> /// <returns></returns> public static bool RemoveItem(DictionaryType type, string key) { /* DictDelete @type char(1), @key varchar(50) */ try { Database.ExecuteNonQuery(CommandType.StoredProcedure, "DictDelete", new SqlParameter[]{ Database.MakeInParam("@type",SqlDbType.Char,1,type.ToString()), Database.MakeInParam("@key",SqlDbType.VarChar,50,key) } ); } catch { return false; } return true; }
/// <summary> /// �����ݿ��ȡ�ֵ��б� /// </summary> /// <param name="type">�ֵ�����</param> /// <returns>ArrayList</returns> public static ArrayList List(DictionaryType type) { /* DictList @type char(1) */ ArrayList list = new ArrayList(); SqlDataReader reader = null; try { DictionaryItem dicItem; reader = Database.ExecuteReader(CommandType.StoredProcedure, "DictList", new SqlParameter[] { Database.MakeInParam("@type", SqlDbType.Char, 1, type.ToString()) }); while (reader.Read()) { /*Type, [Key], [Value]*/ dicItem = new DictionaryItem(type); dicItem.Key = reader.GetString(1); dicItem.Value = reader.GetString(2); list.Add(dicItem); } reader.Close(); } catch { // } finally { if (reader != null) { reader.Close(); } } return list; }
/// <summary> /// �����ݿ��ȡһ���ֵ��� /// </summary> /// <param name="type">�ֵ�����</param> /// <param name="key">����</param> /// <returns></returns> public static DictionaryItem GetItem(DictionaryType type, string key) { /* DictGet @type char(1), @key varchar(50) */ DictionaryItem dic = null; SqlDataReader reader = null; try { /*Type, [Key], [Value]*/ reader = Database.ExecuteReader(CommandType.StoredProcedure, "DictGet", new SqlParameter[] { Database.MakeInParam("@type",SqlDbType.Char,1,type.ToString()), Database.MakeInParam("@key",SqlDbType.VarChar,50,key) }); if (reader.Read()) { dic = new DictionaryItem(type); dic.Key = reader.GetString(1); dic.Value = reader.GetString(2); } reader.Close(); } catch { // } finally { if (reader != null) { reader.Close(); } } return dic; }
private string GetDictionaryList(DictionaryType t, string items) { string ret = ""; switch (t) { case DictionaryType.A: case DictionaryType.I: ret = Dictionary.GetDictionaryNames(t, items.Split(','), ","); break; case DictionaryType.N: ret = Dictionary.GetDictionaryName(t, items); break; } return Util.CutString(ret, 0, 60)+"..."; }
public static string GetDictionaryNames(DictionaryType type, string codes, char spliter, string separator) { return GetDictionaryNames(type, codes.Split(spliter), separator); }
public static string GetDictionaryName(DictionaryType type,string code) { if (String.IsNullOrEmpty(code)) { return ""; } if (type == DictionaryType.A && code == "000000") { return "ȫ��"; } if (type == DictionaryType.I && code == "000000") { return "������ҵ"; } string name = ""; XmlNode node = null; switch (type) { case DictionaryType.A: node = DictionaryRootNode.SelectSingleNode("Dictionary[@type='A']//Item[@key='" + code + "']"); break; case DictionaryType.C: node = DictionaryRootNode.SelectSingleNode("Dictionary[@type='C']//Item[@key='" + code + "']"); break; case DictionaryType.I: node = DictionaryRootNode.SelectSingleNode("Dictionary[@type='I']//Item[@key='" + code + "']"); break; case DictionaryType.L: node = DictionaryRootNode.SelectSingleNode("Dictionary[@type='L']//Item[@key='" + code + "']"); break; case DictionaryType.N: node = DictionaryRootNode.SelectSingleNode("Dictionary[@type='N']//Item[@key='" + code + "']"); break; } if (node != null) { name = node.Attributes["value"].Value; } return name; }
public static void DepotDictionaryRemove(this DepotEntities db, Guid depotId, DictionaryType type, string name) { var dictionary = db.DepotDictionaryLoad(depotId, type).SingleOrDefault(o => o.Name == name); if (dictionary != null) { db.DepotDictionary.Remove(dictionary); db.SaveChanges(); } }
public static IQueryable<DepotDictionary> DepotDictionaryLoad(this DepotEntities db, Guid depotId, DictionaryType type) { return db.DepotDictionary.Where(o => o.DepotId == depotId && o.Type == type).OrderBy(o => o.Name); }
/// <summary> /// �ݹ�XML�ڵ㵽ָ������ /// </summary> /// <param name="list">ָ������</param> /// <param name="pNode">���ڵ�</param> /// <param name="depth">�ڵ����</param> private static void LoopNodes(ArrayList list,DictionaryType type, XmlNode pNode, int depth) { DictionaryItem item; foreach (XmlNode node in pNode.SelectNodes("Item")) { item = new DictionaryItem(type,node.Attributes["key"].Value, node.Attributes["value"].Value, depth); list.Add(item); if (node.HasChildNodes) { depth++; LoopNodes(item.Children,type,node, depth); depth--; } } }
public DictionaryList() : base() { dicType = DictionaryType.A; listFormat = ""; }
public static string GetDictionaryNames(DictionaryType type, string[] codes,string separator) { string[] names = new string[codes.Length]; for (int i=0;i<codes.Length;i++) { names[i] = GetDictionaryName(type, codes[i]); } return String.Join(separator, names); }
private bool FindDictcnResult( QueryResult queryResult, DictionaryType targetType, out DictResult dictResult ) { bool hasFound = false; dictResult = null; if ( queryResult != null ) { if ( queryResult.DictResultItems != null ) { foreach ( DictResult resultItem in queryResult.DictResultItems ) { if ( resultItem != null && resultItem.DictionaryType == targetType ) { dictResult = resultItem; hasFound = true; break; } } } } return hasFound; }
public static DictionaryItem AddItem(DictionaryType type, string key, string value) { DictionaryItem item = new DictionaryItem(type, key, value); if (item.Save()) { return item; } return null; }
public static void DepotDictionaryAdd(this DepotEntities db, Guid depotId, DictionaryType type, string name) { if (name.None()) return; var count = db.DepotDictionaryLoad(depotId, type).Count(o => o.Name == name); if (count == 0) { var dictionary = new DepotDictionary { DepotId = depotId, Type = type, Name = name, PinYin = db.ToPinYin(name).Single() }; db.DepotDictionary.Add(dictionary); db.SaveChanges(); } }
/// <summary> /// ���´ʵ��ļ� /// </summary> /// <param name="type"></param> /// <param name="parentKey"></param> /// <param name="item"></param> public static void UpdateDictionaryFile(DictionaryType type,string parentKey,DictionaryItem item) { }