protected void Page_Load(object sender, EventArgs e) { //check permissions Classes.AdminPermissions ap = new Classes.AdminPermissions(); if (!ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Newsletter")) { Response.Redirect("~/Error/404"); } }
protected void Page_Load(object sender, EventArgs e) { //check permissions Classes.AdminPermissions ap = new Classes.AdminPermissions(); if (!ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Settings")) { Response.Redirect("~/Error/404"); } DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_adminSettings", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; try { sda.Fill(ds); dt = ds.Tables[0]; } catch (Exception ex) { } finally { sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); } if (dt.Rows.Count == 0)// Profile doesn't exist { Response.Redirect("~/Error/AdminSettingsNotFound"); } else { DropDownListLogin.SelectedValue = dt.Rows[0]["LoginAllow"].ToString(); DropDownListRegister.SelectedValue = dt.Rows[0]["RegisterAllow"].ToString(); DropDownListActivities.SelectedValue = dt.Rows[0]["ActivitiesAllow"].ToString(); DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //check permissions Classes.AdminPermissions ap = new Classes.AdminPermissions(); if (!ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Settings")) { Response.Redirect("~/Error/404"); } DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_adminSettings", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; try { sda.Fill(ds); dt = ds.Tables[0]; } catch (Exception ex) { } finally { sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); } if (dt.Rows.Count == 0)// Profile doesn't exist { Response.Redirect("~/Error/AdminSettingsNotFound"); } else { DropDownListLogin.SelectedValue = dt.Rows[0]["LoginAllow"].ToString(); DropDownListRegister.SelectedValue = dt.Rows[0]["RegisterAllow"].ToString(); DropDownListActivities.SelectedValue = dt.Rows[0]["ActivitiesAllow"].ToString(); DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString(); } }