Esempio n. 1
0
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     if (IsUserAlreadyLogin)
     {
         if (!XiHuan_UserFacade.IsUserValid(CurrentUserName, txtOldPassWord.Text))
         {
             Alert("原密码不正确");
             return;
         }
         else
         {
             XiHuan_UserInfoEntity modifypwd = XiHuan_UserInfoEntityAction.RetrieveAXiHuan_UserInfoEntity(CurrentUserId);
             if (modifypwd != null)
             {
                 modifypwd.OrignalPwd = txtNewPassWord.Text.Trim();
                 modifypwd.Md5Pwd     = CommonMethod.MD5Encrypt(txtNewPassWord.Text.Trim());
                 modifypwd.Save();
                 Alert("恭喜:您的密码已成功修改!");
             }
         }
     }
     else
     {
         MemberCenterPageRedirect("", "modifypwd");
     }
 }
Esempio n. 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
    }
Esempio n. 3
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
    }
Esempio n. 4
0
    private void CheckUserName(string username)
    {
        username = Microsoft.JScript.GlobalObject.unescape(username);
        string ffzf = CommonMethodFacade.ValidFFZF(username);

        if (ffzf.Length > 0)
        {
            CommonMethod.ResponseAjaxContent(this, "您输入的用户名含有非法字符:" + ffzf);
        }
        if (XiHuan_UserFacade.IsUserNameAlreayUse(username))
        {
            CommonMethod.ResponseAjaxContent(this, "0");
        }
        else
        {
            CommonMethod.ResponseAjaxContent(this, "1");
        }
    }
Esempio n. 5
0
    private void BindData()
    {
        XiHuan_UserSearchFilter f = new XiHuan_UserSearchFilter();

        f.SelectFileds = " u.Id,u.UserName,u.HeadImage,u.ProvinceName,u.CityName,u.AreaName,u.SchoolName,u.RegisterDate,u.LastLoginTime,u.GoodsNumber,u.QQ,u.WangWang  ";
        f.UserName     = txtGoodName.Text;
        f.ProvinceId   = CommonMethod.ConvertToInt(ddlProvince.SelectedValue, int.MaxValue);
        f.CityId       = CommonMethod.ConvertToInt(Request["city"], int.MaxValue);
        f.AreaId       = CommonMethod.ConvertToInt(Request["ddlArea"], int.MaxValue);
        f.SchooId      = CommonMethod.ConvertToInt(Request["school"], int.MaxValue);
        f.IsHavePhoto  = chkHavePhoto.Checked ? 1 : int.MaxValue;
        f.IsStartUser  = chkStarUser.Checked ? 1 : int.MaxValue;
        f.Gender       = CommonMethod.ConvertToInt(ddlGender.SelectedValue, int.MaxValue);
        string value = ddlTime.SelectedValue.Trim();

        if (value.Trim().Length > 0)
        {
            DateTime dtbegin = DateTime.MinValue;
            if (value.Equals("0"))
            {
                dtbegin = DateTime.Now.AddDays(-7);
            }
            if (value.Equals("1"))
            {
                dtbegin = DateTime.Now.AddMonths(-1);
            }
            if (value.Equals("2"))
            {
                dtbegin = DateTime.Now.AddMonths(-3);
            }
            f.CreateDateBegin = dtbegin;
            f.CreateDateEnd   = DateTime.Now;
        }

        f.OrderByParam = ddlOrderBy.SelectedValue + " desc ";
        f.PageIndex    = PageBar1.PageIndex;
        int       rowcount = 0;
        DataTable dt       = XiHuan_UserFacade.SearchUser(f, out rowcount);

        rptGoodsList.DataSource = dt;
        rptGoodsList.DataBind();
        PageBar1.RecordCount = rowcount;
        PageBar1.Draw();
    }
Esempio n. 6
0
    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
    }
Esempio n. 7
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
    }
