コード例 #1
0
        // 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();
            }
        }
コード例 #2
0
 private void BindDropDownList(CaisisSelect dropdown, DataTable dt, string textField, string valueField, string selectedVal)
 {
     dropdown.DataSource     = dt;
     dropdown.DataTextField  = textField;
     dropdown.DataValueField = valueField;
     dropdown.DataBind();
     dropdown.Value = selectedVal;
 }
コード例 #3
0
        private void AddEntryField(ICaisisInputControl control)
        {
            // TODO: handle control.Required
            if (control.Required)
            {
                controlsToValidate.Add(control as Control);
            }

            // TODO: styles and other whatnots
            Panel panel = new Panel();

            panel.CssClass = "DataEntryRow";
            panel.Controls.Add((Control)control);

            // Special Cases
            if ((MatchProtocol("c12-097") || MatchProtocol("c10-070")) && control.Table == "Status" && control.Field == "Status" && control is ListControl)
            {
                ListControl listControl = control as ListControl;
                listControl.PreRender += (a, b) =>
                {
                    listControl.DataTextField  = "";
                    listControl.DataValueField = "";
                    listControl.DataSource     = PATIENT_STATUSES;
                    listControl.DataBind();
                };
            }
            else if (MatchProtocol("c12-108") && control.Table == "Categories" && control.Field == "Category" && control is ICaisisLookupControl)
            {
                // build static data
                string[]  values    = new string[] { "Positive", "Negative" };
                DataTable comboData = new DataTable();
                comboData.Columns.Add(new DataColumn("Category"));
                foreach (string value in values)
                {
                    comboData.Rows.Add(value);
                }
                CaisisComboBox combo  = control as CaisisComboBox;
                CaisisSelect   select = control as CaisisSelect;
                if (combo != null)
                {
                    combo.BuildComboData(comboData, "Category", "Category");
                }
                else if (select != null)
                {
                    select.PreRender += (a, b) =>
                    {
                        select.DataTextField  = "Category";
                        select.DataValueField = "Category";
                        select.DataSource     = comboData;
                        select.DataBind();
                    };
                }
            }

            container.Controls.Add(panel);
        }
