Ejemplo n.º 1
0
        private void Add()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            int userID = 0;

            if (LoginInfo.IsLogin())
            {
            }
            else
            {
                userID = LoginInfo.UserID;
            }

            string sDetail = Server.HtmlEncode(Req.GetForm("content"));

            if (sDetail.Length == 0)
            {
                msgAjax.Error("input");
                return;
            }

            if (sDetail.Length == 0 || sDetail.Length > 600)
            {
                msgAjax.Error("nobuy");
                return;
            }

            News_MsgM mod = new News_MsgM();

            mod.FK_User = userID;
            mod.FK_News = id;
            mod.Detail  = sDetail;
            mod.Purview = 1;
            mod.IP      = Request.UserHostAddress;

            NewsMsg_TransM tmod = new NewsMsg_TransM();

            tmod.mod = mod;

            DbHelp.ExecuteTrans(new DbHelpParam(), this.NewsEval_Trans, tmod);

            if (tmod.returnValue == "1")
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error(tmod.returnValue);
            }
        }
Ejemplo n.º 2
0
        private void Add()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            int fraction = Fn.IsInt(Req.GetQueryString("star"), 3);

            if (fraction < 0 || fraction > 5)
            {
                fraction = 3;
            }

            int userID = 0;

            if (!LoginInfo.IsLogin())
            {
                userID = LoginInfo.UserID;
            }

            string sDetail = Server.HtmlEncode(Req.GetForm("content"));

            if (sDetail.Length > 600)
            {
                msgAjax.Error("above");
                return;
            }

            string sSql = "insert into CaiPu_Evaluate(FK_User,FK_Pro,Fraction,Detail,Purview,IP) values(@FK_User,@FK_Pro,@Fraction,@Detail,@Purview,@IP)";

            IDataParameter[] dp =
            {
                DbHelp.Def.AddParam("@FK_User",  userID),
                DbHelp.Def.AddParam("@FK_Pro",   id),
                DbHelp.Def.AddParam("@Fraction", fraction),
                DbHelp.Def.AddParam("@Detail",   sDetail),
                DbHelp.Def.AddParam("@Purview",                        0),
                DbHelp.Def.AddParam("@IP",       Request.UserHostAddress),
            };

            if (DbHelp.Update(sSql, dp) > 0)
            {
                banH.Add();
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error("nosubmit");
            }
        }
Ejemplo n.º 3
0
        private void Add()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            if (LoginInfo.NoLogin1(msgAjax))
            {
                return;
            }

            string sDetail = Server.HtmlEncode(Req.GetForm("content"));

            if (sDetail.Length == 0)
            {
                msgAjax.Error("input");
                return;
            }

            if (sDetail.Length > 600)
            {
                msgAjax.Error("above");
                return;
            }

            Pro_MsgM mod = new Pro_MsgM();

            mod.FK_User = LoginInfo.UserID;
            mod.FK_Pro  = id;
            mod.Detail  = sDetail;
            mod.Purview = 0;
            mod.IP      = Request.UserHostAddress;

            ProMsg_TransM tmod = new ProMsg_TransM();

            tmod.mod = mod;

            DbHelp.ExecuteTrans(new DbHelpParam(), this.ProEval_Trans, tmod);

            if (tmod.returnValue == "1")
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error(tmod.returnValue);
            }
        }
Ejemplo n.º 4
0
        private void Comment()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            string content = Server.HtmlEncode(Req.GetForm("content"));

            if (content.Length == 0)
            {
                msgAjax.Error("input");
                return;
            }

            if (content.Length > 600)
            {
                msgAjax.Error("评论内容不能超出600字");
                return;
            }

            string sql = "select top 1 1 from Questionnaire where IsOpen=1 and QuSN=" + id;

            if (DbHelp.First(sql, "0") != "1")
            {
                msgAjax.Error("不存在此记录");
                return;
            }

            TransM mod = new TransM();

            mod.content = content;

            DbHelp.ExecuteTrans(new DbHelpParam(), AddComment_Trans, mod);
        }
