public void LoadLeaveCurrentHouseRequest(Guid HouseId) { StudentHouseLeave studentHouseLeave = new StudentHouseLeave(); studentHouseLeave = StudentHouseLeave.SelectByHouseId(HouseId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); if ((studentHouseLeave.RequestBy != null && studentHouseLeave.RequestBy != Guid.Empty) && studentHouseLeave.status == 0) { RHP.UserManagement.User _RequestedUser = RHP.UserManagement.User.Select(studentHouseLeave.RequestBy); // Photo photo = new Photo(); // RequestedUser.ImageUrl = photo.LoadImage(studentHouseLeave.RequestBy, Enums.PhotoCategory.Profile_Picture); RequestedUser.Text = _RequestedUser.FirstName + " " + _RequestedUser.LastName; RequestedUserName.Text = _RequestedUser.FirstName + " " + _RequestedUser.LastName; RequestedUser.NavigateUrl = "~/Student/Student_Public_Profile.aspx?AccessCode=" + studentHouseLeave.RequestBy; RespondeToLeaveHouseTrue.Visible = true; } else { RespondeToLeaveHouseFalse.Visible = true; } }
public void OnConfirm(object sender, EventArgs e) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); Guid HouseId = Guid.Empty; Guid RoomId = Guid.Empty; if (user.HouseId.HasValue) { HouseId = user.HouseId.Value; user.HouseId = null; } else if (user.BaseHouseRoomId.HasValue) { RoomId = user.BaseHouseRoomId.Value; user.BaseHouseRoomId = null; } if (user.UpdateHouse()) { StudentHouseLeave studentHouseLeave = new StudentHouseLeave(); if (HouseId != Guid.Empty) { studentHouseLeave = StudentHouseLeave.SelectByHouseId(HouseId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } else if (RoomId != Guid.Empty) { studentHouseLeave = StudentHouseLeave.SelectByRoomId(RoomId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } studentHouseLeave.status = 1; if (studentHouseLeave.Save()) { } Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Delete_success + "'); window.location = '/Student/Student_Profile.aspx';}", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.Delete_Unsuccess + "'); window.location = '/Student/Student_Profile.aspx';}", true); } } else { // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true); } }
protected void ItemDataBound(object sender, DataListItemEventArgs e) { Photo photo = new Photo(); HiddenField HiddenField_ = (HiddenField)e.Item.FindControl("hdUserId"); HiddenField hdHouseId_ = (HiddenField)e.Item.FindControl("hdHouseId"); HiddenField hdBaseHouseRoomId_ = (HiddenField)e.Item.FindControl("hdBaseHouseRoomId"); HyperLink Image_ = (HyperLink)e.Item.FindControl("HyperLinkimage"); LinkButton RequestLeaveCurrentHouse_ = (LinkButton)e.Item.FindControl("RequestLeaveCurrentHouse"); Label LabelItsMe_ = (Label)e.Item.FindControl("LabelItsMe"); Image_.ImageUrl = photo.LoadImage(Guid.Parse(HiddenField_.Value.ToString()), Enums.PhotoCategory.Profile_Picture); if (Guid.Parse(HiddenField_.Value) == Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())) { RequestLeaveCurrentHouse_.Visible = false; LabelItsMe_.Visible = true; LabelItsMe_.Text = "It's Me"; } else { StudentHouseLeave studentHouseLeave = new StudentHouseLeave(); if (hdHouseId_.Value.Trim() != string.Empty) { studentHouseLeave = StudentHouseLeave.SelectByHouseId(Guid.Parse(hdHouseId_.Value), Guid.Parse(HiddenField_.Value)); } else if (hdBaseHouseRoomId_.Value.Trim() != string.Empty) { studentHouseLeave = StudentHouseLeave.SelectByHouseId(Guid.Parse(hdBaseHouseRoomId_.Value), Guid.Parse(HiddenField_.Value)); } if ((studentHouseLeave.RequestBy != null && studentHouseLeave.RequestBy != Guid.Empty) && studentHouseLeave.status == 0) { if (studentHouseLeave.RequestBy == Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())) { RequestLeaveCurrentHouse_.Visible = false; LabelItsMe_.Visible = true; LabelItsMe_.Text = "Request Already Sent"; } } } }
protected void OnConfirmRequest(object sender, EventArgs e) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); Guid HouseId = Guid.Empty; Guid RoomId = Guid.Empty; if (user.HouseId.HasValue) { HouseId = user.HouseId.Value; user.HouseId = null; } else if (user.BaseHouseRoomId.HasValue) { RoomId = user.BaseHouseRoomId.Value; user.BaseHouseRoomId = null; } if (user.UpdateHouse()) { StudentHouseLeave studentHouseLeave = new StudentHouseLeave(); if (user.HouseId.HasValue) { studentHouseLeave = StudentHouseLeave.SelectByHouseId(HouseId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } else if (user.BaseHouseRoomId.HasValue) { studentHouseLeave = StudentHouseLeave.SelectByRoomId(RoomId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } studentHouseLeave.status = 1; if (studentHouseLeave.Save()) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseUnSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseUnSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true); } } else { user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); StudentHouseLeave studentHouseLeave = new StudentHouseLeave(); if (user.HouseId.HasValue) { studentHouseLeave = StudentHouseLeave.SelectByHouseId(user.HouseId.Value, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } else if (user.BaseHouseRoomId.HasValue) { studentHouseLeave = StudentHouseLeave.SelectByRoomId(user.BaseHouseRoomId.Value, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } studentHouseLeave.status = 2; if (studentHouseLeave.Save()) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.RejectLeaveCurrentHouseResponseSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true); } } }