コード例 #4
0
        /// <summary>
        /// Builds a list of available input control types
        /// </summary>
        /// <param name="controlTypeSelect"></param>
        private void SetInputControlTypeDropDown(CaisisSelect controlTypeSelect)
        {
            var cicTypeList = from cic in ReflectionManager.GetMetaInputControlNames()
                              // temp, centralize
                              where cic.IndexOf("Eform", 0, StringComparison.OrdinalIgnoreCase) < 0
                              orderby cic ascending
                              select cic;

            controlTypeSelect.DataSource = cicTypeList;
            controlTypeSelect.DataBind();
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetLabelState(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // determine if in edit of readonly mode
                bool isEdit = BtnSave.Visible;

                CaisisSelect orgs = e.Item.FindControl("OrgSel") as CaisisSelect;
                orgs.DataSource = AllOrganizations;
                orgs.DataBind();

                CaisisSelect contacts = e.Item.FindControl("ContactSel") as CaisisSelect;
                contacts.DataSource = AllContacts;
                contacts.DataBind();

                string priKeyValue = DataBinder.Eval(e.Item.DataItem, ProjectCommunicationLog.CommunicationLogId).ToString();
                // populate fields
                foreach (ICaisisInputControl icic in PageUtil.GetCaisisInputControlsInContainer(e.Item))
                {
                    icic.Value = DataBinder.Eval(e.Item.DataItem, icic.Field).ToString();
                    // show control in edit mode
                    icic.Visible = isEdit;
                    // if control has associated label, show/hide by mdoe
                    Label readOnlyLabel = e.Item.FindControl(icic.Field + "Label") as Label;
                    if (readOnlyLabel != null)
                    {
                        // special cases
                        if (icic.Field == ProjectCommunicationLog.OrganizationId)
                        {
                            readOnlyLabel.Text = GetOrganizationName(icic.Value);
                        }
                        else if (icic.Field == ProjectCommunicationLog.ContactId)
                        {
                            readOnlyLabel.Text = GetContactName(icic.Value);
                        }
                        else
                        {
                            readOnlyLabel.Text = icic.Value;
                        }
                        readOnlyLabel.Visible = !isEdit;
                    }
                }

                // finally set delete button
                ImageButton deleteBtn = e.Item.FindControl("DeleteBtn") as ImageButton;
                // only show edit button when pri key exists and in edit mode
                deleteBtn.Visible = isEdit && !string.IsNullOrEmpty(priKeyValue);
            }
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="container"></param>
        /// <param name="attributeName"></param>
        /// <param name="attributeValueTable"></param>
        /// <param name="attributeValueOptions"></param>
        private void DynamicallyAddAttribute(Control container, string attributeName, string attributeValueTable, IEnumerable <string> attributeValueOptions)
        {
            HtmlGenericControl attributeWrapper         = new HtmlGenericControl("div");
            Label               attributeValueLabel     = new Label();
            CaisisHidden        valueIdField            = new CaisisHidden();
            CaisisHidden        diseaseAttributeValueId = new CaisisHidden();
            ICaisisInputControl attributeValue;

            // if attribute options assigned, build options
            if (attributeValueOptions.Count() > 0)
            {
                CaisisSelect attributeValuesInput = new CaisisSelect();
                attributeValue = attributeValuesInput;
                attributeValuesInput.DataSource = attributeValueOptions;
                attributeValuesInput.DataBind();
            }
            else
            {
                attributeValue = new CaisisTextBox();
            }
            attributeWrapper.Attributes["class"] = "attributeFieldWrapper";

            attributeValueLabel.ID   = attributeName + "_Label";
            attributeValueLabel.Text = attributeName;

            valueIdField.ID    = attributeName + "_ValueId";
            valueIdField.Table = attributeValueTable;
            valueIdField.Field = attributeName;

            diseaseAttributeValueId.ID    = attributeName + "_DiseaseAttributeValueId";
            diseaseAttributeValueId.Table = "DiseaseAttributeValues";
            diseaseAttributeValueId.Field = attributeName;

            Control inputAttributeValue = attributeValue as Control;

            inputAttributeValue.ID   = attributeName;
            attributeValue.ShowLabel = false;
            attributeValue.Table     = attributeValueTable;
            attributeValue.Field     = attributeName;
            attributeValueLabel.AssociatedControlID = inputAttributeValue.ID;

            container.Controls.Add(attributeWrapper);
            attributeWrapper.Controls.Add(attributeValueLabel);
            attributeWrapper.Controls.Add(valueIdField);
            attributeWrapper.Controls.Add(diseaseAttributeValueId);
            attributeWrapper.Controls.Add(inputAttributeValue);
        }
コード例 #7
0
ファイル: Dataset_Edit.aspx.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Builds a list of available dimensions
        /// </summary>
        private void BuildDimensions()
        {
            // dynamically build dimensions (generic)
            var dropDowns = GetDimensionsDropDown();

            foreach (var dropDown in dropDowns)
            {
                string       table             = dropDown.Key;
                CaisisSelect dimensionDropDown = dropDown.Value;
                // get all items, sort and build drop down
                DataView dimensionsDataSource = BOL.BusinessObject.GetAllAsDataView(table);
                string   sortField            = dimensionDropDown.DataTextField;
                dimensionsDataSource.Sort = sortField + " ASC";
                // build list of dimension values
                dimensionDropDown.DataSource = dimensionsDataSource;
                dimensionDropDown.DataBind();
            }
        }
コード例 #8
0
        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;
                    }
                }
            }
        }
コード例 #9
0
        private void BuildImgCompared(Control container, int?diagnosticId)
        {
            CaisisSelect imgCompared = FindInputControl(container, Diagnostic.ImgCompared) as CaisisSelect;

            if (imgCompared != null)
            {
                int patientId       = int.Parse(BaseDecryptedPatientId);
                var allDiagnostics  = new DiagnosticDa().GetDiagnosticsByType(patientId, ImageTypes).DefaultView;
                var prevDiagnostics = from diagnostic in allDiagnostics.Table.AsEnumerable()
                                      let rowDiagnosticId = (int)diagnostic[Diagnostic.DiagnosticId]
                                                            let dxType = diagnostic[Diagnostic.DxType]
                                                                         let dxDate = diagnostic[Diagnostic.DxDate]
                                                                                      // exclude current ?
                                                                                      where !diagnosticId.HasValue || diagnosticId.Value != rowDiagnosticId
                                                                                      // display text as "Bone Scan 01/26/2010" and value = diag id
                                                                                      let displayText = string.Format("{0} {1:d}", dxType, dxDate)
                                                                                                        let sortDate = !diagnostic.IsNull(Diagnostic.DxDate) ? (DateTime)dxDate : DateTime.MaxValue
                                                                                                                       orderby sortDate ascending
                                                                                                                       select new
                {
                    DiagnosticText = displayText,
                    DiagnosticId   = rowDiagnosticId
                };
                // build dropdown
                imgCompared.DataSource = prevDiagnostics;
                imgCompared.DataBind();
                // SPECIAL CASE:  for current diagnostic, check if there is a related record, used as compare to for follow up scans
                if (diagnosticId.HasValue)
                {
                    // get related diagnostic id
                    var relatedDiagnostics = Caisis.Controller.RelatedRecordController.GetRelatedRecords("Diagnostics", diagnosticId.Value, "Diagnostics");
                    // set related diagnostic
                    if (relatedDiagnostics.Count() > 0)
                    {
                        int relatedDiagnosticId = (int)relatedDiagnostics.First()[RelatedRecord.DestPrimaryKey];
                        PageUtil.SelectDropDownItem(imgCompared, relatedDiagnosticId.ToString());
                    }
                }
            }
        }