Ejemplo n.º 5
0
        private void Add()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            if (LoginInfo.NoLogin1(msgAjax))
            {
                return;
            }

            int fraction = Fn.IsInt(Req.GetQueryString("star"), 3);

            if (fraction < 0 || fraction > 5)
            {
                fraction = 3;
            }

            string sDetail = Server.HtmlEncode(Req.GetForm("content"));

            if (sDetail.Length > 600)
            {
                msgAjax.Error("above");
                return;
            }

            if (sDetail.Length == 0)
            {
                msgAjax.Error("input");
                return;
            }

            int userID = LoginInfo.UserID;

            string sql = "select (select count(0) from (Ord_Pro op inner join Pro_Info pi on op.FK_Pro=pi.ProSN) left join Ord_Info oi on op.FK_Order=oi.OrdSN where op.FK_Pro={1} and op.FK_User={0} and oi.Status=50) as ordProCount,"
                         + "(select count(0) from Pro_Evaluate where FK_User={0} and FK_Pro={1}) as proEvalCount";

            using (IDataReader dr = DbHelp.Read(string.Format(sql, userID, id)))
            {
                if (dr.Read())
                {
                    int ordProCount = int.Parse(dr["ordProCount"].ToString());

                    if (ordProCount == 0)
                    {
                        msgAjax.Error("nobuy");//未订购此产品
                        return;
                    }

                    int proEvalCount = int.Parse(dr["proEvalCount"].ToString());



                    if (proEvalCount >= ordProCount)
                    {
                        msgAjax.Error("has");//已评论此产品
                        return;
                    }
                }
                else
                {
                    msgAjax.Error("error");
                    return;
                }
            }

            Pro_EvaluateM mod = new Pro_EvaluateM();

            mod.FK_User  = userID;
            mod.FK_Pro   = id;
            mod.Fraction = fraction;
            mod.Detail   = sDetail;
            mod.Purview  = 0;
            mod.IP       = Request.UserHostAddress;

            ProEval_TransM tmod = new ProEval_TransM();

            tmod.mod = mod;

            DbHelp.ExecuteTrans(new DbHelpParam(), this.ProEval_Trans, tmod);

            if (tmod.returnValue == "1")
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error(tmod.returnValue);
            }
        }
Ejemplo n.º 6
0
        private void LL()
        {
            if (banH.IsBan())
            {
                msgAjax.Error("ban");
                return;
            }

            string        sql = "select Vote from News_Info where NewsSN=" + id;
            SqlDataSelect d   = new SqlDataSelect(sql);

            if (d.Count > 0)
            {
            }
            else
            {
                msgAjax.Error("不存在此新闻");
                return;
            }

            string           vote    = d.Eval("Vote").ToString();
            JavaScriptObject jsoVote = null;

            try
            {
                jsoVote = (JavaScriptObject)JavaScriptConvert.DeserializeObject(vote);
            }
            catch
            {
                jsoVote = new JavaScriptObject();
            }
            finally
            {
                if (jsoVote == null)
                {
                    jsoVote = new JavaScriptObject();
                }
            }

            sql = "select top 1 1 from Vote_Class where PClassSN in(select ClassSN from Vote_Class where Str='news') and Str=@Str";
            IDataParameter[] dp =
            {
                DbHelp.Def.AddParam("@Str", s),
            };

            if (DbHelp.First(sql, dp, "0") == "1")
            {
                object val;
                if (jsoVote.TryGetValue(s, out val))
                {
                    jsoVote[s] = Fn.IsInt(val.ToString(), 0) + 1;
                }
                else
                {
                    jsoVote.Add(s, "1");
                }
            }
            else
            {
                msgAjax.Error("不存在此投票项");
                return;
            }

            if (jsoVote.Count > 0)
            {
                sql = "update News_Info set Vote=@Vote where NewsSN=" + id;
                IDataParameter[] dp1 =
                {
                    DbHelp.Def.AddParam("@Vote", JavaScriptConvert.SerializeObject(jsoVote)),
                };
                DbHelp.Update(sql, dp1);
                banH.Add();
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error("投票失败");
            }
        }