protected void Contacts_Changed(object sender, DataGridPageChangedEventArgs e) { ContactsGrid.CurrentPageIndex = e.NewPageIndex; ContactsGrid.DataSource = (IList <ScheduleService.ScheduleEventContactInfo>)Session["SCHEDULE_EVENT_CONTACTS"]; ContactsGrid.DataBind(); }
protected void DC_Click(object sender, EventArgs e) { TableQuery <ContactEntity> query = new TableQuery <ContactEntity>(); ContactsGrid.DataSource = table.ExecuteQuery(query); ContactsGrid.DataBind(); ContactsGrid.Visible = true; }
/// <summary> /// Sorts Contacts based on column selected in header. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleHeaderSortClick(object sender, CommandEventArgs e) { LinkButton btn = sender as LinkButton; string sortExpr = e.CommandArgument.ToString(); // Sort direction is maintained in ViewState ContactsGrid.Sort(sortExpr, SortDirection.Ascending); }
protected void ViewAllButton_Click(object sender, ImageClickEventArgs e) { projectId = -1; ProjectManagementDa projDA = new ProjectManagementDa(); ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(projectId), "organization"); ContactsGrid.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { CloudStorageAccount csa = CloudStorageAccount.Parse("UseDevelopmentStorage=true"); CloudTableClient client = csa.CreateCloudTableClient(); table = client.GetTableReference("contactbook"); table.CreateIfNotExists(); TableQuery <ContactEntity> query = new TableQuery <ContactEntity>(); ContactsGrid.DataSource = table.ExecuteQuery(query); ContactsGrid.DataBind(); }
protected void ContactsGrid_Sorting(object sender, GridViewSortEventArgs e) { int i = 1; DataTable dtSortTable = ContactsGrid.DataSource as DataTable; if (dtSortTable != null) { DataView dvSortedView = new DataView(dtSortTable); dvSortedView.Sort = getSortDirectionString(e.SortExpression, e.SortDirection); ContactsGrid.DataSource = dvSortedView; ContactsGrid.DataBind(); } ViewState["SortField"] = e.SortExpression; }
protected void menuFilter_MenuItemClick(object sender, MenuEventArgs e) { MenuItem item = (MenuItem)e.Item; if (item.ValuePath.StartsWith("Organization")) { ProjectManagementDa projDA = new ProjectManagementDa(); ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsByOrgId(Int32.Parse(item.Value)), "Organization"); } else if (item.ValuePath.StartsWith("Protocols")) { ProjectManagementDa projDA = new ProjectManagementDa(); ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsByProtocol(Int32.Parse(item.Value)), "Organization"); } ContactsGrid.DataBind(); }
private void ReloadContactsButton_Click(object sender, EventArgs e) { try { var Contacts = contactManager.GetAll(); var data = Contacts.ToList(); ContactsGrid.DataSource = data; ContactsGrid.Update(); ContactsGrid.Refresh(); } catch (Exception ex) { MessageBox.Show("Failed to reload contacts. Please try again"); } }
/// <summary> /// Binds the various summary info grids /// </summary> /// <param name="projectId"></param> protected void BindGrids(int projectId) { ProjectManagementDa da = new ProjectManagementDa(); OrganizationsGrid.DataSource = da.GetAllOrganizationsSortedByProjectId(projectId); OrganizationsGrid.DataBind(); ContactsGrid.DataSource = da.GetProjectContactsByProjectId(projectId); ContactsGrid.DataBind(); //BusinessObject.ProjectManuscript bizMan = new BusinessObject.ProjectManuscript(); //bizMan.GetByParent(projectId); //ManuscriptGrid.DataSource = bizMan.DataSourceView; ManuscriptGrid.DataSource = BusinessObject.GetByParentAsDataView <BOL.ProjectManuscript>(projectId); ManuscriptGrid.DataBind(); //ProjectFundingSource biz = new ProjectFundingSource(); //biz.GetByParent(projectId); //FundingGrid.DataSource = biz.DataSourceView; FundingGrid.DataSource = BusinessObject.GetByParentAsDataView <ProjectFundingSource>(projectId); FundingGrid.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ErrorMessageLabel.Visible = false; // Get the query string values. NameValueCollection coll = Request.QueryString; int id = Convert.ToInt32(coll.Get("id")); int scheduleId = Convert.ToInt32(coll.Get("sId")); EventType eventType = EventType.Future; if (coll.Get("et") != "" && coll.Get("et") != null) { eventType = (EventType)Convert.ToInt32(coll.Get("et")); } int agentId = Convert.ToInt32(coll.Get("aId")); string agentName = coll.Get("aName"); int planType = Convert.ToInt32(coll.Get("ptype")); int pageNumber = Convert.ToInt32(coll.Get("pg")); // Display the agent name if one exists. if (agentName != "") { AgentNameLabel.Text = "Agent Name: " + agentName + " "; } if (!IsPostBack) { // Set the required query string varables into hidden fields. IdHiddenField.Value = id.ToString(); ScheduleIdHiddenField.Value = scheduleId.ToString(); EventTypeHiddenField.Value = Convert.ToInt32(eventType).ToString(); AgentIdHiddenField.Value = agentId.ToString(); AgentNameHiddenField.Value = agentName; PlanTypeHiddenField.Value = planType.ToString(); PageNumberHiddenField.Value = pageNumber.ToString(); // Get the schedule event contacts and display. try { ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); IList <ScheduleService.ScheduleEventContactInfo> contacts = scheduleService.GetScheduleEventContacts(id); EventNumberLabel.Text = contacts[0].EventNumber.ToString(); EventDateLabel.Text = contacts[0].EventDate; FarmLabel.Text = contacts[0].FarmName; MailingPlanLabel.Text = contacts[0].PlanName; StartDateLabel.Text = contacts[0].StartDate; EndDateLabel.Text = contacts[0].EndDate; ContactsGrid.DataSource = contacts; ContactsGrid.DataBind(); Session["SCHEDULE_EVENT_CONTACTS"] = contacts; } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } }
private void LoadContactsGrid() { ProjectManagementDa projDA = new ProjectManagementDa(); DataTable contactsDataSource = new DataTable(); string filterBy = Request.QueryString["FilterBy"]; ContactsDa contactsDa = new ContactsDa(); if (isAdmin) { contactsDataSource = contactsDa.GetAllContacts(); } else if (string.IsNullOrEmpty(filterBy)) { if (contactType == "Project") { contactsDataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(projectId), "Organization"); } else { if (!string.IsNullOrEmpty(contactType)) { contactsDataSource = contactsDa.GetContactByContactType(contactType); } } } else { switch (filterBy) { case ("Organization"): contactsDataSource = CombineRows(projDA.GetAllContactsByOrgId(Int32.Parse(Request.QueryString["FilterID"])), "Organization"); break; case ("Protocols"): contactsDataSource = CombineRows(projDA.GetAllContactsByProtocol(Int32.Parse(Request.QueryString["FilterID"])), "Organization"); break; case ("Projects"): contactsDataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(Int32.Parse(Request.QueryString["FilterID"])), "Organization"); break; default: break; } } // Bind grid to datasource ContactsGrid.DataSource = contactsDataSource; ContactsGrid.DataBind(); // Determine if there are any records and show message if (contactsDataSource.Rows.Count == 0) { EmptyMessageLabel.Visible = true; } else { EmptyMessageLabel.Visible = false; } }
private void updateBindingOnContactsTab() { ContactsGrid.UpdateBindingSources <TextBox>(TextBox.TextProperty); }