Esempio n. 8
0
    protected void lnkSubmit_Click(object sender, EventArgs e)
    {
        #region  务器端验证

        int provinceid = CommonMethod.ConvertToInt(ddlProvince.SelectedValue, 0);
        int cityid     = CommonMethod.ConvertToInt(ddlCity.SelectedValue, 0);
        int areaid     = CommonMethod.ConvertToInt(ddlArea.SelectedValue, 0);
        int schoolid   = CommonMethod.ConvertToInt(ddlSchool.SelectedValue, 0);
        if (txtUserName.Text.Trim().Length == 0)
        {
            Alert(" 请您填写换客名!");
            Select(txtUserName);
            return;
        }

        else if (XiHuan_UserFacade.IsUserNameAlreayUse(txtUserName.Text))
        {
            Alert("您填写的换客名已经被占用,请您换个换客名重试!");
            Select(txtUserName);
            return;
        }

        if (txtPassWord.Text.Trim().Length == 0)
        {
            Alert("请您填写密码!");
            Select(txtPassWord);
            return;
        }

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

        if (!txtPassWord.Text.Trim().Equals(txtPassWord2.Text.Trim()))
        {
            Alert("两次密码输入不一致,请重新输入!");
            Select(txtPassWord2);
            return;
        }

        if (txtEmail.Text.Trim().Length > 0)
        {
            Regex reg = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
            if (!reg.IsMatch(txtEmail.Text.Trim()))
            {
                Alert("您的邮箱格式填写不正确!");
                Select(txtEmail);
                return;
            }
        }

        if (provinceid == 0)
        {
            Alert("请您选择省份!");
            return;
        }

        if (cityid == 0)
        {
            Alert("请您选择城市!");
            return;
        }

        if (txtQuestion.Text.Trim().Length == 0)
        {
            Alert("请您填写安全提问问题!");
            Select(txtQuestion);
            return;
        }

        if (txtAnswer.Text.Trim().Length == 0)
        {
            Alert("请您填写安全提问答案!");
            Select(txtAnswer);
            return;
        }

        #endregion

        #region 用户基本信息

        Transaction           t       = new Transaction();
        XiHuan_UserInfoEntity NewUser = new XiHuan_UserInfoEntity();
        NewUser.UserType     = (int)XiHuan_UserFacade.UserType.个人注册;
        NewUser.UserName     = txtUserName.Text.Trim();
        NewUser.OrignalPwd   = txtPassWord.Text.Trim();
        NewUser.Md5Pwd       = CommonMethod.MD5Encrypt(txtPassWord.Text.Trim());
        NewUser.Email        = txtEmail.Text.Trim();
        NewUser.Gender       = Rad_sex_0.Checked ? (byte)1 : (byte)0;
        NewUser.ProvinceId   = provinceid;
        NewUser.ProvinceName = ddlProvince.SelectedItem.Text;
        NewUser.CityId       = cityid;
        if (cityid > 0)
        {
            NewUser.CityName = CommonMethodFacade.GetCityNameById(cityid.ToString());
        }
        NewUser.AreaId = areaid;
        if (areaid > 0)
        {
            NewUser.AreaName = CommonMethodFacade.GetAreaNameById(areaid.ToString());
        }
        if (schoolid > 0)
        {
            NewUser.SchoolId   = schoolid;
            NewUser.SchoolName = CommonMethodFacade.GetSchoolNameById(provinceid.ToString(), cityid.ToString(), schoolid.ToString());
        }

        NewUser.HuanBi       = SystemConfigFacade.Instance().RegisterAddHuanBi();
        NewUser.Score        = SystemConfigFacade.Instance().RegisterAddScore();
        NewUser.RegisterDate = NewUser.LastLoginTime = DateTime.Now;
        NewUser.Question     = txtQuestion.Text.Trim();
        NewUser.Answer       = txtAnswer.Text.Trim();
        NewUser.HeadImage    = "images/nophoto.gif";
        t.DoSaveObject(NewUser);

        #endregion

        #region 推荐人积分换币更新
        if (txtTuiJianMember.Text.Trim().Length > 0)
        {
            string updateTJ = string.Format("update XiHuan_UserInfo set Score=Score+{0},HuanBi=HuanBi+{1} where UserName='******' ",
                                            SystemConfigFacade.Instance().TuiJianAddScore(), SystemConfigFacade.Instance().TuiJianAddHuanBi(), txtTuiJianMember.Text.Trim());

            t.DoSqlNonQueryString(updateTJ, GlobalVar.DataBase_Name);
        }
        #endregion

        #region 给新注册用户发送短消息

        XiHuan_MessageFacade.SendNewMessage(1, NewUser.ID, "喜换网", NewUser.UserName, "尊敬的会员" + NewUser.UserName + "," + SystemConfigFacade.Instance().RegMesContent(), t, true);

        #endregion

        try
        {
            t.Commit();

            #region 注册完成后自动登陆调转到个人管理中心

            Alert("恭喜:您的注册信息已成功提交!");
            CommonMethod.AddLoginCookie(NewUser.ID, NewUser.UserName, DateTime.MinValue);
            SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "有人在喜换网注册了", "有人在喜换网注册了:" + txtUserName.Text);
            Response.Redirect("membercenter.aspx?action=" + Server.UrlEncode("membermanageindex.aspx"));

            #endregion
        }
        catch (Exception ex)
        {
            t.RollBack();
            Alert("抱歉:注册信息提交失败," + ex.Message + "请重试!");
            return;
        }
    }
Esempio n. 9
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
    }
Esempio n. 10
0
    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
    }