Ejemplo n.º 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         Model_UserOrder_Comment commet = new Model_UserOrder_Comment();
         BLL_UserOrder_Comment   bll    = new BLL_UserOrder_Comment();
         commet.comment_id  = Guid.NewGuid().ToString();
         commet.create_time = DateTime.Now;
         if (pfunction.FilterKeyWords(this.txtcomment.Value))
         {
             ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('评论内容存在敏感词汇,请重新填写。',{icon:2,time:2000});</script>");
             return;
         }
         else
         {
             commet.comment_content = txtcomment.Value.Trim();
         }
         commet.comment_evaluate = Convert.ToDecimal(hidscore.Value);
         commet.order_num        = order_num;
         commet.user_id          = FloginUser.UserId;
         if (bll.Add(commet))
         {
             ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('评论成功',{time:1000,icon:1},function(){window.parent.loadData();parent.layer.close(index);});", true);
         }
         else
         {
             ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('评论失败',{time:2000,icon:2});", true);
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('" + ex + "',{time:5000,icon:2});", true);
     }
 }
Ejemplo n.º 2
0
        public bool Add(Model_UserOrder_Comment model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into UserOrder_Comment(");
            builder.Append("comment_id,order_num,user_id,comment_content,comment_evaluate,create_time,remark)");
            builder.Append(" values (");
            builder.Append("@comment_id,@order_num,@user_id,@comment_content,@comment_evaluate,@create_time,@remark)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@comment_id", SqlDbType.VarChar, 0x24), new SqlParameter("@order_num", SqlDbType.VarChar, 50), new SqlParameter("@user_id", SqlDbType.VarChar, 0x24), new SqlParameter("@comment_content", SqlDbType.VarChar, 0x7d0), new SqlParameter("@comment_evaluate", SqlDbType.Decimal, 5), new SqlParameter("@create_time", SqlDbType.DateTime), new SqlParameter("@remark", SqlDbType.VarChar, 0x7d0) };
            cmdParms[0].Value = model.comment_id;
            cmdParms[1].Value = model.order_num;
            cmdParms[2].Value = model.user_id;
            cmdParms[3].Value = model.comment_content;
            cmdParms[4].Value = model.comment_evaluate;
            cmdParms[5].Value = model.create_time;
            cmdParms[6].Value = model.remark;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 3
0
        public List <Model_UserOrder_Comment> DataTableToList(DataTable dt)
        {
            List <Model_UserOrder_Comment> list = new List <Model_UserOrder_Comment>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_UserOrder_Comment item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        public bool Update(Model_UserOrder_Comment model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update UserOrder_Comment set ");
            builder.Append("order_num=@order_num,");
            builder.Append("user_id=@user_id,");
            builder.Append("comment_content=@comment_content,");
            builder.Append("comment_evaluate=@comment_evaluate,");
            builder.Append("create_time=@create_time,");
            builder.Append("remark=@remark");
            builder.Append(" where comment_id=@comment_id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@order_num", SqlDbType.VarChar, 50), new SqlParameter("@user_id", SqlDbType.VarChar, 0x24), new SqlParameter("@comment_content", SqlDbType.VarChar, 0x7d0), new SqlParameter("@comment_evaluate", SqlDbType.Decimal, 5), new SqlParameter("@create_time", SqlDbType.DateTime), new SqlParameter("@remark", SqlDbType.VarChar, 0x7d0), new SqlParameter("@comment_id", SqlDbType.VarChar, 0x24) };
            cmdParms[0].Value = model.order_num;
            cmdParms[1].Value = model.user_id;
            cmdParms[2].Value = model.comment_content;
            cmdParms[3].Value = model.comment_evaluate;
            cmdParms[4].Value = model.create_time;
            cmdParms[5].Value = model.remark;
            cmdParms[6].Value = model.comment_id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 5
0
        public Model_UserOrder_Comment DataRowToModel(DataRow row)
        {
            Model_UserOrder_Comment comment = new Model_UserOrder_Comment();

            if (row != null)
            {
                if (row["comment_id"] != null)
                {
                    comment.comment_id = row["comment_id"].ToString();
                }
                if (row["order_num"] != null)
                {
                    comment.order_num = row["order_num"].ToString();
                }
                if (row["user_id"] != null)
                {
                    comment.user_id = row["user_id"].ToString();
                }
                if (row["comment_content"] != null)
                {
                    comment.comment_content = row["comment_content"].ToString();
                }
                if ((row["comment_evaluate"] != null) && (row["comment_evaluate"].ToString() != ""))
                {
                    comment.comment_evaluate = new decimal?(decimal.Parse(row["comment_evaluate"].ToString()));
                }
                if ((row["create_time"] != null) && (row["create_time"].ToString() != ""))
                {
                    comment.create_time = new DateTime?(DateTime.Parse(row["create_time"].ToString()));
                }
                if (row["remark"] != null)
                {
                    comment.remark = row["remark"].ToString();
                }
            }
            return(comment);
        }
Ejemplo n.º 6
0
 public bool Add(Model_UserOrder_Comment model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 7
0
 public bool Update(Model_UserOrder_Comment model)
 {
     return(this.dal.Update(model));
 }