/// <summary> /// Populate associated organizations based on Contact Id /// </summary> private void PopulateOrgRptr() { // Get DataSource for Organization Display List as well as Organization Grid ProjectManagementDa projDA = new ProjectManagementDa(); DataTable displayTable = projDA.GetAllOrgsByContactId(contactId); // Get a list of unassociated organizations to determine how many blank rows // as well as bind CaisisSelects DataView view = projDA.GetAllUnassociatedOrgsByContact(contactId).DefaultView; OrgGrid2.BlankRows = view.Count; OrgGrid2.DataSource = displayTable; OrgGrid2.DataBind(); // Bind View OrgViewList.DataSource = displayTable; OrgViewList.DataBind(); // bind contact's documents DataView contactDocs = ContactRegulatoryDetail.GetByFieldsAsDataView <ContactRegulatoryDetail>(new Dictionary <string, object> { { ContactRegulatoryDetail.ContactId, contactId } }); ContactDocumentsGrid.DataSource = contactDocs; ContactDocumentsGrid.DataBind(); }
// Populate the contacts select control private void PopulateSelect(string selectControlName, string selectControlFooterName, GridViewRowEventArgs e) { ProjectManagementDa projDA = new ProjectManagementDa(); CaisisSelect selectName = null; GridViewRow currentRow = e.Row; if (e.Row.RowIndex > -1) { selectName = currentRow.FindControl(selectControlName) as CaisisSelect; } else if (e.Row.RowType == DataControlRowType.Footer) { selectName = currentRow.FindControl(selectControlFooterName) as CaisisSelect; } if (selectName != null) { selectName.DataTextField = "Name"; selectName.DataValueField = "ContactId"; selectName.DataSource = projDA.GetAllContacts(); selectName.DataBind(); } }
/// <summary> /// /// </summary> protected void SetOrganizationLevelView(int orgId) { // Load record from BusinessObject ProjectOrganization org = new ProjectOrganization(); org.Get(orgId); // Set Heading And Hide Grid OrgHeading.Text = "Organization"; OrganizationsGrid.Visible = false; ContactsGrid.Visible = false; OrgAddress.Visible = true; // Set Address OrgName.Text = org[ProjectOrganization.Name].ToString(); OrgShortName.Text = org[ProjectOrganization.ShortName].ToString(); OrgAddress1.Text = org[ProjectOrganization.Address1].ToString(); OrgAddress2.Text = org[ProjectOrganization.Address2].ToString(); OrgCity.Text = org[ProjectOrganization.City].ToString(); OrgState.Text = org[ProjectOrganization.State].ToString(); OrgPostal.Text = org[ProjectOrganization.PostalCode].ToString(); ProjectManagementDa da = new ProjectManagementDa(); // Filter list of contacts in this project by this organization DataView orgsContacts = da.GetAllContactsWithOrgNameByProjectId(projectId).DefaultView; orgsContacts.RowFilter = ProjectOrganization.OrganizationId + " = " + OrganizationId; OrgContactsRptr.DataSource = orgsContacts; OrgContactsRptr.DataBind(); }
private string GetProjectInfo(string projectId) { string projectInfo = ""; if (!string.IsNullOrEmpty(projectId) && PageUtil.IsInteger(projectId)) { Project p = new Project(); p.Get(int.Parse(projectId)); projectInfo = p[Project.ProjectNum].ToString() + " : " + p[Project.Title].ToString(); ProjectManagementDa pmDa = new ProjectManagementDa(); DataTable organizations = pmDa.GetAllOrganizationsSortedByProjectId(int.Parse(projectId)); string orgList = ""; foreach (DataRow dr in organizations.Rows) { orgList += dr[ProjectOrganization.Name].ToString() + "\n"; } string url = Page.ResolveUrl("~/Core/Utilities/ModuleContainer.aspx?mod=/ProjectMgmt/Index.aspx"); string projectPath = "top.window.location = '" + url + "?projectId=" + projectId + "'"; ProjectIdLink.Attributes.Add("onclick", projectPath); ProjectId.ToolTip = orgList; } return(projectInfo); }
/// <summary> /// Bind grid to exitsing orgs for project /// </summary> protected void BindOrganizationData() { ProjectManagementDa da = new ProjectManagementDa(); // Set global views used for bind grid and dropdowns associatedOrgs = da.GetProjectOrganizationsByProjectId(projectId).DefaultView; // Insert helper column for sorting associated organizations string helpSortCol = "TempSortCol"; DataColumn bob = new DataColumn(helpSortCol); bob.DefaultValue = 1; associatedOrgs.Table.Columns.Add(bob); foreach (DataRow row in associatedOrgs.Table.Rows) { row[helpSortCol] = 0; } associatedOrgs.Sort = helpSortCol + " ASC," + ProjectOrganization.Name + " ASC"; // Unassociated organizations should also be sorted by name unAssociatedOrgs = da.GetAllProjectOrganizationsExcludingProject(projectId).DefaultView; unAssociatedOrgs.Sort = ProjectOrganization.Name + " ASC"; AssociatedOrgsGrid.DataSource = associatedOrgs; AssociatedOrgsGrid.DataBind(); }
/// <summary> /// Load organizations to the select box /// </summary> private void LoadOrganizationsList() { ProjectManagementDa projDA = new ProjectManagementDa(); ContactProjOrgName.DataSource = projDA.GetAllUnassociatedOrgsByContact(contactId).DefaultView;; ContactProjOrgName.DataBind(); }
private void BuildContacts(int organizationId) { // build contacts ContactsDa da = new ContactsDa(); var contactAndUsers = da.GetAllContactsAndUser(organizationId).DefaultView; contactAndUsers.RowFilter = "OrganizationContactId IS NOT NULL"; ContactsRptr.DataSource = contactAndUsers; ContactsRptr.DataBind(); NoContacsMessage.Visible = contactAndUsers.Count == 0; // build projects ProjectManagementDa projectDa = new ProjectManagementDa(); DataView projects = projectDa.GetAllProjectsForOrg(organizationId).DefaultView; projects.Sort = Project.Title + " ASC"; ProjectsRptr.DataSource = projects; ProjectsRptr.DataBind(); NoProjectsMessage.Visible = projects.Count == 0; // build protocols DataView protocols = ProtocolMgmtDa.GetProtocolsByOrganization(organizationId).DefaultView; protocols.Sort = Protocol.ProtocolNum + " ASC"; ProtocolRptr.DataSource = protocols; ProtocolRptr.DataBind(); NoProtocolsMessage.Visible = protocols.Count == 0; }
private void BuildOrganizationProjects(int organizationId) { ProjectManagementDa da = new ProjectManagementDa(); DataView projectsList = da.GetAllProjectsForOrg(organizationId).DefaultView; OrganizationProjectsRptr.DataSource = projectsList; OrganizationProjectsRptr.DataBind(); }
protected void ViewAllButton_Click(object sender, ImageClickEventArgs e) { projectId = -1; ProjectManagementDa projDA = new ProjectManagementDa(); ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(projectId), "organization"); ContactsGrid.DataBind(); }
/// <summary> /// Creates child ProjectStage, ProjectStageEvents and ProjectEventAttributes records /// based off of child/parent Lookup scheme. /// NOTE: Child records will not be created if any ProjectStage records exists. /// </summary> /// <param name="projBiz"></param> private static void CreateProjectRecords(Project projBiz) { int projectId = int.Parse(projBiz[Project.ProjectId].ToString()); ProjectManagementDa m = new ProjectManagementDa(); DataTable dt = m.GetProjectOrganizationsByProjectId(projectId); CreateProjectStagesRecords(projBiz, dt); }
private void PopulateManuscriptEventGrid() { ProjectManagementDa projDA = new ProjectManagementDa(); DataTable dt = projDA.GetManuscriptInfo(manuscriptId); ProjectManuscriptEventGridView.DataSource = dt; ProjectManuscriptEventGridView.DataBind(); }
private void PopulateManuscriptAuthorsGrid() { ProjectManagementDa projDA = new ProjectManagementDa(); DataTable dt = projDA.GetAuthorsByManuscriptId(manuscriptId); ManuscriptAuthorGridViewReadOnly.DataSource = dt; ManuscriptAuthorGridViewReadOnly.DataBind(); }
private void PopulateCompletedByName() { ProjectManagementDa projDa = new ProjectManagementDa(); DataView contactsList = projDa.GetAllContacts().DefaultView; contactsList.Sort = "Name ASC"; FindCompletedByName.DataSource = contactsList; FindCompletedByName.DataBind(); }
/// <summary> /// Moves Items (Records) from the Right Select to Left Select /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnRemoveClick(object sender, EventArgs e) { ProjectManagementDa da = new ProjectManagementDa(); string key = "ToContacts"; int[] keysToRemove = PageUtil.GetKeysFromMultiSelect(Request, key); da.RemoveAssociatedContacts(projectId, keysToRemove); BindContactsData(); base.RegisterUpdatePageScript(string.Empty, false); }
/// <summary> /// Bind attributes for each stage /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BindProjectStageEventAttributes(object sender, RepeaterItemEventArgs e) { int projectStageEventId = int.Parse(DataBinder.Eval(e.Item.DataItem, ProjectStageEvent.StageEventId).ToString()); Label eventName = e.Item.FindControl("StageEventLabel") as Label; eventName.Text = DataBinder.Eval(e.Item.DataItem, ProjectStageEvent.Name).ToString(); HiddenField stageEventId = e.Item.FindControl("StageEventIdField") as HiddenField; stageEventId.Value = projectStageEventId.ToString(); //ProjectEventAttribute stageEventAttributes = new ProjectEventAttribute(); //stageEventAttributes.GetByParent(projectStageEventId); //eventAttributes.DataSource = stageEventAttributes.DataSourceView; /* * Repeater eventAttributes = e.Item.FindControl("ProjectStageEventAttributesRptr") as Repeater; * eventAttributes.DataSource = BusinessObject.GetByParentAsDataView<ProjectEventAttribute>(projectStageEventId); * eventAttributes.DataBind(); */ // Bind Empty Columns For Orgs Repeater OrgStageEventRptr = e.Item.FindControl("OrgStageEventRptr") as Repeater; if (OrgStageEventRptr != null) { OrgStageEventRptr.DataSource = organizationListDataView; OrgStageEventRptr.DataBind(); // Check individual organization's stage foreach (RepeaterItem item in OrgStageEventRptr.Items) { ProjectManagementDa da = new ProjectManagementDa(); CheckBox orgStageEventCheckBox = item.FindControl("OrgStageEventCheckBox") as CheckBox; HiddenField orgIdField = item.FindControl("OrgIdField") as HiddenField; if (orgStageEventCheckBox != null && !string.IsNullOrEmpty(orgIdField.Value)) { string eventExistsSQL = ProjectStage.OrganizationId + " IS NOT NULL AND " + ProjectStage.OrganizationId + " = " + orgIdField.Value + " AND " + ProjectStageEvent.Name + " = '" + eventName.Text.Replace("'", "''") + "'"; if (allProjectStageEvents.Table.Select(eventExistsSQL).Length > 0) { orgStageEventCheckBox.Checked = true; } else { orgStageEventCheckBox.Checked = false; } } } } }
protected void BindStageEventsGrid() { //ProjectStageEvent stageEvents = new ProjectStageEvent(); //stageEvents.GetByParent(stageId); //ProjectStageEventsGrid.DataSource = stageEvents.DataSourceView; ProjectManagementDa da = new ProjectManagementDa(); DataView dv = da.GetStageEvents(stageId).DefaultView; dv.Sort = "SortOrder"; ProjectStageEventsGrid.DataSource = dv; ProjectStageEventsGrid.DataBind(); }
/// <summary> /// Binds To and From Selects to show available and selected Contacts /// </summary> protected void BindContactsData() { ProjectManagementDa da = new ProjectManagementDa(); unassociatedContact = da.GetAllUnassignedContacts(projectId).DefaultView; associatedContacts = da.GetProjectContactsByProjectId(projectId).DefaultView; FromContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView; FromContactsOrgRptr.DataBind(); ToContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView; ToContactsOrgRptr.DataBind(); }
/// <summary> /// Moves Items (Records) from the Left Select to Right Select /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnAddClick(object sender, EventArgs e) { ProjectManagementDa da = new ProjectManagementDa(); string key = "FromContacts"; int[] keysToAdd = PageUtil.GetKeysFromMultiSelect(Request, key); if (keysToAdd.Length > 0) { da.AddAssociatedContacts(projectId, keysToAdd); BindContactsData(); } base.RegisterUpdatePageScript(string.Empty, false); }
/// <summary> /// Returns a js array used by client to populate dropdowns /// </summary> /// <returns></returns> public string GetCallbackResult() { string[] keys = _callbackOrgId.Split(';'); string orgId = keys[0]; string contactClientId = keys[1]; ProjectManagementDa da = new ProjectManagementDa(); DataTable contacts = da.GetAllContactsByOrgId(int.Parse(orgId)); string clientArray = PageUtil.DataTableToJSArray(contacts, new string[] { "Name", "ContactId" }, true); string clientObject = "['" + contactClientId + "'," + clientArray + " ]"; return(clientObject); }
private bool PopulateLOINumber(ProjectLetterOfIntent biz) { if (IncludeFormRadioList.SelectedValue.CompareTo("Letter Of Intent") == 0 && biz.HasField(ProjectLetterOfIntent.LOINumber) && String.IsNullOrEmpty(biz[ProjectLetterOfIntent.LOINumber].ToString())) { ProjectManagementDa projDA = new ProjectManagementDa(); biz[ProjectLetterOfIntent.LOINumber] = projDA.GetIDForLOI(); return(true); } return(false); }
private void PopulateManuscriptAuthorsGrid() { ProjectManagementDa projDA = new ProjectManagementDa(); DataTable dt = projDA.GetAuthorsByManuscriptId(manuscriptId); DataView dv = dt.DefaultView; dv.Table.Columns.Add("AuthorOrderInt", typeof(int), "IsNull(AuthorOrder, 100000)"); dv.Sort = "AuthorOrderInt"; ManuscriptAuthorGridView.DataSource = dv; ManuscriptAuthorGridView.DataBind(); }
private void InitializeFilters() { int protocolId = int.Parse(BaseProtocolId); string datasetSQL = base.GetSpecimenPatientsDatasetSQL(); DataSet searchFilters = da.GetSpecimenInventoryFiltersByProtocol(protocolId, datasetSQL, GetIncludedStatuses(), GetExcludedStatuses()); DataTable distinctStudyIds = searchFilters.Tables[0]; DataTable distinctStutuses = searchFilters.Tables[1]; // static data bind if (!Page.IsPostBack) { SpecimenStatus_Filter.ShowEmptyListItem = distinctStutuses.Select("FieldValue = ''").Length == 0; SpecimenStatus_Filter.DataSource = distinctStutuses; SpecimenStatus_Filter.DataBind(); // data bind columns ColumnSelection.DataSource = DISPLAY_COLUMNS; ColumnSelection.DataBind(); foreach (ListItem item in ColumnSelection.Items) { if (item.Value == PatientProtocol.PtProtocolStudyId || item.Value == Specimen.SpecimenReferenceNumber) { item.Enabled = false; } item.Selected = true; } } // special case: dynamic data binding PtProtocolStudyId_Filter.BuildComboData(distinctStudyIds, "FieldValue", "FieldValue"); //PtProtocolStudyId_Filter.ShowEmptyListItem = distinctStudyIds.Select("FieldValue = ''").Length == 0; //PtProtocolStudyId_Filter.DataSource = distinctStudyIds; //PtProtocolStudyId_Filter.DataBind(); // build sites if (!Page.IsPostBack) { Protocol protocol = new Protocol(); protocol.Get(protocolId); if (!protocol.IsNull(Protocol.ProjectId)) { int projectId = (int)protocol[Protocol.ProjectId]; DataTable organizations = new ProjectManagementDa().GetAllOrganizationsByProjectId(projectId); SpecimenSite_Filter.DataSource = organizations; SpecimenSite_Filter.DataBind(); } } }
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(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!Page.IsPostBack) { DataView projectsList = new DataView(); // If filtering by user, determine which project a user belongs if (FilterByUser) { ProjectManagementDa da = new ProjectManagementDa(); string uName = new Caisis.Security.SecurityController().GetUserName(); UserDa uda = new UserDa(); int uId = uda.GetUserId(uName); projectsList = da.GetAllProjectsByUserId(uId).DefaultView; } // Else, user has access to all projects else { //Project biz = new Project(); if (String.IsNullOrEmpty(OrganizationId) || OrganizationId.Equals("-1")) { //biz.GetAll(); //projectsList = biz.DataSourceView; projectsList = BusinessObject.GetAllAsDataView <Project>(); } else { ProjectManagementDa da = new ProjectManagementDa(); projectsList = da.GetAllProjectsForOrg(Int32.Parse(OrganizationId)).DefaultView; } } // Force default sort to earliest records first //projectsList.Sort = Project.ProjectId + " ASC"; // default sort projectsList.Sort = "Title"; // SORTING DISABLED recordCount = projectsList.Count; // Bind projects to user's view BindProjectList(projectsList); } }
private void LoadResponseGrid(string sortExpr) { ProjectManagementDa projDA = new ProjectManagementDa(); DataTable dt = projDA.GetLOIResponse(ProjectLetterOfIntentId); dt.DefaultView.Sort = sortExpr; if (dt.DefaultView.Table.Rows.Count == 0) { EmptyMessageLabel.Visible = true; } else { EmptyMessageLabel.Visible = false; ResponseGrid.DataSource = dt.DefaultView; ResponseGrid.DataBind(); } }
/// <summary> /// Read paramaters off query string and determine context /// </summary> private void SetUserPermissions() { if (PermissionManager.HasPermission(PermissionManager.AdminProjectModule) || PermissionManager.HasPermission(PermissionManager.EditSecurity)) { _userType = ProjectMgmtUsers.ModuleAdmin; } else if (PermissionManager.HasPermission(PermissionManager.AdminProject)) { SecurityController sc = new SecurityController(); string userName = sc.GetUserName(); // If working with a Project, determine if user is part of project if (!string.IsNullOrEmpty(ProjectId)) { UserDa userDa = new UserDa(); int userId = userDa.GetUserId(userName); ProjectManagementDa projectDa = new ProjectManagementDa(); DataTable contactsInProject = projectDa.GetProjectContactsByProjectId(int.Parse(ProjectId)); string userInProjectQuery = Contact.UserId + " IS NOT NULL AND " + Contact.UserId + " = " + userId; // Query contacts in project to see if user is associated with this Project if (contactsInProject.Select(userInProjectQuery).Length > 0) { _userType = ProjectMgmtUsers.ProjectAdmin; } // User permissions for this project defaults to regular user else { _userType = ProjectMgmtUsers.ProjectUser; } } // If not working in project, user will have normal access to normal //ProjectAdmin Administrative functions else { _userType = ProjectMgmtUsers.ProjectAdmin; } } else if (PermissionManager.HasPermission(PermissionManager.UpdateProject)) { _userType = ProjectMgmtUsers.ProjectUser; } }
protected void BindOrganizationsAndContacts(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get the org drop down, contact drop down and contactid hidden field CaisisSelect organizationIdField = e.Row.FindControl("OrganizationEdit") as CaisisSelect; HtmlSelect contactDropDown = e.Row.FindControl("ContactNameEdit") as HtmlSelect; CaisisHidden contactIdField = e.Row.FindControl("ContactId") as CaisisHidden; // Attach change events to the dropdowns to handle respective client events string onOrgChange = "onOrgChange(this,'" + organizationIdField.ClientID + "','" + contactDropDown.ClientID + "');"; PageUtil.AttachClientEventToControl(organizationIdField as WebControl, "onchange", onOrgChange); string onContactSelChange = "copyToContactId(this,'" + contactIdField.ClientID + "');"; contactDropDown.Attributes["onchange"] = onContactSelChange; // Populate Organizations and Contacts organizationIdField.DataSource = orgList; organizationIdField.DataBind(); string orgId = DataBinder.Eval(e.Row.DataItem, "OrganizationId").ToString(); // Set selected orgid organizationIdField.Value = orgId; // Populate Contacts if (!string.IsNullOrEmpty(orgId)) { ProjectManagementDa da = new ProjectManagementDa(); DataTable contacts = da.GetAllContactsByOrgId(int.Parse(orgId)); contactDropDown.DataSource = contacts; contactDropDown.DataBind(); // Add blank item at beginning contactDropDown.Items.Insert(0, new ListItem(string.Empty, string.Empty)); // Set value of associated contact string contactId = DataBinder.Eval(e.Row.DataItem, "ContactId").ToString(); if (!string.IsNullOrEmpty(contactId)) { contactDropDown.Value = contactId; contactIdField.Value = contactId; } } } }
/// <summary> /// Populate associated organizations based on Contact Id /// <param name="contactId"></param> /// </summary> private void PopulateOrgRptr(int contactId) { // Get DataSource for Organization Display List as well as Organization Grid ProjectManagementDa projDA = new ProjectManagementDa(); DataTable displayTable = projDA.GetAllOrgsByContactId(contactId); // Bind View OrgViewList.DataSource = displayTable; OrgViewList.DataBind(); // bind contact's documents //DataView contactDocs = ContactRegulatoryDetail.GetByFieldsAsDataView<ContactRegulatoryDetail>(new Dictionary<string, object> //{ // {ContactRegulatoryDetail.ContactId, ContactId} //}); //ContactDocumentsGrid.DataSource = contactDocs; //ContactDocumentsGrid.DataBind(); }
private void PopulateStates(List <string> disStates, bool bEdit, ProjectType projType) { bEditable = bEdit; diseaseStates = disStates; ProjectManagementDa projDa = new ProjectManagementDa(); DataTable da; if (projType == ProjectType.LOI) { da = projDa.GetAllDiseaseStateCodeLOI(); } else { da = projDa.GetAllDiseaseStateCodeProjApproval(); } DiseaseStateRptr.DataSource = da; DiseaseStateRptr.DataBind(); }
protected void OnContactsOrgBind(object sender, RepeaterItemEventArgs e) { Repeater contactsRptr = sender as Repeater; Repeater singleContactsRptr = e.Item.FindControl("SingleContactsRptr") as Repeater; if (singleContactsRptr != null) { int orgId = int.Parse(DataBinder.Eval(e.Item.DataItem, ProjectOrganization.OrganizationId).ToString()); ProjectManagementDa da = new ProjectManagementDa(); DataView view; List <string> associatedContacts = new List <string>(); DataTable tmp = da.GetAllContactsByOrgId(orgId); if (tmp.Rows.Count > 0) { foreach (DataRow row in tmp.Rows) { string contactId = row[Contact.ContactId].ToString(); associatedContacts.Add(contactId); } view = da.GetProjectContactsByProjectId(projectId).DefaultView; string uniqueContacts = String.Join(",", associatedContacts.ToArray()); string rowFilter = "ContactId IN (" + uniqueContacts + ")"; view.RowFilter = rowFilter; if (view.Table.Select(rowFilter).Length == 0) { e.Item.Visible = false; } } else { e.Item.Visible = false; return; } singleContactsRptr.DataSource = view; singleContactsRptr.DataBind(); } }