public StudentOrganisationApp.App_Data.Advisor getAdvisorByID(int advID) { var adv = dataContext.sp_GetAdvisorByID(advID).First(); StudentOrganisationApp.App_Data.Advisor advisor = new App_Data.Advisor(); advisor.FirstName = adv.FirstName; advisor.LastName = adv.LastName; advisor.Email = adv.Email; advisor.PhoneNumber = adv.PhoneNumber; advisor.OffCampus = adv.OffCampus; advisor.AdvisorTitle = adv.AdvisorTitle; advisor.ProfessionalTitle = adv.ProfessionalTitle; return(advisor); }
protected void btnGo_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(ddlSelectAdvisor.SelectedItem.Value) != -1) { pnlSelection.Visible = false; pnlEditing.Visible = true; int advID = Convert.ToInt32(ddlSelectAdvisor.SelectedItem.Value); App_Data.Advisor advisorForEdit = AdvisorDAO.getAdvisorByID(advID); lblAdvisorName.Text = advisorForEdit.FirstName + " " + advisorForEdit.LastName; txtEmailID.Text = advisorForEdit.Email; txtPhoneNumber.Text = advisorForEdit.PhoneNumber.ToString(); txtFirstName.Text = advisorForEdit.FirstName; txtLastName.Text = advisorForEdit.LastName; txtAdvisorTitle.Text = advisorForEdit.AdvisorTitle; txtProfessionalTitle.Text = advisorForEdit.ProfessionalTitle; if (advisorForEdit.OffCampus == true) { rblAdvisorType.SelectedIndex = 1; } else if (advisorForEdit.OffCampus == false) { rblAdvisorType.SelectedIndex = 0; } grdOrganization.DataSource = AdvisorDAO.getOrganizationForAdvisor(advID); grdOrganization.DataBind(); } } catch (Exception) { lblMessage.Text = "Could Not Retrieve Advisor Details!!"; } }