protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property) { if (property.Name == "AllNotify") { NotifySettingItemCollection items = new NotifySettingItemCollection(); NotifySettingItem newItem; foreach (NotifyType nt in NotifyBO.AllNotifyTypes) { newItem = new NotifySettingItem(); newItem.NotifyType = nt.TypeID; newItem.OpenState = _Request.Get <NotifyState>(string.Format("{0}_OpenState", nt.TypeID), Method.Post, NotifyState.DefaultOpen); items.Add(newItem); } ((NotifySettings)setting).AllNotify = items; return(true); } else if (property.Name == "NotifySaveDays") { property.SetValue(setting, _Request.Get <int>("saveDays", 0), null); return(true); } else if (property.Name == "NotifySaveRows") { property.SetValue(setting, _Request.Get <int>("SaveRows", 0), null); return(true); } else if (property.Name == "DataClearMode") { if (_Request.Get <bool>("IsCombin", false)) { property.SetValue(setting, JobDataClearMode.CombinMode, null); } } return(base.SetSettingItemValue(setting, property)); }
public UserNotifySetting(string values) { this.AllNotify = new NotifySettingItemCollection(); foreach (NotifyType nt in NotifyBO.AllNotifyTypes) { NotifySettingItem item = new NotifySettingItem(); item.NotifyType = nt.TypeID; item.OpenState = AllSettings.Current.NotifySettings.GetNotifySystemState(item.NotifyType); this.AllNotify.Add(item); } while (!string.IsNullOrEmpty(values) && values.Length % 4 == 0 && values.Length >= 4) { int value = 0; try { value = int.Parse(values.Substring(0, 4)); } catch { return; } int type = (int)(value / 10); NotifyState state = (NotifyState)(value % 10); foreach (NotifySettingItem item in this.AllNotify) { if (item.OpenState == NotifyState.AlwaysOpen || item.OpenState == NotifyState.AlwaysClose) { continue; } if (item.NotifyType == type) { item.OpenState = state; } } values = values.Substring(4); } }
public UserNotifySetting( string values) { this.AllNotify = new NotifySettingItemCollection(); foreach (NotifyType nt in NotifyBO.AllNotifyTypes) { NotifySettingItem item = new NotifySettingItem(); item.NotifyType = nt.TypeID; item.OpenState = AllSettings.Current.NotifySettings.GetNotifySystemState(item.NotifyType); this.AllNotify.Add(item); } while (!string.IsNullOrEmpty(values) && values.Length % 4==0 && values.Length>=4 ) { int value = 0; try { value = int.Parse(values.Substring(0, 4)); } catch { return; } int type = (int)(value / 10); NotifyState state = (NotifyState)(value % 10); foreach (NotifySettingItem item in this.AllNotify) { if (item.OpenState == NotifyState.AlwaysOpen || item.OpenState == NotifyState.AlwaysClose) continue; if (item.NotifyType == type) item.OpenState = state; } values = values.Substring(4); } }
protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property) { if (property.Name == "AllNotify") { NotifySettingItemCollection items = new NotifySettingItemCollection(); NotifySettingItem newItem; foreach ( NotifyType nt in NotifyBO.AllNotifyTypes) { newItem = new NotifySettingItem(); newItem.NotifyType = nt.TypeID; newItem.OpenState = _Request.Get<NotifyState>( string.Format("{0}_OpenState",nt.TypeID), Method.Post, NotifyState.DefaultOpen); items.Add( newItem ); } ((NotifySettings)setting).AllNotify = items; return true; } else if (property.Name == "NotifySaveDays") { property.SetValue(setting, _Request.Get<int>("saveDays", 0), null); return true; } else if (property.Name == "NotifySaveRows") { property.SetValue(setting, _Request.Get<int>("SaveRows", 0), null); return true; } else if (property.Name == "DataClearMode") { if (_Request.Get<bool>("IsCombin",false)) { property.SetValue(setting, JobDataClearMode.CombinMode, null); } } return base.SetSettingItemValue(setting, property); }