Esempio n. 1
0
 /// <summary>
 /// 回复留言
 /// </summary>
 public bool UpdateLiuYan(EyouSoft.Model.MTravelArticleLY model)
 {
     if (model != null && !string.IsNullOrEmpty(model.LiuYanId) && !string.IsNullOrEmpty(model.OperatorId))
     {
         return(dal.UpdateLiuYan(model));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 增加一条留言
 /// </summary>
 public bool AddLiuYan(EyouSoft.Model.MTravelArticleLY model)
 {
     if (model != null && !string.IsNullOrEmpty(model.MemberID) && !string.IsNullOrEmpty(model.ArticleID))
     {
         model.LiuYanId = Guid.NewGuid().ToString();
         return(dal.AddLiuYan(model));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个留言对象实体
        /// </summary>
        public EyouSoft.Model.MTravelArticleLY GetLiuYanModel(string LiuYanId)
        {
            EyouSoft.Model.MTravelArticleLY model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select LiuYanId, ArticleID, MemberID, LiuYanShiJian, LiuYanContet, HuiFuContet,IsCheck, OperatorId, IssueTime,  ");
            strSql.Append(" (select top 1 ArticleTitle from tbl_TravelArticle where ArticleID=tbl_TravelArticleLY.ArticleID ) as ArticleTitle, ");
            strSql.Append(" (select top 1 Account from tbl_Member where MemberID=tbl_TravelArticleLY.MemberID ) as Account, ");
            strSql.Append(" (select top 1 ContactName from tbl_User where UserID=tbl_TravelArticleLY.OperatorId ) as Username ");
            strSql.Append(" from tbl_TravelArticleLY ");
            strSql.Append(" where LiuYanId=@LiuYanId ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());
            this._db.AddInParameter(cmd, "LiuYanId", DbType.AnsiStringFixedLength, LiuYanId);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    model = new EyouSoft.Model.MTravelArticleLY();

                    model.LiuYanId = dr.GetString(dr.GetOrdinal("LiuYanId"));
                    model.ArticleID = dr.GetString(dr.GetOrdinal("ArticleID"));
                    model.MemberID = dr.GetString(dr.GetOrdinal("MemberID"));
                    model.LiuYanShiJian = dr.GetDateTime(dr.GetOrdinal("LiuYanShiJian"));
                    model.LiuYanContet = dr["LiuYanContet"].ToString();
                    model.HuiFuContet = dr["HuiFuContet"].ToString();
                    model.IsCheck = dr.GetString(dr.GetOrdinal("IsCheck")) == "1";
                    model.OperatorId = dr["OperatorId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IssueTime")))
                    {
                        model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    }
                    model.ArticleTitle = dr["ArticleTitle"].ToString();
                    model.Account = dr["Account"].ToString();
                    model.Username = dr["Username"].ToString();
                }
            }
            return model;
        }
Esempio n. 4
0
        /// <summary>
        /// 获得留言前几行数据
        /// </summary>
        public IList<EyouSoft.Model.MTravelArticleLY> GetLiuYanList(int Top, EyouSoft.Model.MTravelArticleLYCX chaxun)
        {
            IList<EyouSoft.Model.MTravelArticleLY> list = new List<EyouSoft.Model.MTravelArticleLY>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }

            strSql.Append("  LiuYanId, ArticleID, MemberID, LiuYanShiJian, LiuYanContet, HuiFuContet,IsCheck, OperatorId, IssueTime,  ");
            strSql.Append(" (select top 1 ArticleTitle from tbl_TravelArticle where ArticleID=tbl_TravelArticleLY.ArticleID ) as ArticleTitle, ");
            strSql.Append(" (select top 1 Account from tbl_Member where MemberID=tbl_TravelArticleLY.MemberID ) as Account, ");
            strSql.Append(" (select top 1 ContactName from tbl_User where UserID=tbl_TravelArticleLY.OperatorId ) as Username ");

            strSql.Append("  from tbl_TravelArticleLY ");
            strSql.Append(" Where 1=1 ");

            if (chaxun != null)
            {
                if (!string.IsNullOrEmpty(chaxun.ArticleID))
                {

                    strSql.AppendFormat(" and ArticleID='{0}' ", chaxun.ArticleID);
                }
                if (chaxun.IsCheck.HasValue)
                {
                    strSql.AppendFormat(" and IsCheck='{0}' ", chaxun.IsCheck == true ? "1" : "0");
                }

                if (chaxun.Stime != null)
                {
                    strSql.AppendFormat(" AND LiuYanShiJian>='{0}' ", chaxun.Stime.Value.ToShortDateString() + " 00:00:00");
                }
                if (chaxun.Etime != null)
                {
                    strSql.AppendFormat(" AND LiuYanShiJian<='{0}' ", chaxun.Etime.Value.ToShortDateString() + " 23:59:59");
                }
            }

            strSql.Append(" Order by IsCheck asc,LiuYanShiJian desc,IssueTime desc ");

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

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.MTravelArticleLY model = new EyouSoft.Model.MTravelArticleLY();
                    model.LiuYanId = dr.GetString(dr.GetOrdinal("LiuYanId"));
                    model.ArticleID = dr.GetString(dr.GetOrdinal("ArticleID"));
                    model.MemberID = dr.GetString(dr.GetOrdinal("MemberID"));
                    model.LiuYanShiJian = dr.GetDateTime(dr.GetOrdinal("LiuYanShiJian"));
                    model.LiuYanContet = dr["LiuYanContet"].ToString();
                    model.HuiFuContet = dr["HuiFuContet"].ToString();
                    model.IsCheck = dr.GetString(dr.GetOrdinal("IsCheck")) == "1";
                    model.OperatorId = dr["OperatorId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IssueTime")))
                    {
                        model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    }
                    model.ArticleTitle = dr["ArticleTitle"].ToString();
                    model.Account = dr["Account"].ToString();
                    model.Username = dr["Username"].ToString();
                    list.Add(model);
                }
            }

            return list;
        }
