Пример #1
0
 public void btnRefer_Click(object sender, EventArgs e)
 {
     ProductConsultationInfo target = new ProductConsultationInfo();
     target.ConsultationDate = DateTime.Now;
     target.ProductId = this.productId;
     target.UserId = HiContext.Current.User.UserId;
     target.UserName = this.txtUserName.Text;
     target.UserEmail = this.txtEmail.Text;
     target.ConsultationText = this.txtContent.Text;
     ValidationResults results = Hishop.Components.Validation.Validation.Validate<ProductConsultationInfo>(target, new string[] { "Refer" });
     string msg = string.Empty;
     if (!results.IsValid)
     {
         foreach (ValidationResult result in (IEnumerable<ValidationResult>) results)
         {
             msg = msg + Formatter.FormatErrorMessage(result.Message);
         }
         this.ShowMessage(msg, false);
     }
     else if (string.IsNullOrEmpty(this.txtConsultationCode.Value))
     {
         this.ShowMessage("请输入验证码", false);
     }
     else if (!HiContext.Current.CheckVerifyCode(this.txtConsultationCode.Value.Trim()))
     {
         this.ShowMessage("验证码不正确", false);
     }
     else if (ProductProcessor.InsertProductConsultation(target))
     {
         this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "咨询成功,管理员回复即可显示", Globals.GetSiteUrls().UrlData.FormatUrl("productConsultations", new object[] { this.productId })));
     }
     else
     {
         this.ShowMessage("咨询失败,请重试", false);
     }
 }
Пример #2
0
 public static bool ReplyProductConsultation(ProductConsultationInfo productConsultation)
 {
     return new ProductConsultationDao().ReplyProductConsultation(productConsultation);
 }
Пример #3
0
 private void AddProductConsultations(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     MemberInfo currentMember = MemberProcessor.GetCurrentMember();
     ProductConsultationInfo productConsultation = new ProductConsultationInfo {
         ConsultationDate = DateTime.Now,
         ConsultationText = context.Request["ConsultationText"],
         ProductId = Convert.ToInt32(context.Request["ProductId"]),
         UserEmail = currentMember.Email,
         UserId = currentMember.UserId,
         UserName = currentMember.UserName
     };
     if (ProductBrowser.InsertProductConsultation(productConsultation))
     {
         context.Response.Write("{\"success\":true}");
     }
     else
     {
         context.Response.Write("{\"success\":false, \"msg\":\"提交失败\"}");
     }
 }
Пример #4
0
 public static bool ReplyProductConsultation(ProductConsultationInfo productConsultation)
 {
     return CommentsProvider.Instance().ReplyProductConsultation(productConsultation);
 }
Пример #5
0
 public override bool ReplyProductConsultation(ProductConsultationInfo productConsultation)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_ProductConsultations SET ReplyText = @ReplyText, ReplyDate = @ReplyDate, ReplyUserId = @ReplyUserId WHERE ConsultationId = @ConsultationId");
     database.AddInParameter(sqlStringCommand, "ReplyText", DbType.String, productConsultation.ReplyText);
     database.AddInParameter(sqlStringCommand, "ReplyDate", DbType.DateTime, productConsultation.ReplyDate);
     database.AddInParameter(sqlStringCommand, "ReplyUserId", DbType.Int32, productConsultation.ReplyUserId);
     database.AddInParameter(sqlStringCommand, "ConsultationId", DbType.Int32, productConsultation.ConsultationId);
     return (database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
Пример #6
0
 public static ProductConsultationInfo PopulateProductConsultation(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     ProductConsultationInfo info = new ProductConsultationInfo();
     info.ConsultationId = (int) reader["ConsultationId"];
     info.ProductId = (int) reader["ProductId"];
     info.UserId = (int) reader["UserId"];
     info.UserName = (string) reader["UserName"];
     info.ConsultationText = (string) reader["ConsultationText"];
     info.ConsultationDate = (DateTime) reader["ConsultationDate"];
     info.UserEmail = (string) reader["UserEmail"];
     if (DBNull.Value != reader["ReplyText"])
     {
         info.ReplyText = (string) reader["ReplyText"];
     }
     if (DBNull.Value != reader["ReplyDate"])
     {
         info.ReplyDate = new DateTime?((DateTime) reader["ReplyDate"]);
     }
     if (DBNull.Value != reader["ReplyUserId"])
     {
         info.ReplyUserId = new int?((int) reader["ReplyUserId"]);
     }
     return info;
 }
Пример #7
0
 public static bool InsertProductConsultation(ProductConsultationInfo productConsultation)
 {
     Globals.EntityCoding(productConsultation, true);
     return ProductProvider.Instance().InsertProductConsultation(productConsultation);
 }
Пример #8
0
 public override bool InsertProductConsultation(ProductConsultationInfo productConsultation)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Hishop_ProductConsultations(ProductId, UserId, UserName, UserEmail, ConsultationText, ConsultationDate)VALUES(@ProductId, @UserId, @UserName, @UserEmail, @ConsultationText, @ConsultationDate)");
     this.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productConsultation.ProductId);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.String, productConsultation.UserId);
     this.database.AddInParameter(sqlStringCommand, "UserName", DbType.String, productConsultation.UserName);
     this.database.AddInParameter(sqlStringCommand, "UserEmail", DbType.String, productConsultation.UserEmail);
     this.database.AddInParameter(sqlStringCommand, "ConsultationText", DbType.String, productConsultation.ConsultationText);
     this.database.AddInParameter(sqlStringCommand, "ConsultationDate", DbType.DateTime, productConsultation.ConsultationDate);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
Пример #9
0
 public abstract bool ReplyProductConsultation(ProductConsultationInfo productConsultation);
Пример #10
0
 public abstract bool InsertProductConsultation(ProductConsultationInfo productConsultation);
Пример #11
0
 public static bool InsertProductConsultation(ProductConsultationInfo productConsultation)
 {
     return new ProductConsultationDao().InsertProductConsultation(productConsultation);
 }