コード例 #10
0
        /// <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;
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Sets the data source for organization dropdown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetOrgDropDown(object sender, GridViewRowEventArgs e)
        {
            int          rowIndex    = e.Row.RowIndex;
            CaisisSelect orgDropDown = e.Row.FindControl("OrganizationDropDown") as CaisisSelect;

            if (rowIndex > -1 && orgDropDown != null)
            {
                DataView dropDownView;
                // Blank row drop down should only contain those unassociated orgs
                if (AssociatedOrgsGrid.BlankRowIndexes.Contains(rowIndex))
                {
                    dropDownView = unAssociatedOrgs;
                }
                // Existing records should bind to existing orgs in project
                // and should be disabled, not allowing organization to be changed
                else
                {
                    dropDownView        = associatedOrgs;
                    orgDropDown.Enabled = false;
                }
                orgDropDown.DataSource = dropDownView;
                orgDropDown.DataBind();
            }
        }
コード例 #12
0
        protected void SetAttributionFields(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int    rowIndex         = e.Row.DataItemIndex;
                string toxAttributionId = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttributionId).ToString();
                string toxAttribution   = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttribution_Field).ToString();

                // data bind attributions
                CaisisSelect attributionField = e.Row.FindControl("ToxAttributionField") as CaisisSelect;
                attributionField.DataSource = protocolMedTxAgents;
                attributionField.DataBind();
                // set values based on index
                if (string.IsNullOrEmpty(toxAttributionId) && rowIndex < protocolMedTxAgents.Length)
                {
                    string defaultValue = protocolMedTxAgents[rowIndex];
                    attributionField.Value = defaultValue;
                }
                else
                {
                    attributionField.Value = toxAttribution;
                }
            }
        }
