Пример #1
0
 /// <summary>
 /// Adds a grid based on the current table name
 /// </summary>
 /// <param name="tableName"></param>
 public virtual void BuildLayout(string tableName)
 {
     // validate table
     if (BusinessObjectFactory.CanBuildBusinessObject(tableName))
     {
         // get config
         Caisis.Controller.PatientDataEntryController pdec = new Caisis.Controller.PatientDataEntryController();
         int totalBlankRows        = pdec.GetTotalBlankGridRows(tableName);
         int totalVisibleBlankRows = pdec.GetVisibleBlankGridRows(tableName);
         var tableFieldsMetadata   = pdec.GetTableFieldsMetadata(tableName);
         BuildLayout(tableName, totalBlankRows, totalVisibleBlankRows, tableFieldsMetadata);
     }
 }
Пример #2
0
        /// <summary>
        /// Loads the data entry interface by type (grid or standard layout)
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="container"></param>
        /// <param name="controls"></param>
        private void LoadDataEntryControl(string tableName, Control container, IEnumerable <ICaisisInputControl> controls)
        {
            // @PatientId lookup FIX: don't use session patient
            var lkpControls = from lkp in controls.OfType <ICaisisLookupControl>()
                              where
                              (!string.IsNullOrEmpty(lkp.LookupCode) && lkp.LookupCode.Contains("@PatientId"))
                              ||
                              (!string.IsNullOrEmpty(lkp.LookupDistinct) && lkp.LookupDistinct.Contains("@PatientId"))
                              select lkp;

            foreach (var lkpControl in lkpControls)
            {
                lkpControl.LookupCode     = string.Empty;
                lkpControl.LookupDistinct = string.Empty;
            }

            // build grid table
            bool isGrid = _dataEntryController.IsGridView(tableName);

            if (isGrid)
            {
                int blankRows           = _dataEntryController.GetTotalBlankGridRows(tableName);
                int totalBlankRows      = _dataEntryController.GetVisibleBlankGridRows(tableName);
                var tableFieldsMetadata = _dataEntryController.GetTableFieldsMetadata(tableName);

                GridDataEntry con = LoadControl("~/Core/DataEntryForms/DataEntryControls/GridDataEntry.ascx") as GridDataEntry;
                container.Controls.Add(con);
                con.BuildLayout(tableName, blankRows, totalBlankRows, tableFieldsMetadata);
            }
            // build column layout
            else
            {
                int             colCount           = _dataEntryController.GetNumDisplayColumns(tableName);
                var             commonDataElements = _dataEntryController.GetCommonDataElements(tableName);
                ColumnDataEntry con = LoadControl("~/Core/DataEntryForms/DataEntryControls/ColumnDataEntry.ascx") as ColumnDataEntry;
                con.SetControlIcon = SetControlMetaData;
                con.BuildControl  += new CaisisEventHandler(SetControlToolTip);
                container.Controls.Add(con);
                con.BuildLayout(controls, colCount, commonDataElements);
            }
        }