public void Update(NewsEvaluationModel model)
        {
            string SpName = "UP_neNewsEvaluation_Update";

            DbCommand Command = dbw.GetStoredProcCommand(SpName);

            dbw.AddInParameter(Command, "@newsid", DbType.Int32, model.NewsID);
            dbw.AddInParameter(Command, "@userid", DbType.String, model.UserID);
            dbw.AddInParameter(Command, "@evaluation", DbType.Int32, model.Evaluation);
            dbw.AddInParameter(Command, "@inserttime", DbType.DateTime, model.InsertTime);

            dbw.ExecuteNonQuery(Command);
        }
        public NewsEvaluationModel GetModel(int NewsID, string UserID)
        {
            string SpName = "UP_neNewsEvaluation_Get";

            DbCommand Command = dbr.GetStoredProcCommand(SpName);

            dbr.AddInParameter(Command, "@newsid", DbType.Int32, NewsID);
            dbr.AddInParameter(Command, "@userid", DbType.String, UserID);

            DataTable           dt    = dbr.ExecuteDataSet(Command).Tables[0];
            NewsEvaluationModel model = null;

            if (dt.Rows.Count > 0)
            {
                model = GetModel(dt.Rows[0]);
            }

            return(model);
        }
        private void AddEvaluation(HttpContext CurrentContext)
        {
            if (CurrentUser == null)
            {
                CurrentContext.Response.Write(GetJsonResult(false, "请先登录!"));
                return;
            }

            NewsEvaluationModelBll bll = new NewsEvaluationModelBll();
            int NewsID = Convert.ToInt32(CurrentContext.Request["nid"]);
            int Value  = Convert.ToInt32(CurrentContext.Request["val"]);

            if (NewsID == 0 || Value == 0)
            {
                CurrentContext.Response.Write(GetJsonResult(false, "参数错误!"));
                return;
            }
            if (bll.Exists(NewsID, GetUserID()))
            {
                CurrentContext.Response.Write(GetJsonResult(false, "您已经评价过了,谢谢!"));
                return;
            }

            try
            {
                NewsEvaluationModel model = new NewsEvaluationModel()
                {
                    NewsID     = NewsID,
                    UserID     = GetUserID(),
                    Evaluation = Value,
                    InsertTime = DateTime.Now
                };
                bll.Add(model);
                CurrentContext.Response.Write(GetJsonResult(true, String.Empty));
            }
            catch (Exception ex)
            {
                CurrentContext.Response.Write(GetJsonResult(false, ex.Message));
            }
        }
 public void Update(NewsEvaluationModel model)
 {
     dal.Update(model);
 }
 public void Add(NewsEvaluationModel model)
 {
     dal.Add(model);
 }