/// <summary>
 /// 更新一条回复咨询
 /// </summary>
 /// <param name="reply">
 /// 回复咨询的对象
 /// </param>
 public void UpdateConsultReply(Product_Consult reply)
 {
     var paras = new List<SqlParameter>
                     {
                         this.SqlServer.CreateSqlParameter(
                             "ID",
                             SqlDbType.Int,
                             reply.ID,
                             ParameterDirection.Input),
                         this.SqlServer.CreateSqlParameter(
                             "EmployeeID",
                             SqlDbType.Int,
                             reply.EmployeeID,
                             ParameterDirection.Input),
                         this.SqlServer.CreateSqlParameter(
                             "Content",
                             SqlDbType.NVarChar,
                             reply.Content,
                             ParameterDirection.Input),
                         this.SqlServer.CreateSqlParameter(
                             "CreateTime",
                             SqlDbType.VarChar,
                             reply.CreateTime,
                             ParameterDirection.Input)
                     };
     try
     {
         this.SqlServer.ExecuteNonQuery(
             CommandType.StoredProcedure,
             "sp_Product_Consult_Reply_Update",
             paras,
             null);
     }
     catch (Exception exception)
     {
         throw new Exception("Exception - ProductConsult - ReplyConsult", exception);
     }
 }
        /// <summary>
        /// 添加商品咨询.
        /// </summary>
        /// <param name="productConsult">
        /// Product_Consult.
        /// </param>
        /// <returns>
        /// 咨询的编号.
        /// </returns>
        public int Insert(Product_Consult productConsult)
        {
            if (productConsult == null)
            {
                throw new ArgumentNullException("productConsult");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ProductID",
                                         SqlDbType.Int,
                                         productConsult.ProductID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UserID",
                                         SqlDbType.Int,
                                         productConsult.UserID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Content",
                                         SqlDbType.VarChar,
                                         productConsult.Content,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_Consult_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
Esempio n. 3
0
 public JsonResult AddConsult(int productID, string content)
 {
     try
     {
         var userID = this.GetUserID();
         var productConsult = new Product_Consult
         {
             UserID = userID,
             ProductID = productID,
             Content = content
         };
         productConsult.ID = new ProductConsultService().Add(productConsult);
         return this.Json(new AjaxResponse(1, "咨询成功!"));
     }
     catch (Exception exception)
     {
         return this.Json(new AjaxResponse(0, "咨询失败!:" + exception.Message));
     }
 }
 /// <summary>
 /// 修改咨询的回复信息
 /// </summary>
 /// <param name="reply">
 /// 咨询对象
 /// </param>
 public void ModifyConsultReply(Product_Consult reply)
 {
     this.productConsultDA.UpdateConsultReply(reply);
 }
 /// <summary>
 /// 添加商品咨询.
 /// </summary>
 /// <param name="productConsult">
 /// Product_Consult.
 /// </param>
 /// <returns>
 /// 咨询的编号.
 /// </returns>
 public int Add(Product_Consult productConsult)
 {
     return this.productConsultDA.Insert(productConsult);
 }
 /// <summary>
 /// 回复商品咨询
 /// </summary>
 /// <param name="reply">
 /// 回复咨询
 /// </param>
 public void ReplyConsult(Product_Consult reply)
 {
     this.productConsultDA.ReplyConsult(reply);
 }