public void a(bool A_0) { if (this.h != A_0) { this.h = A_0; if (A_0) { this.i = eSettingValueType.tEnum; this.j = false; this.k = -1; this.f = ff.f(PluginCore.cq.ax, "uTank2.ViewXML.AdvancedOptionsView.xml"); this.d = (IList)this.f["lOptionList"]; this.c = (IStaticText)this.f["txtInfo"]; this.b = (ITextBox)this.f["txtEditbox"]; this.e = (IList)this.f["lFilterList"]; this.g.Clear(); foreach (string str in Enum.GetNames(typeof(eSettingCategories))) { IListRow row = this.e.Add(); row[0][0] = false; row[1][0] = str; this.g.Add((eSettingCategories)Enum.Parse(typeof(eSettingCategories), str)); } this.b(); this.e.Click += new dClickedList(this.b); this.d.Click += new dClickedList(this.a); this.b.Change_Old += new EventHandler(this.a); this.f.Visible = true; } else { this.e.Click -= new dClickedList(this.b); this.d.Click -= new dClickedList(this.a); this.b.Change_Old -= new EventHandler(this.a); this.d = null; this.c = null; this.b = null; this.e = null; this.f.Dispose(); this.f = null; } } }
private void a(int A_0) { int k = this.k; this.a(); if (k != A_0) { this.j = false; this.k = A_0; this.d[this.k][0].Color = Color.BlueViolet; string str = er.c((string)this.d[this.k][0][0]); if (string.IsNullOrEmpty(str)) { this.c.Text = "[No Description]"; } else { this.c.Text = str; } string str2 = (string)this.d[this.k][0][0]; this.i = er.b(str2); switch (this.i) { case eSettingValueType.tDouble: this.j = true; this.b.Text = er.h(str2).ToString(); return; case eSettingValueType.tInt: this.j = true; this.b.Text = er.i(str2).ToString(); break; default: return; } } }
public void GetSetting(long CompanyID, ApplicationSettingsViewModel NewSettings) { if (NewSettings == null) { return; } using (dbVisionEntities db = new dbVisionEntities()) { PropertyInfo[] Props = typeof(ApplicationSettingsViewModel).GetProperties(); foreach (var SaveModel in db.tblSettingL0) { string SettingName = SaveModel.SettingName; PropertyInfo p = Props.FirstOrDefault(r => r.Name == SettingName); if (p == null) { continue; } eSettingValueType SettingValueType = (eSettingValueType)SaveModel.SettingValueType; object SettingValue = (SettingValueType == eSettingValueType.Varchar50 ? (object)SaveModel.SettingValueVC : (SettingValueType == eSettingValueType.Int ? (object)SaveModel.SettingValueInt : (SettingValueType == eSettingValueType.Long ? (object)SaveModel.SettingValueLong : (SettingValueType == eSettingValueType.DateTime ? (object)SaveModel.SettingValueDateTime : (SettingValueType == eSettingValueType.Boolean ? (object)SaveModel.SettingValueBoolean : (SettingValueType == eSettingValueType.Decimal ? (object)SaveModel.SettingValueDecimal : null)))))); SettingValue = (SettingValueType == eSettingValueType.Int && p.PropertyType == typeof(int) ? (object)((int?)SettingValue ?? 0) : (SettingValueType == eSettingValueType.Long && p.PropertyType == typeof(long) ? (object)((long?)SettingValue ?? 0) : (SettingValueType == eSettingValueType.DateTime && p.PropertyType == typeof(DateTime) ? (object)((DateTime?)SettingValue ?? DateTime.MinValue) : (SettingValueType == eSettingValueType.Boolean && p.PropertyType == typeof(bool) ? (object)((bool?)SettingValue ?? false) : (SettingValueType == eSettingValueType.Decimal && p.PropertyType == typeof(decimal) ? (object)((decimal?)SettingValue ?? 0) : SettingValue))))); p.SetValue(NewSettings, SettingValue); } //foreach (PropertyInfo p in Props) foreach (var SaveModelMaster in db.tblSettingMasterL1) { string SettingName = SaveModelMaster.SettingName; PropertyInfo p = Props.FirstOrDefault(r => r.Name == SettingName); if (p == null) { continue; } //tblSettingMasterL1 SaveModelMaster = db.tblSettingMasterL1.FirstOrDefault(r => r.SettingName == SettingName); //if (SaveModelMaster == null) //{ // continue; //} eSettingValueType SettingValueType = (eSettingValueType)SaveModelMaster.SettingValueType; object SettingMasterValue = (SettingValueType == eSettingValueType.Varchar50 ? (object)SaveModelMaster.SettingValueVC : (SettingValueType == eSettingValueType.Int ? (object)SaveModelMaster.SettingValueInt : (SettingValueType == eSettingValueType.Long ? (object)SaveModelMaster.SettingValueLong : (SettingValueType == eSettingValueType.DateTime ? (object)SaveModelMaster.SettingValueDateTime : (SettingValueType == eSettingValueType.Boolean ? (object)SaveModelMaster.SettingValueBoolean : (SettingValueType == eSettingValueType.Decimal ? (object)SaveModelMaster.SettingValueDecimal : null)))))); object SettingValue = null; if (CompanyID != 0) { tblSettingsL1 SaveModel = db.tblSettingsL1.FirstOrDefault(r => r.SettingName == SettingName && r.CompanyID == CompanyID); SettingValue = (SaveModel == null ? null : (SettingValueType == eSettingValueType.Varchar50 ? (object)SaveModel.SettingValueVC : (SettingValueType == eSettingValueType.Int ? (object)SaveModel.SettingValueInt : (SettingValueType == eSettingValueType.Long ? (object)SaveModel.SettingValueLong : (SettingValueType == eSettingValueType.DateTime ? (object)SaveModel.SettingValueDateTime : (SettingValueType == eSettingValueType.Boolean ? (object)SaveModel.SettingValueBoolean : (SettingValueType == eSettingValueType.Decimal ? (object)SaveModel.SettingValueDecimal : null))))))); } if (SettingValue == null) { SettingValue = SettingMasterValue; } /// If property type is not nullable type and setting value is null then assign default value. SettingValue = (SettingValueType == eSettingValueType.Int && (p.PropertyType == typeof(int) || p.PropertyType.IsEnum) ? (object)((int?)SettingValue ?? 0) : (SettingValueType == eSettingValueType.Long && p.PropertyType == typeof(long) ? (object)((long?)SettingValue ?? 0) : (SettingValueType == eSettingValueType.DateTime && p.PropertyType == typeof(DateTime) ? (object)((DateTime?)SettingValue ?? DateTime.MinValue) : (SettingValueType == eSettingValueType.Boolean && p.PropertyType == typeof(bool) ? (object)((bool?)SettingValue ?? false) : (SettingValueType == eSettingValueType.Decimal && p.PropertyType == typeof(decimal) ? (object)((decimal?)SettingValue ?? 0) : SettingValue))))); p.SetValue(NewSettings, SettingValue); } } }