public void LoadUserData() { // user data UserDAO userDAO = new UserDAO(); user = User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); if (user.HouseId != null) { Labelmessage.Text = "";//Current landload Details"; DataSet LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value); if(LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { PassID(Guid.Parse(LandlordData.Tables[0].Rows[0]["UserId"].ToString().Trim())); ButtonVerify.Visible = false; Email.Enabled = false; FirstName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim(); MiddleName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim(); LastName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim(); Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim(); // Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim(); MobileArea.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(0, 3); Mobile1.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(3, 3); Mobile2.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(6, 4); } } }
public void LoadLandlordData(User user_) { UserDAO userDAO = new UserDAO(); if (user_.HouseId != null) { DataSet LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value); if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim(); string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim(); string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim(); Name.Text = FirstName + " " + MiddleName + " " + LastName; Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim(); Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim(); } } else if (user_.BaseHouseRoomId != null) { DataSet LandlordData = userDAO.SelectLandlordByBaseHouseRoomId(user.BaseHouseRoomId.Value); if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim(); string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim(); string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim(); Name.Text = FirstName + " " + MiddleName + " " + LastName; Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim(); Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim(); } } }
public void LoadLandlordData(User user_) { UserDAO userDAO = new UserDAO(); if (user_.HouseId != null) { DataSet LandlordData = userDAO.SelectLandlordByHouseId(user_.HouseId.Value); if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { string IspartialUser = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim(); string AspnetUserId = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim(); if (IspartialUser.ToLower() == "true" && (AspnetUserId == "" || AspnetUserId == string.Empty)) { hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim(); string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim(); string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim(); string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim(); lbName.Text = FirstName + " " + MiddleName + " " + LastName; lbEmail.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim(); lbMobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim(); LandloadEmail.Text = lbEmail.Text; LandloadFirstName.Text = FirstName; LandloadMiddleName.Text = MiddleName; LandloadLastName.Text = LastName; LandloadMobileArea.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(0, 3); LandloadMobile1.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(3, 3); LandloadMobile2.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(6, 4); LandloadEdit.Visible = true; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNotPartialUser + "'); window.location = '/Student/Student_Profile_Update_Current_House.aspx';}", true); } } } }
public void loadHouseDatadata(User user_) { if (user_.HouseId != null && user_.HouseId != Guid.Empty) { UserDAO userDAO = new UserDAO(); DataSet LandlordData = userDAO.SelectLandlordByHouseId(user_.HouseId.Value); if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim(); } DataSet ds = new DataSet(); ds = new HouseDAO().SelectAllDataset(Guid.Parse(hdLandloadId.Value)); ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns["HouseId"] }; if (DrpHouse.Items.Count < 1) { DrpHouse.DataSource = ds; DrpHouse.DataTextField = "StreetAddress"; DrpHouse.DataValueField = "HouseId"; DrpHouse.DataBind(); DrpHouse.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE)); } HouseEdit.Visible = true; // set selected house if (user_.HouseId.HasValue) { for (int i = 0; i < DrpHouse.Items.Count; i++) { if (DrpHouse.Items[i].Value.ToString().ToLower() == user_.HouseId.ToString().ToLower()) { DrpHouse.ClearSelection(); DrpHouse.Items[i].Selected = true; } } } House houseData = House.Select(user_.HouseId.Value); if (houseData != null) { if (houseData.IsPartialHouse == true) { // HouseSearch.Visible = true; chknotavailable.Visible = true; DrpHouse.Enabled = true; EnableEdit(); if (houseData.StateId.HasValue) { for (int i = 0; i < Drpstate.Items.Count; i++) { if (Drpstate.Items[i].Value.ToString().ToLower() == houseData.StateId.ToString().ToLower()) { Drpstate.ClearSelection(); Drpstate.Items[i].Selected = true; } } State state; state = Generic.Get<State>(houseData.StateId.Value); if (state != null) { State.Text = state.StateName; } } Address.Text = houseData.StreetAddress; City.Text = houseData.City; Zip.Text = houseData.Zip; RentalAddress.Text = houseData.StreetAddress; RentalCity.Text = houseData.City; RentalZip.Text = houseData.Zip; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNotPartialHouse + "'); window.location = '/Student/Student_Profile_Current_House_Details.aspx';}", true); } } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true); } }
// Landload info public void LoadLandlordData(User user_) { UserDAO userDAO = new UserDAO(); if (user_.HouseId != null || user_.BaseHouseRoomId != null) { DataSet LandlordData; if (user_.HouseId != null) { LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value); } else { LandlordData = userDAO.SelectLandlordByBaseHouseRoomId(user.BaseHouseRoomId.Value); } if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0) { string IspartialUser = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim(); string AspnetUserId = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim(); if (IspartialUser.ToLower() == "true" && (AspnetUserId == "" || AspnetUserId == string.Empty)) { EditLandloadInfoLink.Visible = true; } else { EditLandloadInfoLink.Visible = true; } hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim(); string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim(); string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim(); string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim(); lbName.Text = FirstName + " " + MiddleName + " " + LastName; lbEmail.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim(); lbMobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim(); } } }