public PlaceHolder BuildNotifications(string userId) { DataHandler handler = new DataHandler(); string query; PlaceHolder ph = new PlaceHolder(); DataTable[] tables = new DataTable[2]; ArrayList messages = new ArrayList(); GroupService groupService = new GroupService(); //http://stackoverflow.com/questions/5672862/check-if-datetime-instance-falls-in-between-other-two-datetime-objects //notification: you added a teacher query = "SELECT * FROM user_UserHasTeachers " + "WHERE TeacherId = ''" + "ORDER BY Timestamp"; tables[0] = handler.GetDataTable(query); foreach (DataRow row in tables[0].Rows) { } //make sense of the data tables //for each table foreach (DataTable dt in tables) { //check timestamp //insert into position } return ph; }
public static void BuildStudentProspectTable(Table table, string userId) { GroupService service = new GroupService(); DataTable dtProspects = service.GetProspectiveStudentsData(userId); DataTable dtGroups = service.GetSupervisorOfData(userId); for (int i = 0; i < dtProspects.Rows.Count; i++) { DropDownList ddlGroupList = new DropDownList(); ddlGroupList.DataSource = dtGroups; ddlGroupList.DataTextField = "GroupName"; ddlGroupList.DataValueField = "GroupId"; ddlGroupList.DataBind(); ddlGroupList.Items.Insert(0, "Add a group"); string name = dtProspects.Rows[i].ItemArray[0].ToString(); string id = dtProspects.Rows[i].ItemArray[1].ToString(); LinkButton b = new LinkButton(); b.Text = name; b.CommandArgument = id; b.CommandName = name; TableRow row = new TableRow(); TableCell cellProspects = new TableCell(); TableCell cellGroups = new TableCell(); cellProspects.Controls.Add(b); cellGroups.Controls.Add(ddlGroupList); row.Cells.Add(cellProspects); row.Cells.Add(cellGroups); table.Rows.Add(row); } }
private void LoadLabels() { GroupService service = new GroupService(); //see if this is redirected with a query string, display a message if yes bool hasMessage = false; bool.TryParse(Request.QueryString["created"], out hasMessage); if (hasMessage == true) lblMessage.Text = "Operation successfully completed."; //supervisorOf if (phSupervisorOf.Controls.Count > 0) lblSupervisorOf.Text = "You supervise the following groups: "; else lblSupervisorOf.Text = "You are not supervising any groups."; //memberOf if (phMemberOf.Controls.Count > 0) lblMemberOf.Text = "You are a member of the following groups: "; else lblMemberOf.Text = "You do not belong to anyone else's groups."; //hasTeacher if (phHasTeachers.Controls.Count > 0) lblHasTeachers.Text = "You added the following teachers: "; else lblHasTeachers.Text = "You have not added any teachers."; //hasPropsectiveStudent if (service.GetProspectiveStudentCount(userId) > 0) lblHasProspectiveStudents.Text = "You have prospective students.<br /><a href='AddStudents.aspx'>See who added you</a>"; else lblHasProspectiveStudents.Text = "No students have added you"; }
//private string userId = Membership.GetUser().ProviderUserKey.ToString(); protected override void OnInit(EventArgs e) { base.OnInit(e); string groupId = (string)Session["Value"]; lblHeader.Text = (string)Session["Key"]; GroupService service = new GroupService(); DataTable dtStudents = service.GetUsersInGroup(groupId); GroupFactory.BuildPlaceHolder(phUsers, dtStudents); }
public static void AssignProspectsToGroups(Table table, string userId) { GroupService service = new GroupService(); foreach (TableRow row in table.Rows) { LinkButton b = (LinkButton)row.Cells[0].Controls[0]; DropDownList ddl = (DropDownList)row.Cells[1].Controls[0]; service.AddStudentToGroup(b.CommandArgument, ddl.SelectedValue); } }
private void PlaceHolder_Load() { GroupService service = new GroupService(); DataTable dtSuperviorOf = service.GetSupervisorOfData(userId); DataTable dtMemberOf = service.GetMemberOfData(userId); DataTable dtHasTeachers = service.GetHasTeachersData(userId); GroupFactory.BuildPlaceHolder(phSupervisorOf, dtSuperviorOf); GroupFactory.BuildPlaceHolder(phMemberOf, dtMemberOf); GroupFactory.BuildPlaceHolder(phHasTeachers, dtHasTeachers); }
protected override void OnInit(EventArgs e) { base.OnInit(e); Session.RemoveAll(); WebControlService wcs = new WebControlService(); //Groups GroupService groupService = new GroupService(); DataTable dtSuperviorOf = groupService.GetTable(userId, "supervisorOf"); DataTable dtMemberOf = groupService.GetTable(userId, "memberOf"); wcs.BuildPlaceHolder(phSupervisorOf, dtSuperviorOf); wcs.BuildPlaceHolder(phMemberOf, dtMemberOf); //Whiteboards CanvasService canvasService = new CanvasService(); DataTable dtWhiteboards = canvasService.GetTable(userId, "whiteboard"); wcs.BuildPlaceHolder(phWhiteboards, dtWhiteboards); //Notifications NotifcationService notificationService = new NotifcationService(); //DataTable dtProspectiveStudents = notificationService.GetProspectiveStudentsData(userId); }
public static void CreateGroup(string groupName, string userId) { GroupService service = new GroupService(); service.CreateGroup(Guid.NewGuid().ToString(), groupName, userId); }