Esempio n. 5
0
        /// <summary>
        /// 获得留言数据列表
        /// </summary>
        public IList<EyouSoft.Model.MTravelArticleLY> GetLiuYanList(int PageSize, int PageIndex, ref int RecordCount, EyouSoft.Model.MTravelArticleLYCX chaxun)
        {
            IList<EyouSoft.Model.MTravelArticleLY> list = new List<EyouSoft.Model.MTravelArticleLY>();

            string tableName = "tbl_TravelArticleLY";

            StringBuilder fields = new StringBuilder();
            fields.Append("  LiuYanId, ArticleID, MemberID, LiuYanShiJian, LiuYanContet, HuiFuContet,IsCheck, OperatorId, IssueTime,  ");
            fields.Append(" (select top 1 ArticleTitle from tbl_TravelArticle where ArticleID=tbl_TravelArticleLY.ArticleID ) as ArticleTitle, ");
            fields.Append(" (select top 1 Account from tbl_Member where MemberID=tbl_TravelArticleLY.MemberID ) as Account, ");
            fields.Append(" (select top 1 ContactName from tbl_User where UserID=tbl_TravelArticleLY.OperatorId ) as Username ");

            string orderByString = "IsCheck asc,LiuYanShiJian desc,IssueTime desc";

            StringBuilder query = new StringBuilder();
            query.Append(" 1=1 ");
            if (chaxun != null)
            {
                if (!string.IsNullOrEmpty(chaxun.ArticleID))
                {

                    query.AppendFormat(" and ArticleID='{0}' ", chaxun.ArticleID);
                }
                if (chaxun.IsCheck.HasValue)
                {
                    query.AppendFormat(" and IsCheck='{0}' ", chaxun.IsCheck == true ? "1" : "0");
                }

                if (chaxun.Stime != null)
                {
                    query.AppendFormat(" AND LiuYanShiJian>='{0}' ", chaxun.Stime.Value.ToShortDateString() + " 00:00:00");
                }
                if (chaxun.Etime != null)
                {
                    query.AppendFormat(" AND LiuYanShiJian<='{0}' ", chaxun.Etime.Value.ToShortDateString() + " 23:59:59");
                }
            }

            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fields.ToString(), query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.MTravelArticleLY model = new EyouSoft.Model.MTravelArticleLY();
                    model.LiuYanId = dr.GetString(dr.GetOrdinal("LiuYanId"));
                    model.ArticleID = dr.GetString(dr.GetOrdinal("ArticleID"));
                    model.MemberID = dr.GetString(dr.GetOrdinal("MemberID"));
                    model.LiuYanShiJian = dr.GetDateTime(dr.GetOrdinal("LiuYanShiJian"));
                    model.LiuYanContet = dr["LiuYanContet"].ToString();
                    model.HuiFuContet = dr["HuiFuContet"].ToString();
                    model.IsCheck = dr.GetString(dr.GetOrdinal("IsCheck")) == "1";
                    model.OperatorId = dr["OperatorId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IssueTime")))
                    {
                        model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    }
                    model.ArticleTitle = dr["ArticleTitle"].ToString();
                    model.Account = dr["Account"].ToString();
                    model.Username = dr["Username"].ToString();
                    list.Add(model);
                }
            }

            return list;
        }