コード例 #13
0
        protected void SetEformFields(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex > -1)
            {
                int    patientId                 = (int)DataBinder.Eval(e.Item.DataItem, Patient.PatientId);
                string mrn                       = DataBinder.Eval(e.Item.DataItem, Patient.PtMRN).ToString();
                string name                      = DataBinder.Eval(e.Item.DataItem, "Name").ToString().Replace(",", ", ");
                string currentStatus             = DataBinder.Eval(e.Item.DataItem, "CurrentStatus").ToString();
                string currentEFormApptPhysician = DataBinder.Eval(e.Item.DataItem, "EFormApptPhysician").ToString();

                CaisisSelect statusList = e.Item.FindControl("StatusField") as CaisisSelect;
                CaisisSelect EFormApptPhysicianField = e.Item.FindControl("EFormApptPhysicianField") as CaisisSelect;

                Label mrnLabel = e.Item.FindControl("PtMRN") as Label;
                Label ptLabel  = e.Item.FindControl("PtLabel") as Label;

                statusList.DataSource = EFormStatuses; // EformStatusManager.GetEformStatuses();
                statusList.DataBind();

                statusList.Value = currentStatus;


                //AppointmentDa aptDa = new AppointmentDa();
                //EFormApptPhysicianField.DataSource = aptDa.GetDistinctAppointmentPhysicians().Tables[0].DefaultView;
                //EFormApptPhysicianField.DataTextField = "ApptPhysician";
                //EFormApptPhysicianField.DataValueField = "ApptPhysician";

                //EFormApptPhysicianField.DataBind();
                EFormApptPhysicianField.Value = currentEFormApptPhysician;

                if (DataBinder.Eval(e.Item.DataItem, "EFormApptTime").ToString().Length > 0)
                {
                    CaisisTextBox EFormApptTimeField = e.Item.FindControl("EFormApptTimeField") as CaisisTextBox;
                    EFormApptTimeField.Value = ((DateTime)(DataBinder.Eval(e.Item.DataItem, "EFormApptTime"))).ToShortDateString();
                }


                // set identified fields
                mrnLabel.Text = pc.GetPatientMRN(mrn);
                ptLabel.Text  = canViewIdentifiers ? name : pc.GetPatientName(" ", " ", true);

                // set identifier
                string selectedIdType    = IdTypeSelection.Value + "";
                bool   displayIdentifier = selectedIdType != PatientController.LAST_NAME_MRN_IDENTIFIER;
                Label  idTypeLabel       = e.Item.FindControl("IdType") as Label;
                Label  idValueLabel      = e.Item.FindControl("IdTypeValue") as Label;

                if (displayIdentifier)
                {
                    idTypeLabel.Text     = selectedIdType + ":";
                    idValueLabel.Text    = pc.GetPatientIdentifier(patientId, selectedIdType);
                    idTypeLabel.Visible  = true;
                    idValueLabel.Visible = true;
                }
                else
                {
                    idTypeLabel.Visible  = false;
                    idValueLabel.Visible = false;
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// During databinding, dynamically insert ICaisisInputControls into placeholder
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BuildControlsAndLabel(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                EformField field = (EformField)e.Item.DataItem;
                // supress DATE FIELDS
                if (field.Field.EndsWith("Date"))
                {
                    e.Item.Visible = false;
                }
                else
                {
                    ICaisisInputControl iCIC = CICHelper.InvokeInputControl(field.ControlType);

                    if (iCIC is CaisisTextArea)
                    {
                        iCIC = new CaisisTextBox();
                        (iCIC as CaisisTextBox).ShowTextEditor = true;
                    }
                    iCIC.ShowLabel = false;
                    iCIC.Table     = field.Table;
                    iCIC.Field     = field.Field;
                    PlaceHolder dynamicHolder = e.Item.FindControl("DynamicControlPlaceHolder") as PlaceHolder;
                    dynamicHolder.Controls.Add(iCIC as Control);

                    if (!(iCIC is CaisisHidden))
                    {
                        CICHelper.SetStaticFieldAttributes(dynamicHolder.Controls, field.Table);
                    }

                    // FIX?? needs to be centralized
                    if (iCIC is CaisisSelect)
                    {
                        CaisisSelect cs         = iCIC as CaisisSelect;
                        string       lookupCode = cs.LookupCode;
                        if (!string.IsNullOrEmpty(cs.LookupDistinct) && cs.LookupDistinct.IndexOf(SessionKey.PatientId) > -1)
                        {
                            if (Session[SessionKey.PatientId] != null | Session[SessionKey.PatientId].ToString() != string.Empty)
                            {
                                CICHelper.HandleLookupDistinctAttribute(cs, cs.LookupDistinct, this.Page.Session);
                                this.EnableViewState = true;
                            }
                        }
                        else if (lookupCode != null && lookupCode.Length > 0)
                        {
                            cs.DataSource     = CacheManager.GetLookupCodeList(lookupCode).DefaultView;
                            cs.DataTextField  = "LkpCode";
                            cs.DataValueField = "LkpCode";
                            cs.DataBind();
                        }
                    }

                    if (Caisis.BOL.BusinessObject.HasLabel(field.Table, field.Field))
                    {
                        iCIC.FieldLabel = Caisis.BOL.BusinessObject.GetLabel(field.Table, field.Field);
                    }
                    else
                    {
                        iCIC.FieldLabel = field.Field;
                    }
                    Label fieldLabel = e.Item.FindControl("FieldLabel") as Label;
                    fieldLabel.Text = iCIC.FieldLabel;
                    if (BusinessObject.IsRequired(iCIC.Table, iCIC.Field))
                    {
                        fieldLabel.CssClass = fieldLabel.CssClass + " RequiredField";
                        fieldLabel.ToolTip  = "Required Field";
                    }

                    if (iCIC is CaisisTextBox)
                    {
                        //(iCIC as CaisisTextBox).ShowCalendar = false;
                    }
                }
            }
        }