Esempio n. 1
0
        private static SortedList <string, IEnumerable> GetAllADConfigValueFromDataBase()
        {
            ADConfigValuesController objConfigValuesController = new ADConfigValuesController();
            DataSet ds = objConfigValuesController.GetAllObjects();
            List <ADConfigValuesInfo> configValueList = new List <ADConfigValuesInfo>();

            if (ds.Tables.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    ADConfigValuesInfo objConfigValuesInfo = (ADConfigValuesInfo)objConfigValuesController.GetObjectFromDataRow(row);
                    configValueList.Add(objConfigValuesInfo);
                }
            }
            SortedList <string, IEnumerable> result = new SortedList <string, IEnumerable>();

            if (configValueList.Count() == 0)
            {
                return(result);
            }

            var group = configValueList.GroupBy(o => o.ADConfigKeyGroup).OrderBy(o => o.Key);

            foreach (var item in group)
            {
                result.Add(item.Key, group.SelectMany(o => o.Where(o1 => o1.ADConfigKeyGroup == item.Key).OrderBy(o1 => o1.ADConfigKeySortOrder)));
            }
            return(result);
        }
Esempio n. 2
0
        public object GetValueByConfigKey(string configKey)
        {
            ADConfigValuesInfo configValue = GetObjectByConfigKey(configKey);

            if (configKey != null)
            {
                return(configValue.ADConfigKeyValue);
            }
            return(null);
        }
Esempio n. 3
0
        public ADConfigValuesInfo GetObjectByGroupAndValue(string group, string value)
        {
            DataSet ds = dal.GetDataSet("ADConfigValues_GetObjectByGroupAndValue", group, value);

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ADConfigValuesInfo objConfigValuesInfo = (ADConfigValuesInfo)dal.GetObjectFromDataRow(ds.Tables[0].Rows[0]);
                ds.Dispose();
                return(objConfigValuesInfo);
            }
            return(null);
        }
Esempio n. 4
0
        public ADConfigValuesInfo GetObjectByConfigKey(String configKey)
        {
            String  sql = String.Format("SELECT * FROM ADConfigValues WHERE AAStatus = 'Alive' AND ADConfigKey = N'{0}'", configKey);
            DataSet ds  = dal.GetDataSet(sql);

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ADConfigValuesInfo objConfigValuesInfo = (ADConfigValuesInfo)dal.GetObjectFromDataRow(ds.Tables[0].Rows[0]);
                ds.Dispose();
                return(objConfigValuesInfo);
            }
            return(null);
        }