Beispiel #1
0
    private void CheckeNotes()
    {
        Transaction t            = new Transaction();
        DataTable   dt           = Query.ProcessSql(@"SELECT Id,Content,ReplyContent FROM XiHuan_GuestBook WITH(nolock) WHERE IsChecked=0 ", GlobalVar.DataBase_Name);
        string      content      = string.Empty;
        string      replycontent = string.Empty;
        int         nid          = 0;

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                nid          = CommonMethod.ConvertToInt(dr["Id"], 0);
                content      = CommonMethod.FinalString(dr["Content"]);
                replycontent = CommonMethod.FinalString(dr["ReplyContent"]);
                if (CommonMethodFacade.ValidFFZF(content).Length == 0 && CommonMethodFacade.ValidFFZF(replycontent).Length == 0)
                {
                    XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
                    notesinfo.Id = nid;
                    notesinfo.Retrieve();
                    if (notesinfo.IsPersistent)
                    {
                        notesinfo.IsChecked = 1;
                        t.AddSaveObject(notesinfo);
                        XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
                        notechecknoticemessage.FromId   = 1;
                        notechecknoticemessage.FromName = "喜换网";
                        notechecknoticemessage.ToId     = notesinfo.FromId;
                        notechecknoticemessage.ToName   = notesinfo.FromName;
                        notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                                        notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
                        notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
                        notechecknoticemessage.CreateDate = DateTime.Now;
                        t.AddSaveObject(notechecknoticemessage);
                        if (t.Process())
                        {
                            #region   如果是对换品页面的留言,重新生成换品页
                            if (CommonMethod.ConvertToInt(nid, 0) > 0)
                            {
                                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                                Condition cgoods = rcgoods.GetNewCondition();
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, notesinfo.GoodsId);
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                                if (goods != null)
                                {
                                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + notesinfo.GoodsId, "../" + goods.DetailUrl);
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
        }
    }
Beispiel #2
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        #region  务器端验证

        if (!IsUserAlreadyLogin)
        {
            MemberCenterPageRedirect("", "membernotes.aspx?type=" + Request["type"]);
        }
        else
        {
            if (txtReceiver.Text.Trim().Length == 0)
            {
                Alert("请填写接收人!");
                Select(txtReceiver);
                return;
            }
            if (txtContent.Text.Trim().Length == 0)
            {
                Alert("请填写留言内容!");
                Select(txtContent);
                return;
            }
            if (txtContent.Text.Trim().Length > 200)
            {
                Alert("留言内容不能超过200字!");
                Select(txtContent);
                return;
            }
            if (!XiHuan_UserFacade.IsUserNameAlreayUse(txtReceiver.Text))
            {
                Alert("收件人不存在,请查证后再发!");
                Select(txtReceiver);
                return;
            }
        }
        #endregion

        #region 发送留言
        XiHuan_GuestBookEntity newguestbook = new XiHuan_GuestBookEntity();
        newguestbook.IsScerect  = chkSecret.Checked ? (byte)1 : (byte)0;
        newguestbook.ToId       = XiHuan_UserFacade.GetIdByName(txtReceiver.Text.Trim());
        newguestbook.ToName     = txtReceiver.Text.Trim();
        newguestbook.Content    = txtContent.Text.Trim();
        newguestbook.CreateDate = DateTime.Now;
        newguestbook.Flag       = (byte)XiHuan_UserNotesFacade.NotesState.未读;
        newguestbook.FromId     = CurrentUserId;
        newguestbook.FromName   = CurrentUserName;
        newguestbook.IsChecked  = 0;
        newguestbook.Save();
        Alert("恭喜:留言发送成功!");
        ExecScript(string.Format("parent.location='membernotes.aspx?type={0}&s='+Math.random();", Request["type"]));
        #endregion
    }
Beispiel #3
0
    private void CheckNotes(string id, string gid)
    {
        #region 留言通过审核,给留言人发送提醒短消息,提醒留言已通过审核

        Transaction            t         = new Transaction();
        XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
        notesinfo.Id = CommonMethod.ConvertToInt(id, 0);
        notesinfo.Retrieve();
        if (notesinfo.IsPersistent)
        {
            notesinfo.IsChecked = 1;
            t.AddSaveObject(notesinfo);
            XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
            notechecknoticemessage.FromId   = 1;
            notechecknoticemessage.FromName = "喜换网";
            notechecknoticemessage.ToId     = notesinfo.FromId;
            notechecknoticemessage.ToName   = notesinfo.FromName;
            notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                            notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
            notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
            notechecknoticemessage.CreateDate = DateTime.Now;
            t.AddSaveObject(notechecknoticemessage);
        }

        #endregion

        if (t.Process())
        {
            #region   如果是对换品页面的留言,重新生成换品页
            if (CommonMethod.ConvertToInt(gid, 0) > 0)
            {
                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                Condition cgoods = rcgoods.GetNewCondition();
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, gid);
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                if (goods != null)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + gid, "../" + goods.DetailUrl);
                }
            }
            #endregion

            Alert("恭喜:留言审核成功!");
            BindNotes(0);
        }
        else
        {
            t.RollBack();
        }
    }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsUserAlreadyLogin)
     {
         MemberCenterPageRedirect("", "membernotes.aspx?type=" + Request["type"]);
     }
     else if (!IsPostBack)
     {
         if (CommonMethod.ConvertToInt(Request["id"], 0) > 0)
         {
             XiHuan_GuestBookEntity note = new XiHuan_GuestBookEntity();
             note.Id = CommonMethod.ConvertToInt(Request["id"], 0);
             note.Retrieve();
             if (note.IsPersistent)
             {
                 txtContent.Text = CommonMethod.FinalString(note.ReplyContent);
             }
         }
     }
 }
