public virtual JObject GetCurrentNotificationSetting(HttpContext context) { string account = YZAuthHelper.LoginUserAccount; NotifyProviderInfoCollection providers; UserCommonInfo userCommonInfo; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); providers = NotifyManager.GetProviders(cn); userCommonInfo = UserCommonInfo.FromAccount(cn, account); } JObject rv = new JObject(); JArray jProviders = new JArray(); rv["providers"] = jProviders; foreach (NotifyProviderInfo provider in providers) { JObject jProvider = new JObject(); jProviders.Add(jProvider); jProvider["ProviderName"] = provider.Name; jProvider["Enabled"] = !userCommonInfo.RejectedNotifys.Contains(provider.Name); } rv[YZJsonProperty.success] = true; return(rv); }
public virtual NotifyProviderInfoCollection GetNotifyProviders(HttpContext context) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(NotifyManager.GetProviders(cn)); } }
protected override void OnPreRender(EventArgs e) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount); this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); NotifyProviderInfoCollection provInfos = NotifyManager.GetProviders(cn); UserCommonInfo cInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount); this._chksProvider.Items.Clear(); foreach (NotifyProviderInfo provInfo in provInfos) { ListItem lstItem = new ListItem(provInfo.Name, provInfo.Name); lstItem.Selected = !cInfo.RejectedNotifys.Contains(provInfo.Name); this._chksProvider.Items.Add(lstItem); } } base.OnPreRender(e); }