protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IList <Hospital> hospital = HospitalDAO.RetrieveAll().Where(x => !string.IsNullOrWhiteSpace(x.Name) && !x.Name.Equals("SuperAdminHospital")).ToList(); DropDownHospital.DataSource = hospital; DropDownHospital.DataValueField = "Id"; DropDownHospital.DataTextField = "Name"; DropDownHospital.DataBind(); DropDownRole.DataSource = Enum.GetNames(typeof(UserRole)); DropDownRole.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string userName = TextBoxNameUserName.Value; string password = TextBoxNamePassword.Value; Hospital theHospital = !string.IsNullOrWhiteSpace(DropDownHospital.SelectedValue) ? new HospitalDAO().Retrieve(Convert.ToInt64(DropDownHospital.SelectedValue)) : null; IList <HospitalUser> user = theHospital != null ? new HospitalUserDAO().RetrieveByLoginDetails(theHospital, userName, password) : null; if (user != null) { TheHospital = user.FirstOrDefault().TheHospital; } else { TheHospital = null; } if (!IsPostBack) { IList <Hospital> hospital = HospitalDAO.RetrieveAll(); DropDownHospital.DataSource = hospital; DropDownHospital.DataValueField = "Id"; DropDownHospital.DataTextField = "Name"; DropDownHospital.DataBind(); } }