Beispiel #5
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        #region 验证

        if (txtContent.Text.Trim().Length == 0)
        {
            Alert("请输入回复内容!");
            return;
        }

        #endregion

        XiHuan_GuestBookEntity note = new XiHuan_GuestBookEntity();
        note.Id = CommonMethod.ConvertToInt(Request["id"], 0);
        if (note.Id > 0)
        {
            note.Retrieve();
        }
        if (note.IsPersistent)
        {
            note.Flag         = (byte)XiHuan_UserNotesFacade.NotesState.已回复;
            note.ReplyContent = CommonMethod.ClearInputText(txtContent.Text, 200);
            note.IsChecked    = 0;
            note.Save();
            if (note.GoodsId > 0)
            {
                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                Condition cgoods = rcgoods.GetNewCondition();
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, note.GoodsId);
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                if (goods != null)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + note.GoodsId, goods.DetailUrl);
                }
            }
            Alert("恭喜:留言回复成功!");
            ExecScript(string.Format("parent.location='membernotes.aspx?type={0}';", Request["type"]));
        }
    }
Beispiel #6
0
    private void AddNotes()
    {
        #region 验证
        string username = CommonMethod.FinalString(Request["username"]);
        string userpass = CommonMethod.FinalString(Request["pwd"]);
        if (!IsUserAlreadyLogin)
        {
            if (username.Length == 0)
            {
                CommonMethod.ResponseAjaxContent(this.Page, "needusername");
                return;
            }

            if (userpass.Length == 0)
            {
                CommonMethod.ResponseAjaxContent(this.Page, "needpwd");
                return;
            }
        }

        #endregion

        #region 留言提交

        XiHuan_GuestBookEntity newguest = new XiHuan_GuestBookEntity();
        newguest.ToId      = CommonMethod.ConvertToInt(Request["oid"], 0);
        newguest.ToName    = GlobalObject.unescape(CommonMethod.FinalString(Request["oname"]));
        newguest.GoodsId   = CommonMethod.ConvertToInt(Request["gid"], 0);;
        newguest.GoodsName = GlobalObject.unescape(CommonMethod.FinalString(Request["gname"]));
        if (IsUserAlreadyLogin)
        {
            newguest.FromId   = CurrentUserId;
            newguest.FromName = CurrentUserName;
        }
        else
        {
            if (XiHuan_UserFacade.IsUserValid(username, userpass))
            {
                CommonMethod.AddLoginCookie(XiHuan_UserFacade.GetIdByName(username), username, DateTime.MinValue);
                newguest.FromName = username;
                newguest.FromId   = XiHuan_UserFacade.GetIdByName(username);
            }
            else
            {
                CommonMethod.ResponseAjaxContent(this.Page, "notvaliduser");
                return;
            }
        }

        newguest.Content    = GlobalObject.unescape(CommonMethod.FinalString(Request["content"]));
        newguest.IsScerect  = CommonMethod.FinalString(Request["issceret"]) == "true" ? (byte)1 : (byte)0;
        newguest.CreateDate = DateTime.Now;
        newguest.IsChecked  = 0;
        newguest.Save();
        SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "有人在喜换网留言了", "有人在喜换网留言了,快去审核吧!");
        if (CommonMethod.FinalString(Request["type"]).Equals("1"))
        {
            CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + newguest.GoodsId, CommonMethod.FinalString(Request["url"]));
        }
        CommonMethod.ResponseAjaxContent(this.Page, "ok");

        #endregion
    }