Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.CommunityStructure.ExchangeComment model = new EyouSoft.Model.CommunityStructure.ExchangeComment();
            model.CommentId      = string.Empty;
            model.CommentIP      = StringValidate.GetRemoteIP();
            model.CommentText    = Utils.InputText(Utils.GetFormValue("txt_content"));
            model.CompanyId      = base.SiteUserInfo.CompanyID;
            model.CompanyName    = base.SiteUserInfo.CompanyName;
            model.IsAnonymous    = IsAnonymous.Checked;
            model.IsCheck        = false;
            model.IsDeleted      = false;
            model.IsHasNextLevel = false;
            model.IssueTime      = DateTime.Now;
            model.OperatorId     = base.SiteUserInfo.ID;
            model.OperatorMQ     = base.SiteUserInfo.ContactInfo.MQ;
            model.OperatorName   = base.SiteUserInfo.ContactInfo.ContactName;
            model.TopicType      = EyouSoft.Model.CommunityStructure.TopicType.宾;
            model.TopicId        = hGuestId.Value;
            int Result = Ibll.AddExchangeComment(model);

            Ibll  = null;
            model = null;
            if (Result > 0)
            {
                Utils.ShowAndRedirect("发表成功!", Request.RawUrl);
            }
            else
            {
                Utils.ShowAndRedirect("发表失败!", Request.RawUrl);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="model">交流评论实体</param>
        /// <returns>返回受影响行数</returns>
        public virtual int AddExchangeComment(EyouSoft.Model.CommunityStructure.ExchangeComment model)
        {
            if (model == null)
            {
                return(0);
            }

            DbCommand dc = base.SystemStore.GetSqlStringCommand(Sql_ExchangeComment_Add);

            #region 参数赋值

            base.SystemStore.AddInParameter(dc, "ID", DbType.AnsiStringFixedLength, model.ID);
            base.SystemStore.AddInParameter(dc, "TopicId", DbType.String, model.TopicId);
            base.SystemStore.AddInParameter(dc, "TopicClassId", DbType.Byte, (int)model.TopicType);
            base.SystemStore.AddInParameter(dc, "CommentId", DbType.String, model.CommentId);
            base.SystemStore.AddInParameter(dc, "CompanyId", DbType.String, model.CompanyId);
            base.SystemStore.AddInParameter(dc, "CompanyName", DbType.String, model.CompanyName);
            base.SystemStore.AddInParameter(dc, "OperatorId", DbType.String, model.OperatorId);
            base.SystemStore.AddInParameter(dc, "OperatorName", DbType.String, model.OperatorName);
            base.SystemStore.AddInParameter(dc, "OperatorMQ", DbType.String, model.OperatorMQ);
            base.SystemStore.AddInParameter(dc, "CommentText", DbType.String, model.CommentText);
            base.SystemStore.AddInParameter(dc, "IssueTime", DbType.DateTime, DateTime.Now);
            base.SystemStore.AddInParameter(dc, "IsHasNextLevel", DbType.String, model.IsHasNextLevel ? "1" : "0");
            base.SystemStore.AddInParameter(dc, "IsDeleted", DbType.String, "0");
            base.SystemStore.AddInParameter(dc, "IsAnonymous", DbType.String, model.IsAnonymous ? "1" : "0");
            base.SystemStore.AddInParameter(dc, "CommentIP", DbType.String, model.CommentIP);
            base.SystemStore.AddInParameter(dc, "IsCheck", DbType.String, "0");

            #endregion

            return(DbHelper.ExecuteSql(dc, base.SystemStore));
        }
Beispiel #3
0
        protected void ibtnSave_Click(object sender, EventArgs e)
        {
            if (!IsLogin)
            {
                MessageBox.ShowAndReturnBack(this, "请先登录!", 1);
                return;
            }

            string strInfo      = Utils.InputText(txtCommentInfo.Value.Trim());
            string strTopicId   = id;
            string strCommentId = Utils.GetFormValue("hidCommentId");

            if (string.IsNullOrEmpty(strInfo))
            {
                MessageBox.ShowAndReturnBack(this, "回复内容不能为空!", 1);
                return;
            }
            if (strInfo.Length > 500)
            {
                MessageBox.ShowAndReturnBack(this, "回复内容应限制在500个字符以内!", 1);
                return;
            }

            EyouSoft.Model.CommunityStructure.ExchangeComment model = new EyouSoft.Model.CommunityStructure.ExchangeComment();
            model.CommentId      = strCommentId;
            model.CommentIP      = StringValidate.GetRemoteIP();
            model.CommentText    = strInfo;
            model.CompanyId      = SiteUserInfo.CompanyID;
            model.CompanyName    = SiteUserInfo.CompanyName;
            model.IsAnonymous    = false;
            model.IsCheck        = false;
            model.IsDeleted      = false;
            model.IsHasNextLevel = false;
            model.IssueTime      = DateTime.Now;
            model.OperatorId     = SiteUserInfo.ID;
            model.OperatorMQ     = SiteUserInfo.ContactInfo == null ? "0" : SiteUserInfo.ContactInfo.MQ;
            model.OperatorName   = SiteUserInfo.ContactInfo == null ? string.Empty : SiteUserInfo.ContactInfo.ContactName;
            model.TopicId        = strTopicId;
            model.TopicType      = EyouSoft.Model.CommunityStructure.TopicType.供求;

            if (EyouSoft.BLL.CommunityStructure.ExchangeComment.CreateInstance().AddExchangeComment(model) == 1)
            {
                MessageBox.ShowAndRedirect(this, "提交评论成功!", Request.RawUrl);
                return;
            }
            else
            {
                MessageBox.ShowAndRedirect(this, "提交评论失败!", Request.RawUrl);
                return;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="model">交流评论实体</param>
        /// <returns>-2:修改是否有子级评论失败;-1:新增评论失败;0:实体为空;1:Success</returns>
        public int AddExchangeComment(EyouSoft.Model.CommunityStructure.ExchangeComment model)
        {
            if (model == null && string.IsNullOrEmpty(model.TopicId))
            {
                return(0);
            }

            int Result = 0;

            using (System.Transactions.TransactionScope AddTran = new System.Transactions.TransactionScope())
            {
                model.ID = Guid.NewGuid().ToString();
                Result   = dal.AddExchangeComment(model);
                if (Result <= 0)
                {
                    return(-1);
                }

                if (!string.IsNullOrEmpty(model.CommentId))
                {
                    Result = dal.SetIsHasNextLevel(model.CommentId, true) ? 1 : -2;
                    if (Result <= 0)
                    {
                        return(-2);
                    }
                }
                if (model.TopicType == EyouSoft.Model.CommunityStructure.TopicType.供求)
                {
                    if (!BLL.CommunityStructure.ExchangeList.CreateInstance().SetWriteBackCount(model.TopicId))
                    {
                        return(-4);
                    }
                }
                if (model.TopicType == EyouSoft.Model.CommunityStructure.TopicType.供求 && string.IsNullOrEmpty(model.CommentId))
                {
                    Result = BLL.MQStructure.IMMessage.CreateInstance().AddMessageToExchangeComment(model.ID) ? 1 : -3;
                }

                AddTran.Complete();
            }
            return(Result);
        }
Beispiel #5
0
        /// <summary>
        /// 分页获取互动交流下的评论
        /// </summary>
        /// <param name="PageSize">每页条数</param>
        /// <param name="PageIndex">当前页数</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="TopicId">互动交流ID(必须传值)</param>
        /// <param name="TopicType">评论类型(为null不作条件)</param>
        /// <returns>返回互动交流评论实体集合</returns>
        public virtual IList <EyouSoft.Model.CommunityStructure.ExchangeComment> GetExchangeCommentList(int PageSize, int PageIndex, ref int RecordCount, string TopicId, EyouSoft.Model.CommunityStructure.TopicType?TopicType)
        {
            IList <EyouSoft.Model.CommunityStructure.ExchangeComment> List = new List <EyouSoft.Model.CommunityStructure.ExchangeComment>();
            StringBuilder strWhere = new StringBuilder(" 1 = 1 ");
            string        strFiles = " [ID],[TopicId],[TopicClassId],[CommentId],[CompanyId],[CompanyName],[OperatorId],[OperatorName],[OperatorMQ],[CommentText],[IssueTime],[IsHasNextLevel],[IsDeleted],[IsAnonymous],[CommentIP],[IsCheck] ";
            string        strOrder = " IssueTime asc ";

            if (!string.IsNullOrEmpty(TopicId))
            {
                strWhere.AppendFormat(" and TopicId = '{0}' ", TopicId);
            }
            if (TopicType.HasValue)
            {
                strWhere.AppendFormat(" and TopicClassId = {0} ", (int)TopicType.Value);
            }
            using (IDataReader dr = DbHelper.ExecuteReader(base.SystemStore, PageSize, PageIndex, ref RecordCount, "tbl_ExchangeComment", "[ID]", strFiles, strWhere.ToString(), strOrder))
            {
                EyouSoft.Model.CommunityStructure.ExchangeComment model = null;
                while (dr.Read())
                {
                    model         = new EyouSoft.Model.CommunityStructure.ExchangeComment();
                    model.ID      = dr["ID"].ToString();
                    model.TopicId = dr["TopicId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("TopicClassId")))
                    {
                        model.TopicType = (EyouSoft.Model.CommunityStructure.TopicType) int.Parse(dr["TopicClassId"].ToString());
                    }
                    model.CommentId    = dr["CommentId"].ToString();
                    model.CompanyId    = dr["CompanyId"].ToString();
                    model.CompanyName  = dr["CompanyName"].ToString();
                    model.OperatorId   = dr["OperatorId"].ToString();
                    model.OperatorName = dr["OperatorName"].ToString();
                    model.OperatorMQ   = dr["OperatorMQ"].ToString();
                    model.CommentText  = dr["CommentText"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IssueTime")))
                    {
                        model.IssueTime = DateTime.Parse(dr["IssueTime"].ToString());
                    }
                    model.CommentIP = dr["CommentIP"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IsHasNextLevel")) && dr["IsHasNextLevel"].ToString().Equals("1"))
                    {
                        model.IsHasNextLevel = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsDeleted")) && dr["IsDeleted"].ToString().Equals("1"))
                    {
                        model.IsDeleted = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsAnonymous")) && dr["IsAnonymous"].ToString().Equals("1"))
                    {
                        model.IsAnonymous = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsCheck")) && dr["IsCheck"].ToString().Equals("1"))
                    {
                        model.IsCheck = true;
                    }

                    List.Add(model);
                }
            }

            return(List);
        }
Beispiel #6
0
        /// <summary>
        /// 获取互动交流下的评论
        /// </summary>
        /// <param name="TopNum">top条数(小于等于0取所有)</param>
        /// <param name="TopicId">互动交流ID(必须传值)</param>
        /// <param name="TopicType">评论类型(为null不作条件)</param>
        /// <param name="CommentId">所回复的评论编号(小于等于0不作条件)</param>
        /// <returns>返回互动交流评论实体集合</returns>
        public virtual IList <EyouSoft.Model.CommunityStructure.ExchangeComment> GetExchangeCommentList(int TopNum, string TopicId, EyouSoft.Model.CommunityStructure.TopicType?TopicType, string CommentId)
        {
            IList <EyouSoft.Model.CommunityStructure.ExchangeComment> List = new List <EyouSoft.Model.CommunityStructure.ExchangeComment>();
            StringBuilder strSql = new StringBuilder();

            strSql.AppendFormat(Sql_ExchangeComment_Select, TopNum > 0 ? string.Format(" top {0} ", TopNum) : string.Empty);
            if (!string.IsNullOrEmpty(TopicId))
            {
                strSql.AppendFormat(" and TopicId = '{0}' ", TopicId);
            }
            if (TopicType.HasValue)
            {
                strSql.AppendFormat(" and TopicClassId = {0} ", (int)TopicType.Value);
            }
            if (!string.IsNullOrEmpty(CommentId))
            {
                strSql.AppendFormat(" and CommentId = '{0}' ", CommentId);
            }
            else
            {
                strSql.Append(" and CommentId = '' ");
            }
            strSql.Append(" order by IssueTime asc ");
            DbCommand dc = base.SystemStore.GetSqlStringCommand(strSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore))
            {
                EyouSoft.Model.CommunityStructure.ExchangeComment model = null;
                while (dr.Read())
                {
                    model         = new EyouSoft.Model.CommunityStructure.ExchangeComment();
                    model.ID      = dr["ID"].ToString();
                    model.TopicId = dr["TopicId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("TopicClassId")))
                    {
                        model.TopicType = (EyouSoft.Model.CommunityStructure.TopicType) int.Parse(dr["TopicClassId"].ToString());
                    }
                    model.CommentId    = dr["CommentId"].ToString();
                    model.CompanyId    = dr["CompanyId"].ToString();
                    model.CompanyName  = dr["CompanyName"].ToString();
                    model.OperatorId   = dr["OperatorId"].ToString();
                    model.OperatorName = dr["OperatorName"].ToString();
                    model.OperatorMQ   = dr["OperatorMQ"].ToString();
                    model.CommentText  = dr["CommentText"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IssueTime")))
                    {
                        model.IssueTime = DateTime.Parse(dr["IssueTime"].ToString());
                    }
                    model.CommentIP = dr["CommentIP"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IsHasNextLevel")) && dr["IsHasNextLevel"].ToString().Equals("1"))
                    {
                        model.IsHasNextLevel = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsDeleted")) && dr["IsDeleted"].ToString().Equals("1"))
                    {
                        model.IsDeleted = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsAnonymous")) && dr["IsAnonymous"].ToString().Equals("1"))
                    {
                        model.IsAnonymous = true;
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsCheck")) && dr["IsCheck"].ToString().Equals("1"))
                    {
                        model.IsCheck = true;
                    }

                    List.Add(model);
                }
            }
            return(List);
        }