/* * FUNCTION : Page_Load * * DESCRIPTION : Authenticate user identity. * */ protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { if (!IsPostBack) { FormsIdentity ident = User.Identity as FormsIdentity; FormsAuthenticationTicket ticket = ident.Ticket; string[] buffer = ticket.UserData.Split('|'); string GroupID = buffer[0]; if (Convert.ToInt32(GroupID) == 1) { Button14.Visible = true; displayAllInstAdmins(); InstitutionName2.DataTextField = "_institution_name"; InstitutionName2.DataSource = myDAL.getStoredProcData("GetInstitutes"); InstitutionName2.DataBind(); } else { Response.Redirect("~/LoginPage.aspx", true); } } } else { Response.Redirect("~/LoginPage.aspx", true); } }
/* * FUNCTION : addAdmin * * DESCRIPTION : Adds admin to database * * PARAMETERS: string instName - institute name they are associated with * string fName - user first name * string lName - user last name * string userName - email * string pass - password * string salty - salt * */ private int addAdmin(string instName, string fName, string lName, string userName, string Password, string Salty) { int retVal = myDAL.AddInstituteAdmin(instName, fName, lName, userName, Password, Salty); if (retVal > 0) { //inserted alerts.Visible = true; alerts.Text = userName + " succesfully inserted to " + instName; alerts.ForeColor = System.Drawing.Color.Green; displayAllInstAdmins(); InstitutionName2.DataTextField = "_institution_name"; InstitutionName2.DataSource = myDAL.getStoredProcData("GetInstitutes"); InstitutionName2.DataBind(); emptyalltextboxes(); } else { //did not insert admin //alerts.Visible = true; //alerts.Text = "error while trying to insert the user"; //alerts.ForeColor = System.Drawing.Color.Red; } return(retVal); }