コード例 #1
0
ファイル: orders.cs プロジェクト: deerlion/DarrenSoft
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string order_no)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "orders");
            strSql.Append(" where order_no=@order_no ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@order_no", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = order_no;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #2
0
ファイル: manager.cs プロジェクト: deerlion/DarrenSoft
        /// <summary>
        /// 查询用户名是否存在
        /// </summary>
        public bool Exists(string user_name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "manager");
            strSql.Append(" where user_name=@user_name ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@user_name", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = user_name;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #3
0
ファイル: navigation.cs プロジェクト: ganmkTrue/DTcmsForMySql
        /// <summary>
        /// 查询是否存在该记录
        /// </summary>
        public bool Exists(string nav_name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "navigation");
            strSql.Append(" where name=@nav_name ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@nav_name", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = nav_name;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #4
0
        /// <summary>
        /// 查询生成目录名是否存在
        /// </summary>
        public bool Exists(string build_path)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "sites");
            strSql.Append(" where build_path=@build_path ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@build_path", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = build_path;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #5
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string call_index)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(0) from " + databaseprefix + "mail_template");
            strSql.Append(" where call_index=@call_index ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@call_index", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = call_index;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #6
0
ファイル: article.cs プロジェクト: ganmkTrue/DTcmsForMySql
        /// <summary>
        /// 是否存在标题
        /// </summary>
        public bool ExistsTitle(string channel_name, string title)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + DTKeys.TABLE_CHANNEL_ARTICLE + channel_name);
            strSql.Append(" where title=@title");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@title", MySqlDbType.VarChar, 200)
            };
            parameters[0].Value = title;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #7
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string title)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "article_tags");
            strSql.Append(" where title=@title");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@title", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = title;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #8
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from  " + databaseprefix + "user_recharge");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32, 4)
            };
            parameters[0].Value = id;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #9
0
        /// <summary>
        /// 同一天内是否有登录过
        /// </summary>
        public bool ExistsDay(string username)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "user_login_log");
            strSql.Append(" where user_name=@user_name and DATEDIFF(now(),login_time)=0");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@user_name", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = username;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #10
0
        /// <summary>
        /// 检查同一IP注册间隔(小时)内是否存在
        /// </summary>
        public bool Exists(string reg_ip, int regctrl)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "users");
            strSql.Append(" where reg_ip=@reg_ip and DATEDIFF(hh,reg_time,getdate())<@regctrl");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@reg_ip",  MySqlDbType.VarChar, 30),
                new MySqlParameter("@regctrl", MySqlDbType.Int32, 4)
            };
            parameters[0].Value = reg_ip;
            parameters[1].Value = regctrl;
            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #11
0
        /// <summary>
        /// 检查用户是否下载过该附件
        /// </summary>
        public bool ExistsLog(int attach_id, int user_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "user_attach_log");
            strSql.Append(" where attach_id=@attach_id and user_id=@user_id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@attach_id", MySqlDbType.Int32, 4),
                new MySqlParameter("@user_id",   MySqlDbType.Int32, 4)
            };
            parameters[0].Value = attach_id;
            parameters[1].Value = user_id;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #12
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string type, string user_name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "user_code");
            strSql.Append(" where status=0 and datediff(d,eff_time,getdate())<=0 and type=@type and user_name=@user_name");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@type",      MySqlDbType.VarChar, 20),
                new MySqlParameter("@user_name", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = type;
            parameters[1].Value = user_name;

            return(DbHelperMySql.Exists(strSql.ToString(), parameters));
        }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tablename"></param>
 /// <returns></returns>
 public bool CheckTableExists(string tablename)
 {
     tablename = tablename.Replace("'", "''");
     if (_providerConfig.DbProvider == DbProvider.MySql)
     {
         var temp      = Utils.ParseConnectionString(_providerConfig.DbConnectionString);
         var dbname    = temp.GetValueByParams("database", "initial catalog");
         var sqlClause = string.Format("select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='{1}' and TABLE_NAME='{0}' ", tablename, dbname);
         return(DbHelperMySql.Exists(_providerConfig.DbConnectionString, sqlClause));
     }
     else
     {
         var sqlClause = "SELECT  * FROM dbo.SysObjects WHERE ID = object_id(N'" + tablename + "') AND OBJECTPROPERTY(ID, 'IsTable') = 1";
         return(TypeParse.StrToInt(DbHelperSql.GetSingle(_providerConfig.DbConnectionString, sqlClause)) != 0);
     }
 }
コード例 #14
0
        /// <summary>
        /// 查询是否存在列
        /// </summary>
        public bool Exists(string column_name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from " + databaseprefix + "article_attribute_field");
            strSql.Append(" where name=@name ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@name", MySqlDbType.VarChar, 100)
            };
            parameters[0].Value = column_name;

            if (DbHelperMySql.Exists(strSql.ToString(), parameters) || DbHelperMySql.ExitColumnName(databaseprefix + "article", column_name))
            {
                return(true);
            }
            return(false);
        }
コード例 #15
0
        /// <summary>
        /// 是否存在该记录(材料编号)
        /// </summary>
        public bool ExistsCLBH(string PM, string PH, string CLBH)
        {
            string SearchPMPH_CLBH = string.Empty;

            string[] strArrCLBH = CLBH.Split('-');
            if (strArrCLBH.Length == 2)
            {
                SearchPMPH_CLBH = strArrCLBH[0];
            }
            else
            {
                SearchPMPH_CLBH = CLBH;
            }
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from fmd060");
            strSql.Append(" where PM='" + PM + "' and PH='" + PH + "' and CLBH='" + SearchPMPH_CLBH + "'  ");
            return(DbHelperMySql.Exists(strSql.ToString()));
        }
コード例 #16
0
        /// <summary>
        /// 判断项目名是否存在 存在为更新  written by LH 2010/06/22
        /// </summary>
        /// <param name="strNO"></param>
        /// <returns></returns>
        public bool existProName(string proName)
        {
            //string strSql = " select COUNT(*) from Project where P_NAME=N'" + proName + "'";
            //string result = DbHelperMySql.GetSingle(strSql).ToString();
            //if (result == "0")
            //{
            //    return false;
            //}
            //else
            //    return true;



            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from  Project  ");
            strSql.Append("WHERE M_P_ID = 'M10' and P_NAME = '" + proName + "'  ");
            return(DbHelperMySql.Exists(strSql.ToString()));
        }
コード例 #17
0
        /// <summary>
        /// 判断登录是否成功
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="password"></param>
        /// <param name="dmqf"></param>
        /// <returns></returns>
        public bool CheckLogin(string uid, string password, string dmqf)
        {
            string strSql = "Select Count(*) from FMD020 where DMQF='" + dmqf + "' and USERNAME='******' and PASSWORD='******'";

            return(DbHelperMySql.Exists(strSql));
        }