protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnGInfo.CssClass = "Clicked"; MainView.ActiveViewIndex = 0; } db = new SLHSClinicEntities(); int clientID = 0; int newClient = 0; if (Request.QueryString["NewClient"] != null) { newClientAndAddress(); SaveBtn.Visible = true; } //if (Convert.ToBoolean(newClient = int.Parse(Request.QueryString["NewClient"]))) //{ // newClientAndAddress(); //} else if (Convert.ToBoolean(clientID = int.Parse(Request.QueryString["ClientID"]))) { ViewClient(clientID); } }
protected void fillClientDropDownList() { SLHSClinicEntities db = new SLHSClinicEntities(); List <CustomListItem> clientNameList; clientNameList = db.Clients.Select(x => new CustomListItem { ID = x.ClientID, Text = x.FirstName + " " + x.MiddleName + " " + x.LastName }).ToList(); ClientDropDownList.DataSource = clientNameList; ClientDropDownList.DataTextField = "Text"; ClientDropDownList.DataValueField = "ID"; ClientDropDownList.DataBind(); }
protected void fillStudentDropDownList() { SLHSClinicEntities db = new SLHSClinicEntities(); List <CustomListItem> fullNameList; fullNameList = db.Students.Select(x => new CustomListItem { ID = x.UserID, Text = x.FirstName + " " + x.MiddleName + " " + x.LastName }).ToList(); StudentDropDownList.DataSource = fullNameList; StudentDropDownList.DataTextField = "Text"; StudentDropDownList.DataValueField = "ID"; StudentDropDownList.DataBind(); }
protected void login_Click(object sender, EventArgs e) { SLHSClinicEntities db = new SLHSClinicEntities(); int query_AuthenticationID = (from c in db.Authentications where c.Username == username.Text && c.Password == password.Text select c.AuthenticationID).FirstOrDefault(); if (query_AuthenticationID != 0) { invalidMessage.Text = ""; int type = (from c in db.Authentications where c.Username == username.Text && c.Password == password.Text select c.Type).FirstOrDefault(); string query_studentName; int query_userID; if (type == 1) { query_studentName = (from x in db.Students where x.AuthenticationID == query_AuthenticationID select x.FirstName + " " + x.LastName).FirstOrDefault(); //for limited access query_userID = (from x in db.Students where x.AuthenticationID == query_AuthenticationID select x.UserID).FirstOrDefault(); } else if (type == 2) { query_studentName = (from x in db.Supervisors where x.AuthenticationID == query_AuthenticationID select x.FirstName + " " + x.LastName).FirstOrDefault(); //for limited access query_userID = (from x in db.Supervisors where x.AuthenticationID == query_AuthenticationID select x.UserID).FirstOrDefault(); } else { query_studentName = (from x in db.Teacher_Assistant where x.AuthenticationID == query_AuthenticationID select x.FirstName + " " + x.LastName).FirstOrDefault(); //for limited access query_userID = (from x in db.Teacher_Assistant where x.AuthenticationID == query_AuthenticationID select x.UserID).FirstOrDefault(); } //Other Pages Session["SessionUserID"] = query_userID; //User Name Session (User Name at the top nav bar) Session["username"] = query_studentName; Response.Redirect("Homepage.aspx?username="******"Invalid username or password"; } }