/// <summary> /// Load organizations to the select box /// </summary> private void LoadOrganizationsList() { ProjectManagementDa projDA = new ProjectManagementDa(); ContactProjOrgName.DataSource = projDA.GetAllUnassociatedOrgsByContact(contactId).DefaultView;; ContactProjOrgName.DataBind(); }
/// <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(); }
/// <summary> /// When grid is bound, bind organization select in footer row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleOrgBound(object sender, EventArgs e) { ProjectManagementDa projDA = new ProjectManagementDa(); //ProjectOrganization biz = new ProjectOrganization(); //biz.GetAll(); DataView view = projDA.GetAllOrgsByContactId(contactId).DefaultView; DataView notAssociates = projDA.GetAllUnassociatedOrgsByContact(contactId).DefaultView; // After Grid has been bound, locate OrgSelects and bind to unassociates organizations int blankStart = OrgGrid2.Rows.Count - notAssociates.Count; for (int i = 0; i < OrgGrid2.Rows.Count; i++) { GridViewRow row = OrgGrid2.Rows[i]; CaisisSelect OrgSel = row.FindControl("OrgSel") as CaisisSelect; //CaisisComboBox OrgRoleBlank = row.FindControl("OrgRoleBlank") as CaisisComboBox; CaisisComboBox CaisisComboOrgRole = row.FindControl("CaisisComboOrgRole") as CaisisComboBox; ImageButton OrgDelBtn = row.FindControl("OrgDelBtn") as ImageButton; // Hide delete button from blank rows if (i >= blankStart) { OrgDelBtn.Visible = false; } //OrgSel.DataSource = biz.DataSourceView;//view; OrgSel.DataSource = BusinessObject.GetAllAsDataView <ProjectOrganization>(); OrgSel.DataBind(); // Extract organization ID from grid keys string orgId = OrgGrid2.DataKeys[i][ProjectOrganization_ProjectContact.OrganizationId].ToString();; OrgSel.Value = orgId; if (!string.IsNullOrEmpty(orgId)) { OrgSel.Enabled = false; } } }