protected void btnSaveSetting_Click(object sender, EventArgs e) { List<SettingInfo> lstSettings = new List<SettingInfo>(); SettingInfo dupUsers = new SettingInfo(); dupUsers.SettingKey = SettingsEnum.DUPLICATE_USERS_ACROSS_PORTALS.ToString(); dupUsers.SettingValue = chkEnableDupNames.Checked ? "1" : "0"; SettingInfo dupRoles = new SettingInfo(); dupRoles.SettingKey = SettingsEnum.DUPLICATE_ROLES_ACROSS_PORTALS.ToString(); dupRoles.SettingValue = chkEnableDupRole.Checked ? "1" : "0"; SettingInfo passwordFormat = new SettingInfo(); passwordFormat.SettingKey = SettingsEnum.SELECTED_PASSWORD_FORMAT.ToString(); passwordFormat.SettingValue = GetPasswordFormat().ToString(); SettingInfo dupEmail = new SettingInfo(); dupEmail.SettingKey = SettingsEnum.DUPLICATE_EMAIL_ALLOWED.ToString(); dupEmail.SettingValue = chkEnableDupEmail.Checked ? "1" : "0"; SettingInfo enableCaptcha = new SettingInfo(); enableCaptcha.SettingKey = SettingsEnum.ENABLE_CAPTCHA.ToString(); enableCaptcha.SettingValue = chkEnableCaptcha.Checked ? "1" : "0"; lstSettings.Add(dupUsers); lstSettings.Add(dupRoles); lstSettings.Add(passwordFormat); lstSettings.Add(dupEmail); lstSettings.Add(enableCaptcha); try { MembershipDataProvider.SaveSettings(lstSettings); ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("UserManagement", "SettingSavedSuccessfully"), "", SageMessageType.Success); } catch (Exception) { throw; } }
public static List<SettingInfo> GetSettings() { string sp = "usp_GetMembershipSettings"; SQLHandler sagesql = new SQLHandler(); List<SettingInfo> lstSetting = new List<SettingInfo>(); try { SqlDataReader reader = sagesql.ExecuteAsDataReader(sp); while (reader.Read()) { SettingInfo obj = new SettingInfo(); obj.SettingKey = reader["SettingKey"].ToString(); obj.SettingValue = reader["SettingValue"].ToString(); lstSetting.Add(obj); } reader.Close(); return lstSetting; } catch (Exception ex) { throw (ex); } }