Exemplo n.º 1
0
        /// <summary>
        /// get query script
        /// </summary>
        /// <param name="config"></param>
        /// <param name="configType"></param>
        /// <param name="isLogGet"></param>
        /// <param name="topCount"></param>
        /// <param name="sortdirection"></param>
        /// <returns></returns>
        public static string TBLQueryGet(ConfigurationSettingDataTbl config
                                         , ConfigSettingType configType
                                         , bool isLogGet
                                         , int topCount = 0
                                         , CommonEnum.SortDirection sortdirection = CommonEnum.SortDirection.None)
        {
            string topStr = string.Empty;

            if (topCount > 0)
            {
                topStr = "top " + topCount;
            }
            string orderBy = string.Empty;

            if (sortdirection == CommonEnum.SortDirection.ASC)
            {
                orderBy = "order by 1 asc";
            }
            else if (sortdirection == CommonEnum.SortDirection.DESC)
            {
                orderBy = "order by 1 desc";
            }

            string tblName = (isLogGet) ? ConfigSettingHelper.ConfigLogTableNameGet(configType) : ConfigSettingHelper.ConfigTableNameGet(configType);

            string where = TBLQueryGetWhere(config, configType);
            return(string.Format("select {0} * from {1} {2} {3} ", topStr, tblName, where, orderBy));
        }
Exemplo n.º 2
0
        /// <summary>
        /// get all configutaion entity list
        /// </summary>
        /// <param name="isLogGet"></param>
        /// <param name="defaultNullValue"></param>
        /// <returns></returns>
        public List <ConfigurationSettingDataTbl> CSDTblsGetAll(bool isLogGet = false, string defaultNullValue = null)
        {
            string tblName = (isLogGet) ? ConfigSettingHelper.ConfigLogTableNameGet(this.ConfigurationType) : ConfigSettingHelper.ConfigTableNameGet(this.ConfigurationType);
            string query   = string.Format("select * from {0}", tblName);

            return(CSDTblsGet(query, this.ConnectionString, ConfigurationIDNameGet(isLogGet), defaultNullValue));
        }