Пример #1
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.Id desc");
            }
            strSql.Append(")AS Row, T.*  from CustomerJPush T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return(DbHelperMySql.Query(strSql.ToString()));
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CustomerJPush GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,CustomerId,RegId,Platform,Created from CustomerJPush ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Customer GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,Account,Password,Sign,NickName,Name,Phone,Email,OpenId,CardType,CardNo,Photo,ReferenceId,IsGrantLibrary,Count,Platform,RegisterIP,RegisterAddredss,Deleted,Created,Modified,RedeemPassword,EnabledFingerprint,HadaCount,IsAutoRedeem,IsSetPassword from Customer ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SystemConfig GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,Category,Key,Value,Name,Deleted,Created,Modified from SystemConfig ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        /*
         *      /// <summary>
         *      /// 分页获取数据列表
         *      /// </summary>
         *      public DataSet GetList(int PageSize,int PageIndex,string strWhere)
         *      {
         *              MySqlParameter[] parameters = {
         *                              new MySqlParameter("@tblName", MySqlDbType.VarChar, 255),
         *                              new MySqlParameter("@fldName", MySqlDbType.VarChar, 255),
         *                              new MySqlParameter("@PageSize", MySqlDbType.Int32),
         *                              new MySqlParameter("@PageIndex", MySqlDbType.Int32),
         *                              new MySqlParameter("@IsReCount", MySqlDbType.Bit),
         *                              new MySqlParameter("@OrderType", MySqlDbType.Bit),
         *                              new MySqlParameter("@strWhere", MySqlDbType.VarChar,1000),
         *                              };
         *              parameters[0].Value = "SystemConfig";
         *              parameters[1].Value = "Id";
         *              parameters[2].Value = PageSize;
         *              parameters[3].Value = PageIndex;
         *              parameters[4].Value = 0;
         *              parameters[5].Value = 0;
         *              parameters[6].Value = strWhere;
         *              return DbHelperMySql.RunProcedure("UP_GetRecordByPage",parameters,"ds");
         *      }*/

        #endregion  BasicMethod
        #region  ExtensionMethod


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SystemConfig GetModel(string key)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT Id,Category,`Key`,`Value`,`Name`,Deleted,Created,Modified FROM SystemConfig ");
            strSql.Append(" where `Key`=@Key");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Key", MySqlDbType.String)
            };
            parameters[0].Value = key;

            SystemConfig model = new SystemConfig();
            DataSet      ds    = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }