Beispiel #1
0
        // --------------------------------------------------------------------------------------------------
        // Helpers
        // --------------------------------------------------------------------------------------------------

        private DataTable SelectComboDropdown(UiComboField uiComboField)
        {
            if (uiComboField != null)
            {
                CiComboField ciComboField = uiComboField.CiField as CiComboField;
                if (ciComboField != null)
                {
                    string sql = ciComboField.DropdownSQL;
                    if (!MyUtils.IsEmpty(sql))
                    {
                        DataRow   drParams = uiComboField.GetState();
                        DataTable dt       = MyWebUtils.GetBySQL(sql, drParams);

                        if (dt != null)
                        {
                            // Add a blank row, otherwise exception is sometimes thrown in grid view
                            dt.Rows.InsertAt(dt.NewRow(), 0);
                        }

                        return(dt);
                    }
                    else
                    {
                        return(MyWebUtils.ToDataTable(ciComboField.DataSource.OuterXml));
                    }
                }
            }

            return(null);
        }
Beispiel #2
0
        public static string GetDatabaseName(DataRow drAppKey)
        {
            DataTable dt = MyWebUtils.GetBySQL("?exec spApplication_sel @AppID", drAppKey, 0);

            if (dt != null && dt.Columns.Contains("SQLDatabaseName") && MyWebUtils.GetNumberOfRows(dt) > 0)
            {
                object objAppName = dt.Rows[0]["SQLDatabaseName"];

                if (objAppName != null)
                {
                    return(objAppName.ToString());
                }
            }

            return(null);
        }
Beispiel #3
0
        public static DataRow GetTableDetails(int appID, int tableID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("AppID").DefaultValue   = appID;
            dt.Columns.Add("TableID").DefaultValue = tableID;

            DataRow dr = dt.NewRow();

            dt.Rows.Add(dr);

            DataTable dtResults = MyWebUtils.GetBySQL("?exec spTable_sel @AppID, @TableID", dr, 0);

            if (MyWebUtils.GetNumberOfRows(dtResults) > 0)
            {
                return(dtResults.Rows[0]);
            }

            return(null);
        }
Beispiel #4
0
        public static DataRow GetTableDetails(string tableName)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Application").DefaultValue = Application;
            dt.Columns.Add("Table").DefaultValue       = tableName;

            DataRow dr = dt.NewRow();

            dt.Rows.Add(dr);

            DataTable dtResults = MyWebUtils.GetBySQL("?exec spTable_selByName @Application, @Table", dr, 0);

            if (MyWebUtils.GetNumberOfRows(dtResults) > 0)
            {
                return(dtResults.Rows[0]);
            }

            return(null);
        }
Beispiel #5
0
        private DataTable SelectRadioDropdown(UiRadioField uiRadioField)
        {
            if (uiRadioField != null)
            {
                CiRadioField ciRadioField = uiRadioField.CiField as CiRadioField;
                if (ciRadioField != null)
                {
                    string sql = ciRadioField.DropdownSQL;
                    if (!MyUtils.IsEmpty(sql))
                    {
                        DataRow   drParams = uiRadioField.GetState();
                        DataTable dt       = MyWebUtils.GetBySQL(sql, drParams);

                        return(dt);
                    }
                    else
                    {
                        return(MyWebUtils.ToDataTable(ciRadioField.DataSource.OuterXml));
                    }
                }
            }

            return(null);
        }