void IIdFlattenedDto.SetFieldValue(string fieldName, object fieldValue) { ReflectUtils.SetPropertyValue(fieldName, this._value, fieldValue); }
object IIdFlattenedDto.GetFieldValue(string fieldName) { return(ReflectUtils.GetPropertyValue(fieldName, this._value)); }
public static IEnumerable <IOrderState> GetByProperty <TPropertyType>(this IOrderApplicationService applicationService, System.Linq.Expressions.Expression <Func <IOrderState, TPropertyType> > propertySelector, TPropertyType propertyValue, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue) { return(applicationService.GetByProperty(ReflectUtils.GetPropertyName <IOrderState, TPropertyType>(propertySelector), propertyValue, orders, firstResult, maxResults)); }
public void OnEncyclopediaPageChanged(EncyclopediaPageChangedEvent e) { EncyclopediaData.EncyclopediaPages newPage = e.NewPage; if ((int)newPage != 12) { selectedHeroPage = null; selectedHero = null; if (gauntletLayerTopScreen != null && gauntletLayer != null) { gauntletLayerTopScreen.RemoveLayer(gauntletLayer); if (gauntletMovie != null) { gauntletLayer.ReleaseMovie(gauntletMovie); } gauntletLayerTopScreen = null; gauntletMovie = null; } return; } GauntletEncyclopediaScreenManager gauntletEncyclopediaScreenManager = MapScreen.Instance.EncyclopediaScreenManager as GauntletEncyclopediaScreenManager; if (gauntletEncyclopediaScreenManager == null) { return; } EncyclopediaData encyclopediaData = ReflectUtils.ReflectField <EncyclopediaData>("_encyclopediaData", gauntletEncyclopediaScreenManager); EncyclopediaPageVM encyclopediaPageVM = ReflectUtils.ReflectField <EncyclopediaPageVM>("_activeDatasource", encyclopediaData); selectedHeroPage = (encyclopediaPageVM as EncyclopediaHeroPageVM); if (selectedHeroPage == null) { return; } selectedHero = (selectedHeroPage.Obj as Hero); if (selectedHero == null) { return; } if (gauntletLayer == null) { gauntletLayer = new GauntletLayer(211, "GauntletLayer"); } try { if (viewModel == null) { viewModel = new HeroBuilderVM(delegate(Hero editHero) { InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=CharacterCreation_EditAppearanceForHeroMessage}Entering edit appearance for: ").ToString() + editHero)); }); } viewModel.SetHero(selectedHero); gauntletMovie = gauntletLayer.LoadMovie("HeroEditor", viewModel); gauntletLayerTopScreen = ScreenManager.TopScreen; gauntletLayerTopScreen.AddLayer(gauntletLayer); gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.MouseButtons); // Refresh selectedHeroPage.Refresh(); } catch (Exception ex) { // MessageBox.Show($"Error :\n{ex.Message} \n\n{ex.InnerException?.Message}"); } }
public static IEnumerable <IInventoryPostingRuleState> GetByProperty(this IInventoryPostingRuleApplicationService applicationService, System.Linq.Expressions.Expression <Func <IInventoryPostingRuleState, object> > propertySelector, object propertyValue, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue) { return(applicationService.GetByProperty(ReflectUtils.GetPropertyName <IInventoryPostingRuleState>(propertySelector), propertyValue, orders, firstResult, maxResults)); }
private static IList <T> TextToObject <T>(string text, Dictionary <string, string> filedDic, Regex reg) { IList <T> lsit = new List <T>(); FileStream fs = File.OpenRead(text); StreamReader sw = new StreamReader(fs); string line = sw.ReadLine(); string[] titile = TitleToArray(line, reg); Type type = typeof(T); Dictionary <string, Clazz> clazzDic = ReflectUtils.MethodToFunction(type.AssemblyQualifiedName); string fullName = type.FullName; Clazz[] clazzs = TitleToClazz(titile, filedDic, clazzDic); if (clazzs == null) { return(lsit); } //开始内容 line = sw.ReadLine(); object obj; string value; object[] parmeters = new object[1]; Clazz clazz; StringBuilder sb; Clazz jsonClazz; if (clazzDic.TryGetValue("JSON", out jsonClazz)) { //JObject json = (JObject)JsonConvert.DeserializeObject(); } while (line != null) { if (Utils.IsStrNull(line)) { line = sw.ReadLine(); continue; } sb = new StringBuilder("{"); string[] array = reg.Split(line); if (array.Length != clazzs.Length) { //MessageBox.Show("文件是:" + text+",内容与标题不对应,内容是“"+ line+"”"); line = line + sw.ReadLine(); continue; } obj = type.Assembly.CreateInstance(fullName); for (int a = 0; a < clazzs.Length; a++) { clazz = clazzs[a]; value = array[a]; if (clazz == null) { if (jsonClazz != null) { if (value.Contains("\"")) { value = value.Replace("\"", "\\\""); } else if (value.Contains("\\")) { value = value.Replace("\\", "\\\\"); } sb.Append("\"" + titile[a] + "\":" + "\"" + value + "\"" + ","); } } else if (value != null && !value.Trim().Equals("")) { parmeters[0] = value; clazz.SetMethodInfo.Invoke(obj, parmeters); } } sb.Remove(sb.Length - 1, 1); sb.Append("}"); if (jsonClazz != null) { parmeters[0] = sb.ToString(); //string aa = sb.ToString(); //JObject jo = JObject.Parse(aa); jsonClazz.SetMethodInfo.Invoke(obj, parmeters); } lsit.Add((T)obj); line = sw.ReadLine(); } return(lsit); }
public static IEnumerable <IAttributeSetInstanceExtensionFieldGroupState> GetByProperty(this IAttributeSetInstanceExtensionFieldGroupApplicationService applicationService, System.Linq.Expressions.Expression <Func <IAttributeSetInstanceExtensionFieldGroupState, object> > propertySelector, object propertyValue, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue) { return(applicationService.GetByProperty(ReflectUtils.GetPropertyName <IAttributeSetInstanceExtensionFieldGroupState>(propertySelector), propertyValue, orders, firstResult, maxResults)); }