Esempio n. 1
0
        /// <summary>
        /// Builds a grid populated with the current LkpFieldName
        /// </summary>
        /// <param name="lkpField"></param>
        private bool BuildLookupCodeList(string lkpField)
        {
            InitParamaters();

            LookupCodeDa da       = new LookupCodeDa();
            var          lkpCodes = LookupCode.GetByFieldsAsDataView <LookupCode>(new Dictionary <string, object>
            {
                { LookupCode.LkpFieldName, lkpField }
            });
            // sort by, then alpha numeric
            DataColumn sortCol  = new DataColumn("_Sort", typeof(int), "ISNULL(LkpOrder," + int.MaxValue + ")");
            DataColumn sortCol2 = new DataColumn("_Sort2", typeof(int), "ISNULL(LookupCodeId," + int.MaxValue + ") - ISNULL(LookupCodeId," + int.MaxValue + " - 1)");

            lkpCodes.Table.Columns.Add(sortCol);
            lkpCodes.Table.Columns.Add(sortCol2);
            lkpCodes.Sort = "_Sort ASC, _Sort2 ASC, " + LookupCode.LkpCode + " ASC";
            // build main lookup code list

            LookupCodeGrid.DataSource = lkpCodes;
            LookupCodeGrid.DataBind();

            DataSet   ds = da.GetLookupCodeStats(lkpField, _diseaseName);
            DataTable lookupByMetadata   = ds.Tables[0];
            int       lookupCodeCount    = (int)ds.Tables[1].Rows[0][0];
            int       lookupDiseaseCount = (int)ds.Tables[2].Rows[0][0];

            BuildLkpStats(lookupByMetadata, lookupDiseaseCount, lookupCodeCount);

            return(lookupCodeCount > 0);
        }
Esempio n. 2
0
        protected void BindLookupCodesGrid()
        {
            string selectedFieldName = fieldName.SelectedValue;

            if (!string.IsNullOrEmpty(selectedFieldName))
            {
                LookupCodeDa lkpDa = new LookupCodeDa();
                DataSet      lkpDs = lkpDa.GetLookupsByFieldName(selectedFieldName);
                DataView     view  = lkpDs.Tables[0].DefaultView;
                // Add empty rows
                for (int i = 0; i < BLANK_LOOKUPCODE_ROWS; i++)
                {
                    view.AddNew();
                }
                LookupCodeGrid.DataSource = view;
                LookupCodeGrid.DataBind();
            }
        }