コード例 #1
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
    }
コード例 #2
0
    protected void lnkLogin_Click(object sender, EventArgs e)
    {
        #region 验证
        if (username.Value.Trim().Length == 0)
        {
            Alert("请输入您的换客名!");
            Select(username);
            return;
        }

        if (userpwd.Value.Trim().Length == 0)
        {
            Alert("请输入您的密码!");
            Select(userpwd);
            return;
        }
        #endregion

        #region  系统登陆

        if (XiHuan_UserFacade.IsUserValid(username.Value, userpwd.Value))
        {
            int      uid = XiHuan_UserFacade.GetIdByName(username.Value);
            DateTime dt  = DateTime.MinValue;
            if (autologin.Checked)
            {
                dt = DateTime.Now.AddDays(14);
            }
            CommonMethod.AddLoginCookie(uid, username.Value, dt);
            string path = CommonMethod.FinalString(Request["path"]);
            if (path.Length > 0)
            {
                Response.Redirect(Server.UrlDecode(path));
            }
            else
            {
                Response.Redirect("membercenter.aspx");
            }
        }
        else
        {
            Alert("换客名或密码不正确,请重试!");
            return;
        }
        #endregion
    }
コード例 #3
0
ファイル: loginiframe.aspx.cs プロジェクト: gangqiang/xihuan
    protected void btnLogin_Click1(object sender, EventArgs e)
    {
        #region  务器端验证

        if (txtUserName.Text.Trim().Length == 0)
        {
            Alert("请输入您的换客名!");
            Select(txtUserName);
            return;
        }

        if (txtPwd.Text.Trim().Length == 0)
        {
            Alert("请输入您的密码!");
            Select(txtPwd);
            return;
        }


        #endregion

        #region  系统登陆

        if (XiHuan_UserFacade.IsUserValid(txtUserName.Text, txtPwd.Text))
        {
            int      uid = XiHuan_UserFacade.GetIdByName(txtUserName.Text);
            DateTime dt  = DateTime.MinValue;
            if (chkAutoLogin.Checked)
            {
                dt = DateTime.Now.AddDays(14);
            }
            CommonMethod.AddLoginCookie(uid, txtUserName.Text, dt);
            Alert("您已成功登录,请在窗口关闭后继续刚才的操作 ^_^!");
            ExecScript("parent.ymPrompt.close();");
        }
        else
        {
            Alert("换客名或密码不正确,请重试!");
            return;
        }
        #endregion
    }
コード例 #4
0
    protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
    {
        #region 验证
        if (txtUserName.Text.Trim().Length == 0)
        {
            Alert("请输入您的换客名!");
            Select(txtUserName);
            return;
        }

        if (txtPwd.Text.Trim().Length == 0)
        {
            Alert("请输入您的密码!");
            Select(txtPwd);
            return;
        }
        #endregion

        #region 换客登陆

        string usernmae = Microsoft.JScript.GlobalObject.unescape(hidUserName.Value.Trim());
        string pwd      = Microsoft.JScript.GlobalObject.unescape(hidPwd.Value.Trim());

        if (XiHuan_UserFacade.IsUserValid(usernmae, pwd))
        {
            int      uid = XiHuan_UserFacade.GetIdByName(usernmae);
            DateTime dt  = DateTime.MinValue;
            if (chkAutoLogin.Checked)
            {
                dt = DateTime.Now.AddDays(14);
            }
            CommonMethod.AddLoginCookie(uid, usernmae, dt);
            Response.Redirect("membercenter.aspx");
        }
        else
        {
            Alert("用户名或密码不正确,请重试!");
            ExecScript("window.location='login.aspx';");
        }
        #endregion
    }
コード例 #5
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
    }
コード例 #6
0
ファイル: messagereply.aspx.cs プロジェクト: gangqiang/xihuan
    protected void btnSend_Click(object sender, EventArgs e)
    {
        #region  务器端验证

        if (!IsUserAlreadyLogin)
        {
            MemberCenterPageRedirect("", "membermessage.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 (txtReceiver.Enabled && !XiHuan_UserFacade.IsUserNameAlreayUse(txtReceiver.Text))
            {
                Alert("收件人不存在,请查证后再发!");
                Select(txtReceiver);
                return;
            }
        }
        #endregion

        #region 短消息发送操作

        XiHuan_MessageFacade.SendNewMessage(CurrentUserId, XiHuan_UserFacade.GetIdByName(txtReceiver.Text), CurrentUserName, txtReceiver.Text, txtContent.Text, null, false);
        if (Request["type"].Equals("receive"))
        {
            XiHuan_MessageEntity message = new XiHuan_MessageEntity();
            message.Id = CommonMethod.ConvertToInt(Request["id"], 0);
            message.Retrieve();
            if (message.IsPersistent)
            {
                message.Flag = (byte)XiHuan_MessageFacade.MessageState.已回复;
                message.Save();
            }
        }

        Alert("恭喜:短消息发送成功!");
        if (Request["type"].Equals("other"))
        {
            ExecScript("parent.ymPrompt.close();");
        }
        else
        {
            ExecScript(string.Format("parent.location='membermessage.aspx?type={0}&s='+Math.random();", Request["type"]));
        }
        #endregion
    }