예제 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MYouJi GetModel(string YouJiId)
        {
            MYouJi        model  = null;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 YouJiId,HuiYuanId,YouJiTitle,YouJiContent,IssueTime,ShiPinLink,WeiXinMa from tbl_HuiYouYouJi ");
            strSql.Append(" where YouJiId=@YouJiId ");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "YouJiId", System.Data.DbType.AnsiStringFixedLength, YouJiId);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    model              = new Eyousoft_yhq.Model.MYouJi();
                    model.YouJiId      = dr.IsDBNull(dr.GetOrdinal("YouJiId")) ? "" : dr.GetString(dr.GetOrdinal("YouJiId"));
                    model.YouJiTitle   = dr.IsDBNull(dr.GetOrdinal("YouJiTitle")) ? "" : dr.GetString(dr.GetOrdinal("YouJiTitle"));
                    model.YouJiContent = dr.IsDBNull(dr.GetOrdinal("YouJiContent")) ? null : getStrJson(dr.GetString(dr.GetOrdinal("YouJiContent")));
                    model.HuiYuanId    = dr.IsDBNull(dr.GetOrdinal("HuiYuanId")) ? "" : dr.GetString(dr.GetOrdinal("HuiYuanId"));
                    model.IssueTime    = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.ShiPinLink   = dr.IsDBNull(dr.GetOrdinal("ShiPinLink")) ? "" : dr.GetString(dr.GetOrdinal("ShiPinLink"));
                    model.WeiXinMa     = dr.IsDBNull(dr.GetOrdinal("WeiXinMa")) ? "" : dr.GetString(dr.GetOrdinal("WeiXinMa"));
                }
            }

            return(model);
        }
예제 #2
0
파일: BYouJi.cs 프로젝트: ichoukou/yhq
 /// <summary>
 /// 修改游记内容
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateModel(MYouJi model)
 {
     if (string.IsNullOrEmpty(model.YouJiId))
     {
         return(false);
     }
     return(dal.UpdateModel(model));
 }
예제 #3
0
파일: BYouJi.cs 프로젝트: ichoukou/yhq
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MYouJi model)
        {
            if (string.IsNullOrEmpty(model.HuiYuanId))
            {
                return(false);
            }
            model.YouJiId = Guid.NewGuid().ToString();
            bool result = dal.Add(model);

            return(result);
        }
예제 #4
0
        /// <summary>
        /// 修改游记内容
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateModel(MYouJi model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE tbl_HuiYouYouJi SET  YouJiTitle = @YouJiTitle , YouJiContent = @YouJiContent ,ShiPinLink=@ShiPinLink,WeiXinMa=@WeiXinMa  WHERE YouJiId=@YouJiId");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "YouJiId", System.Data.DbType.String, model.YouJiId);
            this._db.AddInParameter(cmd, "YouJiTitle", System.Data.DbType.String, model.YouJiTitle);
            this._db.AddInParameter(cmd, "YouJiContent", System.Data.DbType.String, getJsonStr(model.YouJiContent));
            this._db.AddInParameter(cmd, "ShiPinLink", System.Data.DbType.String, model.ShiPinLink);
            this._db.AddInParameter(cmd, "WeiXinMa", System.Data.DbType.String, model.WeiXinMa);

            return(DbHelper.ExecuteSql(cmd, this._db) > 0 ? true : false);
        }
예제 #5
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="RecordCount"></param>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList <MYouJi> GetList(int PageSize, int PageIndex, ref int RecordCount, MYouJiSer serModel)
        {
            IList <MYouJi> list = new List <MYouJi>();


            string tableName     = "tbl_HuiYouYouJi";
            string fileds        = " * ";
            string orderByString = " IssueTime DESC ";

            StringBuilder query = new StringBuilder();

            query.AppendFormat(" 1=1 ");

            if (serModel != null)
            {
                if (!string.IsNullOrEmpty(serModel.HuiYuanId))
                {
                    query.AppendFormat(" AND HuiYuanId='{0}' ", serModel.HuiYuanId);
                }
                if (serModel.YouJiType.HasValue)
                {
                    query.AppendFormat(" AND YouJiLeiXing='{0}' ", (int)serModel.YouJiType.Value);
                }
            }


            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    MYouJi model = new MYouJi();
                    model.YouJiId      = dr.IsDBNull(dr.GetOrdinal("YouJiId")) ? "" : dr.GetString(dr.GetOrdinal("YouJiId"));
                    model.YouJiTitle   = dr.IsDBNull(dr.GetOrdinal("YouJiTitle")) ? "" : dr.GetString(dr.GetOrdinal("YouJiTitle"));
                    model.YouJiContent = dr.IsDBNull(dr.GetOrdinal("YouJiContent")) ? null : getStrJson(dr.GetString(dr.GetOrdinal("YouJiContent")));
                    model.HuiYuanId    = dr.IsDBNull(dr.GetOrdinal("HuiYuanId")) ? "" : dr.GetString(dr.GetOrdinal("HuiYuanId"));
                    model.IssueTime    = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.ShiPinLink   = dr.IsDBNull(dr.GetOrdinal("ShiPinLink")) ? "" : dr.GetString(dr.GetOrdinal("ShiPinLink"));
                    model.WeiXinMa     = dr.IsDBNull(dr.GetOrdinal("WeiXinMa")) ? "" : dr.GetString(dr.GetOrdinal("WeiXinMa"));
                    list.Add(model);
                }
            }
            return(list);
        }
예제 #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MYouJi model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbl_HuiYouYouJi(");
            strSql.Append("YouJiId,HuiYuanId,YouJiTitle,YouJiContent,IssueTime,YouJiLeiXing,ShiPinLink,WeiXinMa)");
            strSql.Append(" values (");
            strSql.Append("@YouJiId,@HuiYuanId,@YouJiTitle,@YouJiContent,@IssueTime,@YouJiLeiXing,@ShiPinLink,@WeiXinMa)");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "YouJiId", System.Data.DbType.String, model.YouJiId);
            this._db.AddInParameter(cmd, "HuiYuanId", System.Data.DbType.String, model.HuiYuanId);
            this._db.AddInParameter(cmd, "YouJiTitle", System.Data.DbType.String, model.YouJiTitle);
            this._db.AddInParameter(cmd, "YouJiContent", System.Data.DbType.String, getJsonStr(model.YouJiContent));
            this._db.AddInParameter(cmd, "IssueTime", System.Data.DbType.DateTime, model.IssueTime);
            this._db.AddInParameter(cmd, "YouJiLeiXing", System.Data.DbType.Byte, model.YouJiType);
            this._db.AddInParameter(cmd, "ShiPinLink", System.Data.DbType.String, model.ShiPinLink);
            this._db.AddInParameter(cmd, "WeiXinMa", System.Data.DbType.String, model.WeiXinMa);

            return(DbHelper.ExecuteSql(cmd, this._db) > 0 ? true : false);
        }