public string AddGuestBook(string title, string name, string cellphone, string content, string email, string guesttype, string sex, string workplace, string chuanzhen, string address) { BLL.GuestBook bll = new BLL.GuestBook(); BLL.GuestBookType bllguestbooktype = new BLL.GuestBookType(); Model.GuestBook model = new Model.GuestBook(); string strTypeName = bllguestbooktype.GetModel(Convert.ToInt32(guesttype)).dbo_TypeName; model.dbo_Address = address; model.dbo_CellPhone = cellphone; model.dbo_Content = content; model.dbo_Email = email; model.dbo_Flax = chuanzhen; model.dbo_GuestType = Convert.ToInt32(guesttype); model.dbo_GuestTypeName = strTypeName; model.dbo_IsReply = false; model.dbo_Name = name; model.dbo_Ptime = DateTime.Now; model.dbo_ReplyContent = ""; model.dbo_Sex = sex; model.dbo_Title = title; model.dbo_WorkName = workplace; bll.Add(model); string body = "尊敬的客户您好,您的留言已经收到,我们会尽快处理并回复到您的邮箱,请注意查收" + "<br /><br /><br />该邮箱为" + sys.webName + "回复留言的邮件,请勿直接回复<br /><br / >" + name + ",您在" + DateTime.Now + "的来信:<br>" + title + "<br>" + content; //sys.SendEmail(sys.webName + "的回复", body, txtEmail); //sys.SendEmail(sys.webName + "的消息", sys.webName + "收到用户:'" + name + " 邮箱:'" + email + "'的新邮件:<br>" + title + "<br>" + content, sys.mailAddress); return("1"); }
protected void btnAdd_Click(object sender, EventArgs e) { modelguestbook = bllguestbook.GetModel(Convert.ToInt32(id)); modelguestbook.dbo_IsReply = true; modelguestbook.dbo_ReplyContent = this.txtReplyContent.Text; modelguestbook.dbo_ReplyTime = DateTime.Now; modelguestbook.dbo_IsShow = this.rbtnIsShow.Items[0].Selected; bllguestbook.Update(modelguestbook); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('回复成功!');window.location.href='guestbooklist.aspx'", true); cycms.Model.Cycms modelcycms = bllcycms.GetModel(bllcycms.GetMaxId() - 1); sys.workPlace = modelcycms.dbo_WorkPlace; sys.lianXiren = modelcycms.dbo_LianXiRen; sys.cellPhone = modelcycms.dbo_CellPhone; sys.workPhone = modelcycms.dbo_WorkPohne; sys.flax = modelcycms.dbo_Flax; sys.mailAddress = modelcycms.dbo_MailAddress; sys.smtpServer = modelcycms.dbo_SmtpServer; sys.mailName = modelcycms.dbo_MailName; sys.mailPwd = modelcycms.dbo_MailPwd; string name = this.litName.Text; string ptime = this.litPtime.Text; string title = this.litTitle.Text; string content = this.litContent.Text; string mailto = this.litEmail.Text; string subject = sys.webName + "的回复"; string body = this.txtReplyContent.Text + "<br /><br /><br />该邮箱为" + sys.webName + "回复留言的邮件,请勿直接回复<br /><br / >" + name + ",您在" + ptime + "的来信:<br>" + title + "<br>" + content; if (sys.SendEmail(subject, body, mailto)) { sys.alert("回复成功,已经发送到邮箱。请选择其他操作"); } else { sys.alert("回复成功!但是由于邮箱地址错误或者服务器拒绝无法到达对方邮箱,请直接发送邮件至对方邮箱"); } sys.regisgerScirpt("window.location.href='guestbooklist.aspx'", "redirect"); }
protected void FillContent() { modelguestbook = bllguestbook.GetModel(Convert.ToInt32(id)); if (modelguestbook != null) { this.litContent.Text = modelguestbook.dbo_Content; this.litEmail.Text = modelguestbook.dbo_Email; this.litGuestTypeName.Text = modelguestbook.dbo_GuestTypeName; this.litName.Text = modelguestbook.dbo_Name; this.litPtime.Text = modelguestbook.dbo_Ptime.ToString(); this.txtReplyContent.Text = modelguestbook.dbo_ReplyContent; this.litCellPhone.Text = modelguestbook.dbo_CellPhone; this.litWorkName.Text = modelguestbook.dbo_WorkName.Trim() != "" ? modelguestbook.dbo_WorkName : "暂未公开"; this.litAddress.Text = modelguestbook.dbo_Address.Trim() != "" ? modelguestbook.dbo_Address : "暂未公开"; this.litFlax.Text = modelguestbook.dbo_Flax.Trim() != "" ? modelguestbook.dbo_Flax : "暂未公开"; if (modelguestbook.dbo_IsReply != true) { this.litReplyTime.Text = "未回复"; } else { this.litReplyTime.Text = modelguestbook.dbo_ReplyTime.ToString(); } bool IsShow = modelguestbook.dbo_IsShow; if (IsShow) { this.rbtnIsShow.SelectedIndex = 0; } else { this.rbtnIsShow.SelectedIndex = 1; } this.litSex.Text = modelguestbook.dbo_Sex; this.litTitle.Text = modelguestbook.dbo_Title; } }