protected void ConsentFormList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = ConsentFormList.Rows[index]; ConsentFormBO consentformbo = new ConsentFormBO(); ConsentForm obj = new ConsentForm(); obj = consentformbo.getConsentFormByFormID(row.Cells[0].Text); ViewFormTitleLB.Text = obj.Title; ViewFormDescriptionTB.Text = obj.Description; FormInfoDiv.Visible = true; if (Boolean.Parse(obj.FoodPreferrence.ToString())) { ViewFormFoodPrefCard.Visible = true; } else { ViewFormFoodPrefCard.Visible = false; } } else if (e.CommandName == "viewParticipants") { //insert page to view participants int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = ConsentFormList.Rows[index]; Response.Redirect("ConsentFormStatus.aspx?FormId=" + row.Cells[0].Text + "&FoodPref=" + row.Cells[5].Text); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { modalOverlay.Visible = false; OthersAlert.Visible = false; UserBO userbo = new UserBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; user currentuser = userbo.getUserById(currentLoggedInUser); string id = Request.QueryString["id"]; ConsentFormBO consentformbo = new ConsentFormBO(); ConsentForm consentFormData = consentformbo.getConsentFormByFormID(id); TitleLB.Text = consentFormData.Title; DescriptionTB.Text = consentFormData.Description; if (consentFormData.FoodPreferrence == "True") { foodprefcard.Visible = true; } else { foodprefcard.Visible = false; } if (currentuser.role == "Student") { alertLB.Visible = true; signgroup.Visible = false; } else if (currentuser.role == "Parent") { alertLB.Visible = false; signgroup.Visible = true; } } }
protected void ClassesDropDownList_SelectedIndexChanged(object sender, EventArgs e) { UserBO userbo = new UserBO(); ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; user userobj = userbo.getUserById(currentLoggedInUser); List <String> TeachingClasses = userbo.getTeachersTeachingClasses(currentLoggedInUser); String FormID = Request.QueryString["FormId"]; String FoodPrefEnabled = Request.QueryString["FoodPref"]; if (consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school) == null || consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school).Count == 0) { noStudentsMsg.Visible = true; } else { noStudentsMsg.Visible = false; } StudentTables.DataSource = consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school); StudentTables.DataBind(); if (FoodPrefEnabled == "True") { StudentTables.Columns[2].Visible = true; } else if (FoodPrefEnabled == "False") { StudentTables.Columns[2].Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Current_screen_LB.Text = "Manage/Check Consent Forms"; //CreateFormBtn.Visible = true; //ManageFormBtn.Visible = false; classListDiv.Visible = false; FormInfoDiv.Visible = false; confirmationOverlay.Visible = false; foodprefcard.Visible = false; foodprefcardupdate.Visible = false; updateFormDiv.Visible = false; modalOverlay.Visible = false; FoodRadioButton.SelectedIndex = 0; CreateConsentFormDiv.Visible = false; DraftList.Visible = false; UserBO userbo = new UserBO(); ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; List <String> TeachingClasses = userbo.getTeachersTeachingClasses(currentLoggedInUser); List <ConsentForm> consentFormRecordsDrafts = consentformbo.getDraftConsentFormsBySenderID(currentLoggedInUser); if (consentFormRecordsDrafts == null || consentFormRecordsDrafts.Count == 0) { DraftFormErrorMsg.Text = "There are no drafts created."; } DraftFormErrorMsg.Visible = false; List <ConsentForm> consentFormRecords = consentformbo.getConsentFormsBySenderID(currentLoggedInUser); if (consentFormRecords == null || consentFormRecords.Count == 0) { formErrorMsg.Text = "There are no forms created."; } else { consentFormRecords.Reverse(); //sorts by latest at the top } classesDropDownList.DataSource = TeachingClasses; classesDropDownList.DataBind(); string currentSchool = userbo.getUserById(Request.Cookies["CurrentLoggedInUser"].Value).school; classesDropDownList.SelectedIndex = 0; string selectedClass = classesDropDownList.SelectedValue; List <user> studentClassList = userbo.retrieveClassListBySchoolAndClass(currentSchool, selectedClass); classListGridView.DataSource = studentClassList; classListGridView.DataBind(); SelectedClassesListBox.DataSource = TeachingClasses; SelectedClassesListBox.DataBind(); //binds the data of classes that the user teaches updateSelectedClassesListBox.DataSource = TeachingClasses; updateSelectedClassesListBox.DataBind(); DraftList.DataSource = consentFormRecordsDrafts; DraftList.DataBind(); ConsentFormList.DataSource = consentFormRecords; ConsentFormList.DataBind(); //bind entries } }
protected void YesBtn_Click(object sender, EventArgs e) { String DraftID = hiddenFieldID.Text; ConsentFormBO consentformbo = new ConsentFormBO(); consentformbo.removeDraft(DraftID); confirmationOverlay.Visible = false; MessageLabel.Text = "Consent form draft is successfully deleted."; modalOverlay.Visible = true; }
protected void DraftList_PageIndexChanging(object sender, GridViewPageEventArgs e) { ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; List <ConsentForm> consentFormRecords = consentformbo.getDraftConsentFormsBySenderID(currentLoggedInUser); consentFormRecords.Reverse(); DraftList.DataSource = consentFormRecords; DraftList.PageIndex = e.NewPageIndex; DraftList.DataBind(); }
protected void sendDraftBtn_Click(object sender, EventArgs e) { String RecievingClasses = ""; String senderID = Request.Cookies["CurrentLoggedInUser"].Value; String school; UserBO userbo = new UserBO(); school = userbo.getUserById(senderID).school; String Title; String Description; String FoodPreferrence; String DraftID; //this for loop will store the selected classes into a single string that can be split to retrive them later if (updateSelectedClassesListBox_Selected.Items.Count == 0) { System.Web.HttpContext.Current.Response.Write("<script>alert(\"There are no classes selected, please select a class.\")</script>"); } else { for (int i = 0; i < updateSelectedClassesListBox_Selected.Items.Count; i++) { if (i == updateSelectedClassesListBox_Selected.Items.Count - 1) { RecievingClasses += updateSelectedClassesListBox_Selected.Items[i]; } else { RecievingClasses += updateSelectedClassesListBox_Selected.Items[i] + ","; } } //getting the other informations DraftID = hiddenFieldID.Text; Title = UpdateTitleTB.Text; Description = UpdateDescriptionTB.Text; FoodPreferrence = UpdateFoodPreferrences.Checked.ToString(); //send it to business object ConsentFormBO consentformbo = new ConsentFormBO(); consentformbo.createConsentForm(senderID, RecievingClasses, school, Title, Description, FoodPreferrence); //insert a new record into db through Business Logic consentformbo.removeDraft(DraftID); System.Diagnostics.Debug.WriteLine(RecievingClasses + " " + school); //console write MessageLabel.Text = "Consent form is successfully created and sent"; modalOverlay.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { formalert.Visible = false; UserBO userbo = new UserBO(); ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; user currentuser = userbo.getUserById(currentLoggedInUser); if (currentuser.role == "Student") { List <ConsentForm> consentFormRecords = consentformbo.selectUnsignedFormsByUser(currentuser.User_ID, currentuser.school, currentuser.education_class); if (consentFormRecords != null && consentFormRecords.Count != 0) { consentFormRecords.Reverse(); //sorts by latest at the top } else { formalert.Visible = true; } pendingForms.DataSource = consentFormRecords; pendingForms.DataBind(); } else if (currentuser.role == "Parent") { user childuser = userbo.getUserById(currentuser.child_ID); List <ConsentForm> consentFormRecords = consentformbo.selectUnsignedFormsByUser(childuser.User_ID, childuser.school, childuser.education_class); if (consentFormRecords != null && consentFormRecords.Count != 0) { consentFormRecords.Reverse(); //sorts by latest at the top } else { formalert.Visible = true; } pendingForms.DataSource = consentFormRecords; pendingForms.DataBind(); } else { formalert.Visible = true; } } }
protected void updateBtn_Click(object sender, EventArgs e) { String FormID; String Title; String Description; String FoodPreferrence; String RecievingClasses = ""; String senderID = Request.Cookies["CurrentLoggedInUser"].Value; String school; UserBO userbo = new UserBO(); school = userbo.getUserById(senderID).school; //this for loop will store the selected classes into a single string that can be split to retrive them later if (updateSelectedClassesListBox_Selected.Items.Count == 0) { System.Web.HttpContext.Current.Response.Write("<script>alert(\"There are no classes selected, please select a class.\")</script>"); } else { for (int i = 0; i < updateSelectedClassesListBox_Selected.Items.Count; i++) { if (i == updateSelectedClassesListBox_Selected.Items.Count - 1) { RecievingClasses += updateSelectedClassesListBox_Selected.Items[i]; } else { RecievingClasses += updateSelectedClassesListBox_Selected.Items[i] + ","; } } //getting the other informations FormID = hiddenFieldID.Text; Title = UpdateTitleTB.Text; Description = UpdateDescriptionTB.Text; FoodPreferrence = UpdateFoodPreferrences.Checked.ToString(); //send it to business object ConsentFormBO consentformbo = new ConsentFormBO(); consentformbo.updateDraftConsentFormByFormID(FormID, RecievingClasses, Title, Description, FoodPreferrence); MessageLabel.Text = "Consent form draft is successfully updated"; modalOverlay.Visible = true; } //this for loop will store the selected classes into a single string that can be split to retrive them later }
protected void signBtn_Click(object sender, EventArgs e) { UserBO userbo = new UserBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; user currentuser = userbo.getUserById(currentLoggedInUser); user childuser = userbo.getUserById(currentuser.child_ID); string id = Request.QueryString["id"]; ConsentFormBO formbo = new ConsentFormBO(); String foodpreferrence = ""; if (foodprefcard.Visible == false) { foodpreferrence = ""; } else { if (FoodRadioButton.SelectedIndex == 3) { if (OthersTB.Text.Trim() == "" || OthersTB.Text.Trim() == null) { //insert javascript alert OthersAlert.Visible = true; } else { foodpreferrence = OthersTB.Text; OthersAlert.Visible = false; } } else { foodpreferrence = FoodRadioButton.SelectedValue; OthersAlert.Visible = false; } } //finish setting, validation check if (!OthersAlert.Visible) { formbo.createFormEntry(childuser.User_ID, id, foodpreferrence); modalOverlay.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserBO userbo = new UserBO(); ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; user userobj = userbo.getUserById(currentLoggedInUser); List <String> TeachingClasses = userbo.getTeachersTeachingClasses(currentLoggedInUser); String FormID = Request.QueryString["FormId"]; String FoodPrefEnabled = Request.QueryString["FoodPref"]; ClassesDropDownList.DataSource = consentformbo.getSentClassesByFormID(FormID); ClassesDropDownList.DataBind(); ClassesDropDownList.SelectedIndex = 0; if (consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school) == null || consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school).Count == 0) { noStudentsMsg.Visible = true; } else { noStudentsMsg.Visible = false; } StudentTables.DataSource = consentformbo.retrieveClassList(FormID, ClassesDropDownList.SelectedItem.Text, userobj.school); StudentTables.DataBind(); if (FoodPrefEnabled == "True") { StudentTables.Columns[2].Visible = true; } else if (FoodPrefEnabled == "False") { StudentTables.Columns[2].Visible = false; } //List<ConsentForm> consentFormRecords = consentformbo.getConsentFormsBySenderID(currentLoggedInUser); //consentFormRecords.Reverse(); //sorts by latest at the top //SelectedClassesListBox.DataSource = TeachingClasses; //SelectedClassesListBox.DataBind(); //binds the data of classes that the user teaches //ConsentFormList.DataSource = consentFormRecords; //ConsentFormList.DataBind(); //bind entries } }
protected void DraftList_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = DraftList.SelectedRow; updateFormDiv.Visible = true; ConsentFormBO consentformbo = new ConsentFormBO(); ConsentForm obj = new ConsentForm(); UserBO userbo = new UserBO(); obj = consentformbo.getDraftConsentFormByFormID(row.Cells[0].Text); List <String> RecievingClasses = obj.RecievingClasses.Split(',').ToList <String>(); List <String> TeachingClasses = userbo.getTeachersTeachingClasses(Request.Cookies["CurrentLoggedInUser"].Value); List <String> newTeachClasses = new List <string>(); foreach (String i in TeachingClasses) { if (RecievingClasses.Contains(i)) { //dont add anything } else { newTeachClasses.Add(i); } } updateSelectedClassesListBox.DataSource = newTeachClasses; updateSelectedClassesListBox.DataBind(); updateSelectedClassesListBox_Selected.DataSource = RecievingClasses; updateSelectedClassesListBox_Selected.DataBind(); hiddenFieldID.Text = obj.ConsentFormID.ToString(); UpdateTitleTB.Text = obj.Title; UpdateDescriptionTB.Text = obj.Description; UpdateFoodPreferrences.Checked = Boolean.Parse(obj.FoodPreferrence.ToString()); if (UpdateFoodPreferrences.Checked) { foodprefcardupdate.Visible = true; } else { foodprefcardupdate.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); if (!this.IsPostBack) { /*Session Fixation*/ // check if the 2 sessions n cookie is not null if (Session["LoginUserName"] != null && Session["AuthToken"] != null && Request.Cookies["AuthToken"] != null && Request.Cookies["CurrentLoggedInUser"] != null) { //second check for cookie has the same value as the second session if ((Session["AuthToken"].ToString().Equals(Request.Cookies["AuthToken"].Value))) /*End of Session Fixation*/ { current_logged_in_user = Request.Cookies["CurrentLoggedInUser"].Value; ErrorConsentForm.Visible = false; ErrorLabelPurchase.Visible = false; UserBO userbo = new UserBO(); current_user_obj = userbo.getUserById(current_logged_in_user); ProfileName_LB.Text = current_user_obj.name; Role_LB.Text = current_user_obj.role; UserID_LB.Text = current_user_obj.User_ID; CCAPoints_LB.Text = current_user_obj.cca_point.ToString(); OrionPoints_LB.Text = current_user_obj.orion_point.ToString(); Bookstore_BO bookstorebo = new Bookstore_BO(); List <PurchasedItem> itemsList = new List <PurchasedItem>(); itemsList = bookstorebo.purchaseHistory(current_logged_in_user); if (itemsList == null || itemsList.Count == 0) { ErrorLabelPurchase.Visible = true; } else if (itemsList.Count() < 3) { itemsList.Reverse(); purchaseHistoryGridView.DataSource = itemsList.GetRange(0, itemsList.Count()); purchaseHistoryGridView.DataBind(); ErrorLabelPurchase.Visible = false; } else if (itemsList.Count() >= 3) { itemsList.Reverse(); purchaseHistoryGridView.DataSource = itemsList.GetRange(0, 3); purchaseHistoryGridView.DataBind(); ErrorLabelPurchase.Visible = false; } //hide certain panels according to user type if (current_user_obj.role == "Student") { RegisteredActivities_Col.Visible = true; ConsentForms_Col.Visible = false; Response.Cookies["Current_Edu_Level"].Value = current_user_obj.education_level; eventBO eventbo = new eventBO(); List <events> eventList = eventbo.loadSignUpEvent(current_logged_in_user); //event stuff if (eventList == null || eventList.Count == 0) { EventsErrorMsg.Visible = true; } else if (eventList.Count() < 3) { eventList.Reverse(); RegisteredEventGridView.DataSource = eventList.GetRange(0, eventList.Count()); RegisteredEventGridView.DataBind(); EventsErrorMsg.Visible = false; } else if (eventList.Count() >= 3) { itemsList.Reverse(); RegisteredEventGridView.DataSource = eventList.GetRange(0, 3); RegisteredEventGridView.DataBind(); EventsErrorMsg.Visible = false; } //insert pending items [check class, check the amount of unsigned forms] ConsentFormBO consentformbo = new ConsentFormBO(); List <ConsentForm> consentFormList = consentformbo.selectUnsignedFormsByUser(current_user_obj.User_ID, current_user_obj.school, current_user_obj.education_class); if (consentFormList == null || consentFormList.Count == 0) { pendingItemsLabel.Text = "You have no pending items."; } else { pendingItemsLabel.Text = "You have (" + consentFormList.Count + ") pending items."; } } else if (current_user_obj.role == "Parent") { RegisteredActivities_Col.Visible = true; ConsentForms_Col.Visible = false; RegisteredActivities_Col.Visible = false; //insert pending items [check class, check the amount of unsigned forms] //find child user childuser = new user(); UserBO childuserbo = new UserBO(); childuser = childuserbo.getUserById(current_user_obj.child_ID); ConsentFormBO consentformbo = new ConsentFormBO(); List <ConsentForm> consentFormList = consentformbo.selectUnsignedFormsByUser(childuser.User_ID, childuser.school, childuser.education_class); if (consentFormList == null || consentFormList.Count == 0) { pendingItemsLabel.Text = "You have no pending items."; } else { pendingItemsLabel.Text = "You have (" + consentFormList.Count + ") pending items."; } } else if (current_user_obj.role == "Teacher") { ConsentForms_Col.Visible = true; RegisteredActivities_Col.Visible = false; pendingItemsLabel.Text = "You have no pending items.";//tentative //insert 3 recently sent forms here ConsentFormBO consentformbo = new ConsentFormBO(); List <ConsentForm> consentFormList = consentformbo.getConsentFormsBySenderID(current_user_obj.User_ID); if (consentFormList == null || consentFormList.Count == 0) { ErrorConsentForm.Visible = true; } else if (consentFormList.Count() < 3) { consentFormList.Reverse(); GridViewSentForms.DataSource = consentFormList.GetRange(0, consentFormList.Count()); GridViewSentForms.DataBind(); ErrorConsentForm.Visible = false; } else if (consentFormList.Count() >= 3) { consentFormList.Reverse(); GridViewSentForms.DataSource = consentFormList.GetRange(0, 3); GridViewSentForms.DataBind(); ErrorConsentForm.Visible = false; } } else if (current_user_obj.role == "Staff") { ConsentForms_Col.Visible = false; RegisteredActivities_Col.Visible = false; pendingItemsLabel.Text = "You have no pending items."; RegisteredActivities_Col.Visible = false; } else if (current_user_obj.role == "Admin") { ConsentForms_Col.Visible = false; RegisteredActivities_Col.Visible = false; pendingItemsLabel.Text = "You have no pending items."; RegisteredActivities_Col.Visible = false; } ToConsentFormsManagementBtn.NavigateUrl = Response.ApplyAppPathModifier("ManageConsentFormsPage.aspx"); } } else { Response.Redirect("LoginPage.aspx"); } } }