protected void btnReplyProductConsultation_Click(object sender, EventArgs e) { ProductConsultationInfo productConsultation = SubsiteCommentsHelper.GetProductConsultation(this.consultationId); if (string.IsNullOrEmpty(this.fckReplyText.Text)) { productConsultation.ReplyText = null; } else { productConsultation.ReplyText = this.fckReplyText.Text; } productConsultation.ReplyUserId = new int?(HiContext.Current.User.UserId); productConsultation.ReplyDate = new DateTime?(DateTime.Now); ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else if (SubsiteCommentsHelper.ReplyProductConsultation(productConsultation)) { this.fckReplyText.Text = string.Empty; this.ShowMsg("成功回复了选择的商品咨询", true); } else { this.ShowMsg("回复商品咨询失败", false); } }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["ConsultationId"], out this.consultationId)) { base.GotoResourceNotFound(); } else { this.btnReplyProductConsultation.Click += this.btnReplyProductConsultation_Click; if (!this.Page.IsPostBack) { ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(this.consultationId); if (productConsultation == null) { base.GotoResourceNotFound(); } else { this.litUserName.Text = productConsultation.UserName; this.litConsultationText.Text = productConsultation.ConsultationText; this.lblTime.Time = productConsultation.ConsultationDate; } } } }
public List <ProductConsultationInfo> SearchbyPid(string pid) { List <ProductConsultationInfo> list = new List <ProductConsultationInfo>(); MySqlParameter pidparamter = new MySqlParameter("pid", MySqlDbType.Int64); pidparamter.Value = pid; DataTable dt = IndexService.Common.MySqlHelper.Search("SELECT c.* FROM himall_productconsultations AS c JOIN himall_products AS p ON c.ProductId=@pid", new MySqlParameter[] { pidparamter }); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { ProductConsultationInfo info = new ProductConsultationInfo(); info.Id = long.Parse(dt.Rows[i]["Id"].ToString()); info.ProductId = long.Parse(dt.Rows[i]["ProductId"].ToString()); info.ShopId = long.Parse(dt.Rows[i]["ShopId"].ToString()); info.ShopName = dt.Rows[i]["ShopName"].ToString(); info.UserId = long.Parse(dt.Rows[i]["UserId"].ToString()); info.UserName = dt.Rows[i]["UserName"].ToString(); info.Email = dt.Rows[i]["Email"].ToString(); info.ConsultationContent = dt.Rows[i]["ConsultationContent"].ToString(); info.ConsultationDate = DateTime.Parse(dt.Rows[i]["ConsultationDate"].ToString()); info.ReplyContent = dt.Rows[i]["ReplyContent"].ToString(); info.ReplyDate = DateTime.Parse(dt.Rows[i]["ReplyDate"].ToString()); list.Add(info); } } return(list); }
protected void btnReplyProductConsultation_Click(object sender, EventArgs e) { ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(this.consultationId); productConsultation.ReplyText = this.txtReply.Text; if (string.IsNullOrEmpty(productConsultation.ReplyText)) { this.ShowMsg("回复内容不能为空", false); } else { productConsultation.ReplyUserId = HiContext.Current.ManagerId; productConsultation.ReplyDate = DateTime.Now; ValidationResults validationResults = Validation.Validate(productConsultation, "Reply"); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(item.Message); } this.ShowMsg(text, false); } else if (ProductCommentHelper.ReplyProductConsultation(productConsultation)) { this.txtReply.Text = string.Empty; base.CloseWindow(null); } else { this.ShowMsg("回复商品咨询失败", false); } } }
public bool ReplyProductConsultation(ProductConsultationInfo productConsultation) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_ProductConsultations SET ReplyText = @ReplyText, ReplyDate = @ReplyDate, ReplyUserId = @ReplyUserId WHERE ConsultationId = @ConsultationId"); this.database.AddInParameter(sqlStringCommand, "ReplyText", System.Data.DbType.String, productConsultation.ReplyText); this.database.AddInParameter(sqlStringCommand, "ReplyDate", System.Data.DbType.DateTime, productConsultation.ReplyDate); this.database.AddInParameter(sqlStringCommand, "ReplyUserId", System.Data.DbType.Int32, productConsultation.ReplyUserId); this.database.AddInParameter(sqlStringCommand, "ConsultationId", System.Data.DbType.Int32, productConsultation.ConsultationId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public override bool ReplyProductConsultation(ProductConsultationInfo productConsultation) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE distro_ProductConsultations SET ReplyText = @ReplyText, ReplyDate = @ReplyDate, ReplyUserId = @ReplyUserId WHERE ConsultationId = @ConsultationId AND DistributorUserId=@DistributorUserId"); this.database.AddInParameter(sqlStringCommand, "ReplyText", DbType.String, productConsultation.ReplyText); this.database.AddInParameter(sqlStringCommand, "ReplyDate", DbType.DateTime, productConsultation.ReplyDate); this.database.AddInParameter(sqlStringCommand, "ReplyUserId", DbType.Int32, productConsultation.ReplyUserId); this.database.AddInParameter(sqlStringCommand, "ConsultationId", DbType.Int32, productConsultation.ConsultationId); this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public static bool InsertProductConsultation(ProductConsultationInfo productConsultation) { Globals.EntityCoding(productConsultation, true); bool flag = new ProductConsultationDao().Add(productConsultation, null) > 0; if (flag) { ProductHelper.ClearProductCahe(productConsultation.ProductId); } return(flag); }
public bool InsertProductConsultation(ProductConsultationInfo productConsultation) { System.Data.Common.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", System.Data.DbType.Int32, productConsultation.ProductId); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.String, productConsultation.UserId); this.database.AddInParameter(sqlStringCommand, "UserName", System.Data.DbType.String, productConsultation.UserName); this.database.AddInParameter(sqlStringCommand, "UserEmail", System.Data.DbType.String, productConsultation.UserEmail); this.database.AddInParameter(sqlStringCommand, "ConsultationText", System.Data.DbType.String, productConsultation.ConsultationText); this.database.AddInParameter(sqlStringCommand, "ConsultationDate", System.Data.DbType.DateTime, productConsultation.ConsultationDate); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public void ReplyConsultation(long id, string replyContent, long shopId) { ProductConsultationInfo nullable = context.ProductConsultationInfo.FindBy((ProductConsultationInfo item) => item.Id == id && item.ShopId == shopId).FirstOrDefault(); if (shopId == 0 || nullable == null) { throw new HimallException("不存在该产品评论"); } nullable.ReplyContent = replyContent; nullable.ReplyDate = new DateTime?(DateTime.Now); context.SaveChanges(); }
public override bool InsertProductConsultation(ProductConsultationInfo productConsultation) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO distro_ProductConsultations(ProductId, UserId,DistributorUserId, UserName, UserEmail, ConsultationText, ConsultationDate)VALUES(@ProductId, @UserId,@DistributorUserId, @UserName, @UserEmail, @ConsultationText, @ConsultationDate)"); this.database.AddInParameter(sqlStringCommand, "ProductId", System.Data.DbType.Int32, productConsultation.ProductId); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.String, productConsultation.UserId); this.database.AddInParameter(sqlStringCommand, "DistributorUserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId.Value); this.database.AddInParameter(sqlStringCommand, "UserName", System.Data.DbType.String, productConsultation.UserName); this.database.AddInParameter(sqlStringCommand, "UserEmail", System.Data.DbType.String, productConsultation.UserEmail); this.database.AddInParameter(sqlStringCommand, "ConsultationText", System.Data.DbType.String, productConsultation.ConsultationText); this.database.AddInParameter(sqlStringCommand, "ConsultationDate", System.Data.DbType.DateTime, productConsultation.ConsultationDate); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public void btnRefer_Click(object sender, System.EventArgs e) { ProductConsultationInfo productConsultationInfo = new ProductConsultationInfo(); productConsultationInfo.ConsultationDate = System.DateTime.Now; productConsultationInfo.ProductId = this.productId; productConsultationInfo.UserId = Hidistro.Membership.Context.HiContext.Current.User.UserId; productConsultationInfo.UserName = this.txtUserName.Text; productConsultationInfo.UserEmail = this.txtEmail.Text; productConsultationInfo.ConsultationText = Globals.HtmlEncode(this.txtContent.Text); ValidationResults validationResults = Validation.Validate <ProductConsultationInfo>(productConsultationInfo, new string[] { "Refer" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMessage(text, false); } else { if (string.IsNullOrEmpty(this.txtConsultationCode.Value)) { this.ShowMessage("请输入验证码", false); } else { if (!Hidistro.Membership.Context.HiContext.Current.CheckVerifyCode(this.txtConsultationCode.Value.Trim())) { this.ShowMessage("验证码不正确", false); } else { if (ProductProcessor.InsertProductConsultation(productConsultationInfo)) { 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); } } } } }
public ProductConsultationInfo GetProductConsultation(int consultationId) { ProductConsultationInfo result = null; string query = "SELECT * FROM Hishop_ProductConsultations WHERE ConsultationId=@ConsultationId"; System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "ConsultationId", System.Data.DbType.Int32, consultationId); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <ProductConsultationInfo>(dataReader); } return(result); }
public void AddConsultation(ProductConsultationInfo model) { var product = DbFactory.Default.Get <ProductInfo>().Where(a => a.Id == model.ProductId && a.IsDeleted == false).FirstOrDefault(); if (product != null) { model.ShopId = product.ShopId; model.ShopName = DbFactory.Default.Get <ShopInfo>().Where(a => a.Id == model.ShopId).Select(p => p.ShopName).FirstOrDefault <string>(); } else { throw new Himall.Core.HimallException("咨询的商品不存在,或者已删除"); } DbFactory.Default.Add(model); }
public void AddConsultation(ProductConsultationInfo model) { var product = Context.ProductInfo.Where(a => a.Id == model.ProductId && a.IsDeleted == false).FirstOrDefault(); if (product != null) { model.ShopId = product.ShopId; model.ShopName = Context.ShopInfo.Where(a => a.Id == model.ShopId).Select(p => p.ShopName).FirstOrDefault(); } else { throw new Himall.Core.HimallException("咨询的商品不存在,或者已删除"); } Context.ProductConsultationInfo.Add(model); Context.SaveChanges(); }
public override ProductConsultationInfo GetProductConsultation(int consultationId) { ProductConsultationInfo info = null; string query = "SELECT * FROM distro_ProductConsultations WHERE ConsultationId=@ConsultationId AND DistributorUserId=@DistributorUserId"; DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "ConsultationId", DbType.Int32, consultationId); this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulateProductConsultation(reader); } } return(info); }
public void ProcessRequest(HttpContext context) { wid = context.Session[DTKeys.SESSION_WEB_ID] as string; if (string.IsNullOrEmpty(wid)) { return; } context.Response.ContentType = "text/plain"; int num = 0; int.TryParse(context.Request["id"].ToString(), out num); string str = context.Request["content"].ToString(); if ((num > 0) && !string.IsNullOrEmpty(str)) { ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(num); productConsultation.ReplyText = str; productConsultation.ReplyUserId = new int?(Globals.GetCurrentManagerUserId()); productConsultation.ReplyDate = new DateTime?(DateTime.Now); ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string str2 = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { str2 = str2 + Formatter.FormatErrorMessage(result.Message); } context.Response.Write("{\"type\":\"error\",\"data\":\"" + str2 + "\"}"); } if (ProductCommentHelper.ReplyProductConsultation(productConsultation)) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); } else { context.Response.Write("{\"type\":\"success\",\"data\":\"回复商品咨询失败\"}"); } } else { context.Response.Write("{\"type\":\"success\",\"data\":\"回复商品咨询失败\"}"); } }
public void AddConsultation(ProductConsultationInfo model) { ProductInfo productInfo = ( from a in context.ProductInfo where a.Id == model.ProductId && (int)a.SaleStatus != 4 select a).FirstOrDefault(); if (productInfo == null) { throw new HimallException("咨询的产品不存在,或者已删除"); } model.ShopId = productInfo.ShopId; model.ShopName = ( from a in context.ShopInfo where a.Id == model.ShopId select a into p select p.ShopName).FirstOrDefault(); context.ProductConsultationInfo.Add(model); context.SaveChanges(); }
protected void btnReplyProductConsultation_Click(object sender, System.EventArgs e) { ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(this.consultationId); if (string.IsNullOrEmpty(this.fckReplyText.Text)) { productConsultation.ReplyText = null; } else { productConsultation.ReplyText = this.fckReplyText.Text; } productConsultation.ReplyUserId = new int?(Globals.GetCurrentManagerUserId()); productConsultation.ReplyDate = new System.DateTime?(System.DateTime.Now); ValidationResults results = Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results) { msg += Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else { if (ProductCommentHelper.ReplyProductConsultation(productConsultation)) { this.fckReplyText.Text = string.Empty; this.CloseWindow(); } else { this.ShowMsg("回复商品咨询失败", false); } } }
public JsonResult AddConsultation(string Content, long productId = 0L) { if (productId == 0) { Result result = new Result() { success = false, msg = "Consult Failed,this product has not exist or deleted!" }; return(Json(result)); } if (base.CurrentUser == null) { Result result1 = new Result() { success = false, msg = "Sign in timeout,please sign in again!" }; return(Json(result1)); } ProductConsultationInfo productConsultationInfo = new ProductConsultationInfo() { ConsultationContent = Content, ConsultationDate = DateTime.Now, ProductId = productId, UserId = base.CurrentUser.Id, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email }; ServiceHelper.Create <IConsultationService>().AddConsultation(productConsultationInfo); Result result2 = new Result() { success = true, msg = "Consult Success" }; return(Json(result2)); }
public void ProcessRequest(System.Web.HttpContext context) { context.Response.ContentType = "text/plain"; int num = 0; int.TryParse(context.Request["id"].ToString(), out num); string text = context.Request["content"].ToString(); if (num <= 0 || string.IsNullOrEmpty(text)) { context.Response.Write("{\"type\":\"success\",\"data\":\"回复商品咨询失败\"}"); return; } ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(num); productConsultation.ReplyText = text; productConsultation.ReplyUserId = new int?(Globals.GetCurrentManagerUserId()); productConsultation.ReplyDate = new System.DateTime?(System.DateTime.Now); ValidationResults validationResults = Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string text2 = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)) { text2 += Formatter.FormatErrorMessage(current.Message); } context.Response.Write("{\"type\":\"error\",\"data\":\"" + text2 + "\"}"); } if (ProductCommentHelper.ReplyProductConsultation(productConsultation)) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); return; } context.Response.Write("{\"type\":\"success\",\"data\":\"回复商品咨询失败\"}"); }
public JsonResult AddConsultation(string Content, long productId = 0L) { if (productId == 0) { Result result = new Result() { success = false, msg = "咨询失败,该产品不存在或已经删除!" }; return(Json(result)); } if (base.CurrentUser == null) { Result result1 = new Result() { success = false, msg = "登录超时,请重新登录!" }; return(Json(result1)); } ProductConsultationInfo productConsultationInfo = new ProductConsultationInfo() { ConsultationContent = Content, ConsultationDate = DateTime.Now, ProductId = productId, UserId = base.CurrentUser.Id, UserName = base.CurrentUser.UserName, Email = base.CurrentUser.Email }; ServiceHelper.Create <IConsultationService>().AddConsultation(productConsultationInfo); Result result2 = new Result() { success = true, msg = "咨询成功" }; return(Json(result2)); }
protected void btnReplyProductConsultation_Click(object sender, System.EventArgs e) { ProductConsultationInfo productConsultation = ProductCommentHelper.GetProductConsultation(this.consultationId); if (string.IsNullOrEmpty(this.fckReplyText.Text)) { productConsultation.ReplyText = null; } else { productConsultation.ReplyText = this.fckReplyText.Text; } productConsultation.ReplyUserId = new int?(Globals.GetCurrentManagerUserId()); productConsultation.ReplyDate = new System.DateTime?(System.DateTime.Now); ValidationResults validationResults = Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); return; } if (ProductCommentHelper.ReplyProductConsultation(productConsultation)) { this.fckReplyText.Text = string.Empty; this.ShowMsg("回复商品咨询成功", true); base.Response.Redirect("ProductConsultations.aspx"); return; } this.ShowMsg("回复商品咨询失败", false); }
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 = Globals.HtmlEncode(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); } }
protected void btnReplyProductConsultation_Click(object sender, System.EventArgs e) { ProductConsultationInfo productConsultation = SubsiteCommentsHelper.GetProductConsultation(this.consultationId); if (string.IsNullOrEmpty(this.fckReplyText.Text)) { productConsultation.ReplyText = null; } else { productConsultation.ReplyText = this.fckReplyText.Text; } productConsultation.ReplyUserId = new int?(Hidistro.Membership.Context.HiContext.Current.User.UserId); productConsultation.ReplyDate = new System.DateTime?(System.DateTime.Now); ValidationResults validationResults = Validation.Validate <ProductConsultationInfo>(productConsultation, new string[] { "Reply" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); return; } if (SubsiteCommentsHelper.ReplyProductConsultation(productConsultation)) { this.fckReplyText.Text = string.Empty; this.ShowMsg("成功回复了选择的商品咨询", true); return; } this.ShowMsg("回复商品咨询失败", false); }
public static bool ReplyProductConsultation(ProductConsultationInfo productConsultation) { return(CommentsProvider.Instance().ReplyProductConsultation(productConsultation)); }
public static bool InsertProductConsultation(ProductConsultationInfo productConsultation) { Globals.EntityCoding(productConsultation, true); return(ProductProvider.Instance().InsertProductConsultation(productConsultation)); }
public JsonResult Detail(long id) { ProductConsultationInfo consultation = ServiceHelper.Create <IConsultationService>().GetConsultation(id); return(Json(new { ConsulationContent = consultation.ConsultationContent, ReplyContent = consultation.ReplyContent })); }
public static bool InsertProductConsultation(ProductConsultationInfo productConsultation) { return(new ProductConsultationDao().InsertProductConsultation(productConsultation)); }
public static bool ReplyProductConsultation(ProductConsultationInfo productConsultation) { return((new ProductConsultationDao()).ReplyProductConsultation(productConsultation)); }
public static bool ReplyProductConsultation(ProductConsultationInfo productConsultation) { return(new ProductConsultationDao().Update(productConsultation, null)); }