Exemplo n.º 1
0
        /// <summary>
        /// 判斷product_mange的合法性 
        /// </summary>
        /// <param name="paramername"></param>
        /// <param name="parameternumber"></param>
        /// <returns></returns>
        public List<ConfigQuery> Query(string paramername, int parameternumber)
        {
            // List<ConfigQuery> lcq = new List<ConfigQuery>();
            //strSql = string.Format("select * FROM config where config_name LIKE '%" + paramername + "%';");
            //DataTable dt = _accessMySql.getDataTable(strSql);
            //if (dt != null)
            //{
            //    for (int i = 1; i < parameternumber; i++)
            //    {
            //        ConfigQuery query = new ConfigQuery();
            //        query.chaek = dt.Rows[3 * i]["config_value"].ToString();
            //        if (dt.Rows[3 * i + 1]["config_value"].ToString() != "")
            //        {
            //            query.name = dt.Rows[3 * i + 1]["config_value"].ToString();
            //        }
            //        else
            //        {
            //            if (dt.Rows[3 * i + 2]["config_value"].ToString() != "")
            //            {
            //                query.name = dt.Rows[3 * i + 2]["config_value"].ToString();
            //                query.name = query.name.Substring(0, query.name.LastIndexOf("@"));
            //            }
            //        }
            //        query.email = dt.Rows[3 * i + 2]["config_value"].ToString();
            //        lcq.Add(query);
            //    }
            //}

            List<ConfigQuery> lcq = new List<ConfigQuery>();

            string strSql = string.Format("select * from config where config_name LIKE '" + paramername + "%' order by id ;");
            DataTable dt = _accessMySql.getDataTable(strSql);
            if (dt != null)
            {
                ArrayList configNameList = new ArrayList();
                for (int i = 1; i <= parameternumber; i++)
                {
                    ConfigQuery query = new ConfigQuery();
                    string tempKeyCheck = paramername + "_chaek_" + i.ToString();
                    string tempKeyName = paramername + "_name_" + i.ToString();
                    string tempKeyEmail = paramername + "_email_" + i.ToString();


                    if (dt.Rows[3 * i - 3]["config_name"].ToString() == tempKeyCheck)
                    {
                        //check==1並且email不為空
                        if (dt.Rows[3 * i - 3]["config_value"].ToString() == "1" && !string.IsNullOrEmpty(dt.Rows[3 * i - 1]["config_value"].ToString()))
                        {
                            query.name = dt.Rows[3 * i - 2]["config_value"].ToString();
                            query.email = dt.Rows[3 * i - 1]["config_value"].ToString();
                            lcq.Add(query);
                        }
                    }

                }
            }
            return lcq;
        }
Exemplo n.º 2
0
 public System.Data.DataTable GetConfig(ConfigQuery query)
 {
     try
     {
         return _configDao.GetConfig(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ConfigMgr-->GetConfig-->" + ex.Message, ex);
     }
 }
Exemplo n.º 3
0
 public List<ConfigQuery> CheckUserName(ConfigQuery query)
 {
     try
     {
         return _configDao.CheckUserName(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ConfigMgr-->CheckUserName-->" + ex.Message, ex);
     }
 }
Exemplo n.º 4
0
 public System.Data.DataTable ConfigCheck(ConfigQuery query)
 {
     try
     {
         return _configDao.ConfigCheck(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ConfigMgr-->ConfigCheckName-->" + ex.Message, ex);
     }
 }
Exemplo n.º 5
0
 public int UpdateConfig(ConfigQuery query)
 {
     try
     {
         return _configDao.UpdateConfig(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ConfigMgr-->UpdateConfig-->" + ex.Message, ex);
     }
 }
Exemplo n.º 6
0
 public List<ConfigQuery> CheckUserName(ConfigQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("SELECT config_value FROM config where config_name = '{0}' ",query.config_name);
         return _accessMySql.getDataTableForObj<ConfigQuery>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" ConfigDao-->CheckUserName-->" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 7
0
        public List<ConfigQuery> CheckSingleConfig(ConfigQuery query)
        {

            StringBuilder sql = new StringBuilder();
            try
            {
                sql.AppendFormat("SELECT id from config where config_name like '%{0}%' AND config_value='{1}'",query.config_name,query.config_value);
                return _accessMySql.getDataTableForObj<ConfigQuery>(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception(" ConfigDao-->CheckSingleConfig-->" + ex.Message + sql.ToString(), ex);
            }
        }
Exemplo n.º 8
0
 public DataTable GetConfigByLike(ConfigQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("SELECT config_name,config_value FROM config WHERE config_name LIKE '%{0}%';", query.config_name);
         return _accessMySql.getDataTable(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" ConfigDao-->GetConfigByLike-->" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 9
0
 public DataTable ConfigCheck(ConfigQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("select config_name, config_value,config_content from config where config_name='{0}' ORDER BY config_name ASC;", query.config_name);
         return _accessMySql.getDataTable(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" ConfigDao-->ConfigCheckName-->" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 10
0
 public int UpdateConfig(ConfigQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.Append("set sql_safe_updates=0;");
         sql.AppendFormat("UPDATE config SET config_value='{0}' WHERE config_name='{1}' ;", query.config_value,query.config_name);
         sql.Append("set sql_safe_updates=1;");
         return _accessMySql.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" ConfigDao-->UpdateConfig-->" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 11
0
 public int InsertConfig(ConfigQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("INSERT INTO config (config_name,config_value,config_content) VALUES('{0}','{1}','{2}');", query.config_name, query.config_value, query.config_content);
         return _accessMySql.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" ConfigDao-->InsertConfig-->" + ex.Message + sql.ToString(), ex);
     }
 }