示例#1
0
        /// <summary>
        /// Returns the displayable column value for the current related record table. (i.e., Procedures=ProcName)
        /// </summary>
        /// <param name="dataItem"></param>
        /// <param name="tableName"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        protected string GetDisplayColumn(object dataItem, string tableName, string fieldName)
        {
            string fieldValue = string.Empty;

            if (!string.IsNullOrEmpty(fieldName))
            {
                fieldValue = DataBinder.Eval(dataItem, fieldName).ToString();
            }
            return(!string.IsNullOrEmpty(fieldValue) ? fieldValue : "[" + pdec.GetTableLabel(tableName) + "]");
        }
示例#2
0
 private string ConvertTableNameToMenuName(string tableName)
 {
     //XmlNode node = _currentNode.ParentNode.SelectSingleNode("//menuItem[@tableName='" + tableName.Trim() + "']");
     //string menuName = "";
     //if(node != null)
     //{
     //    menuName = node.Attributes["menuTitle"].Value;
     //}
     //return menuName;
     return(_dataEntryController.GetTableLabel(tableName));
 }
示例#3
0
        /// <summary>
        /// Sets the display label for the related record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetRelatedDisplayLabel(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label displayLabel = e.Item.FindControl("DisplayLabel") as Label;
                // i.e., Toxicities
                string tableName = ((DataRowView)e.Item.DataItem)[RelatedRecord.SrcTableName].ToString();
                // i.e., ToxicityId
                int tablePriKey = (int)((DataRowView)e.Item.DataItem)[RelatedRecord.SrcPrimaryKey];
                // i.e., ToxName value or empty if no metadata defined
                string tableField = ((DataRowView)e.Item.DataItem)["SrcTableField"].ToString();
                // i.e., ToxDate formatted or empty
                string tableSortField = string.Format("{0:d}", ((DataRowView)e.Item.DataItem)["SrcTableSortField"]);
                // i.e., 0 = unrelated
                string relationStrength = ((DataRowView)e.Item.DataItem)[RelatedRecord.RelationStrength].ToString();
                // i.e. Toxicity
                string tableLabel = pdec.GetTableLabel(tableName);

                // format display text if metadata defined
                string displayValue = !string.IsNullOrEmpty(tableField) ? tableField : "[" + tableLabel + "]" + (!string.IsNullOrEmpty(tableSortField) ? " (" + tableSortField + ")" : "");
                displayLabel.Text = displayValue;
            }
        }
        private void BuildTableData(int patientItemId)
        {
            string tableName       = service.GetTableName();
            string tablePriKeyName = service.GetPriKeyName();
            IEnumerable <string> display_fields = service.GetFieldNames();
            DataView             view           = new DataView();

            int pageNum       = PageNumber;
            int start_row_num = GetStart(pageNum);
            int end_row_num   = GetEnd(pageNum);

            // build pager
            //int count = service.GetVisitRelatedRecordsCount();
            //BuildPages(count);

            DataTable table = service.GetVisitRelatedRecords(start_row_num, end_row_num);

            // clear columns, except special columns
            while (TableValues.Columns.Count > 1)
            {
                TableValues.Columns.RemoveAt(1);
            }

            //string[] display_columns = new string[] { "TableName" }.Concat(display_fields).Distinct().ToArray();
            // get display fields, flatted date fields
            string[] display_columns = display_fields.Except(from field in display_fields
                                                             where field.EndsWith("DateText") || field.EndsWith("Source") || field.EndsWith("Quality")
                                                             select field).ToArray();

            // add table value fields
            for (int i = 0; i < display_columns.Length; i++)
            {
                string     fieldName = display_columns[i];
                BoundField bf        = new BoundField();
                bf.DataField  = fieldName;
                bf.HeaderText = fieldName == "TableName" ? "Table" : pdec.GetFieldLabel(tableName, fieldName);
                if (fieldName.EndsWith("Date"))
                {
                    bf.DataFormatString = "{0:d}";
                }
                TableValues.Columns.Add(bf);
            }

            updateRowsIndexes.Clear();

            view = table.DefaultView;

            // build header
            TableHeaderRptr.DataSource = TableValues.Columns.Cast <DataControlField>().Select(c => c.HeaderText).ToArray();
            TableHeaderRptr.DataBind();

            // build data
            TableValues.DataKeyNames = new string[] { "TableName", tablePriKeyName };
            TableValues.DataSource   = view;
            TableValues.DataBind();

            RecordCount.Text = view.Count + " Record(s)";

            if (view.Count == 0)
            {
                Message.Text            = "There are no " + (!string.IsNullOrEmpty(tableName) ? pdec.GetTableLabel(tableName) : "") + " records for this Patient.";
                Message.Visible         = true;
                TableHeaderRptr.Visible = false;
                TableValues.Visible     = false;
                UpdateBtn.Visible       = false;
            }
            else
            {
                Message.Visible         = false;
                TableHeaderRptr.Visible = true;
                TableValues.Visible     = true;
                UpdateBtn.Visible       = true;
            }
        }
示例#5
0
 /// <summary>
 /// Returns the friendly table label
 /// </summary>
 /// <param name="table"></param>
 /// <returns></returns>
 protected string GetTableLabel(string table)
 {
     return(pdec.GetTableLabel(table));
 }