Beispiel #1
0
    protected void btn_Login_Click(object sender, EventArgs e)
    {
        Session["User"] = null;
        string UserName = this.username.Value;
        string Password = this.password.Value;

        EShop.Model.Account_User objUser = bllUser.GetModelList(string.Format(" AccountName = '{0}'", UserName)).FirstOrDefault();
        if (objUser == null)
        {
            this.usernameTip.InnerText = "用户名不存在或密码错误!";
        }
        else
        {
            if (objUser.Password != Password)
            {
                this.usernameTip.InnerText = "用户名不存在或密码错误!";
            }
            else
            {
                //跳转至Back Page
                Session["User"] = objUser;
                Response.Redirect("~/product/Omate.aspx", true);
            }
        }
    }
Beispiel #2
0
 protected void btn_SaveBasicInfo_Click(object sender, EventArgs e)
 {
     EShop.Model.Account_User        objUser        = Session["User"] as EShop.Model.Account_User;
     EShop.Model.Account_UserDetails objUserDetails = bllUserDetails.GetModelList(string.Format(" UserCode = '{0}'", objUser.UserCode)).FirstOrDefault();
     objUserDetails          = objUserDetails == null ? new EShop.Model.Account_UserDetails() : objUserDetails;
     objUser.Email           = this.email.Text;
     objUserDetails.UserCode = objUser.UserCode;
     try
     {
         objUserDetails.Birthday = DateTime.Parse(this.birthday.Value);
     }
     catch (Exception)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新失败!请填写生日!');</script>");
         return;
     }
     objUserDetails.Gender     = int.Parse(this.gender.SelectedValue);
     objUserDetails.OfficeTEL  = this.offictel.Value;
     objUserDetails.FamilyTEL  = this.familytel.Value;
     objUserDetails.Phone      = this.cellphone.Text;
     objUserDetails.PwdTipCode = this.passQuestion.SelectedValue;
     objUserDetails.PwdTipAns  = this.pwdanswer.Value;
     if (bllUserDetails.UpdateBasicInfo(objUser, objUserDetails) == 1)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "success", "<script>alert('更新成功!');</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新失败!');</script>");
     }
 }
Beispiel #3
0
 protected void btn_Submit_Click(object sender, EventArgs e)
 {
     EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User;
     if (objUser == null)
     {
         Server.Transfer("~/account/Login.aspx");
     }
     else
     {
         bool isNew = false;
         EShop.Model.Account_Cart objCart = null;
         objCart = bllCart.GetModelList(string.Format(" UserCode = '{0}' and GoodsCode = '{1}' and Status = '1'", objUser.UserCode, this.goods.Value)).FirstOrDefault();
         EShop.Model.Goods_BaseInfo objGoods = bllBasic.GetModelList(" GoodsCode = '" + this.goods.Value + "'").FirstOrDefault();
         if (objCart == null)
         {
             isNew               = true;
             objCart             = new EShop.Model.Account_Cart();
             objCart.UserCode    = objUser.UserCode;
             objCart.GoodsCode   = objGoods.GoodsCode;
             objCart.MarketPrice = objGoods.MarketPrice;
             objCart.OurPrice    = objGoods.OurPrice;
             objCart.BuyCount    = 1;
             objCart.SubTotal    = objGoods.OurPrice;
             objCart.Status      = 1;
         }
         else
         {
             objCart.BuyCount += 1;
             objCart.SubTotal  = objCart.OurPrice * objCart.BuyCount;
         }
         if (isNew)
         {
             isNew = bllCart.Add(objCart) == 1;
         }
         else
         {
             isNew = bllCart.Update(objCart);
         }
         if (isNew)
         {
             Server.Transfer("~/product/Cart.aspx");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('购买失败!请重试!');</script>");
         }
     }
 }
Beispiel #4
0
 void FormInitialize()
 {
     EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User;
     this.email.Text = objUser.Email;
     EShop.Model.Account_UserDetails objUserDetails = bllUserDetails.GetModelList(string.Format(" UserCode = '{0}'", objUser.UserCode)).FirstOrDefault();
     if (objUserDetails != null)
     {
         this.birthday.Value             = objUserDetails.Birthday.Value.ToString("yyyy/MM/dd");
         this.gender.SelectedValue       = objUserDetails.Gender.ToString();
         this.offictel.Value             = objUserDetails.OfficeTEL;
         this.familytel.Value            = objUserDetails.FamilyTEL;
         this.cellphone.Text             = objUserDetails.Phone;
         this.passQuestion.SelectedValue = objUserDetails.PwdTipCode;
         this.pwdanswer.Value            = objUserDetails.PwdTipAns;
     }
 }
Beispiel #5
0
    protected void btn_register_Click(object sender, EventArgs e)
    {
        string UserName   = this.username.Value;
        string Password   = this.password.Value;
        string RePassword = this.repassword.Value;
        string Email      = this.email.Value;

        //密码是否一致
        if (!Password.Equals(RePassword))
        {
            this.repwdchk.InnerText = "两次输入的密码不一致!";
            return;
        }
        //用户名是否存在 邮箱是否已经被注册
        DataTable dt = bllUser.GetList(string.Format(" AccountName = '{0}' or Email = '{1}'", UserName, Email)).Tables[0];

        foreach (DataRow row in dt.Rows)
        {
            if (row.Field <string>("AccountName") == UserName)
            {
                this.namechk.InnerText = "该用户名已被注册!";
                return;
            }
            if (row.Field <string>("Email") == Email)
            {
                this.emailchk.InnerText = "该邮箱已被注册!";
                return;
            }
        }
        EShop.Model.Account_User objUser = new EShop.Model.Account_User();
        objUser.UserCode    = Guid.NewGuid().ToString().Replace("-", "");
        objUser.AccountName = UserName;
        objUser.Password    = Password;
        objUser.Email       = Email;
        objUser.Status      = 1; //1正常 0禁用
        if (bllUser.Add(objUser) <= 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "wrong", "<script>alert('注册失败!请重试!');</script>");
        }
        else
        {
            //将User加入Session
            Session["User"] = objUser;
            //页面跳转至商品介绍页
            Server.Transfer("~/product/Omate.aspx");
        }
    }
Beispiel #6
0
    void OrdersBind(int pagesize, int pageindex)
    {
        EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User;
        StringBuilder            strbody = new StringBuilder();
        DataTable dt = bllOrder.GetListByPage(" Orderer = '" + objUser.UserCode + "'", "Id", pagesize * (pageindex - 1), pagesize * pageindex).Tables[0];

        foreach (DataRow row in dt.Rows)
        {
            strbody.Append("<tr>");
            strbody.Append("<td bgcolor='#ffffff' align='center'>" + row["OrderCode"] + "</td>");
            strbody.Append("<td bgcolor='#ffffff' align='center'>" + row["OrderDate"] + "</td>");
            strbody.Append("<td bgcolor='#ffffff' align='center'>" + string.Format("{0:c2}", row["Total"]) + "</td>");
            strbody.Append("<td bgcolor='#ffffff' align='center'>" + (row["Status"].ToString().Equals("1") ? "有效" : "失效") + "</td>");
            strbody.Append("<td bgcolor='#ffffff' align='center'>取消</td>");
            strbody.Append("</tr>");
        }
        this.tbody.InnerHtml   = strbody.ToString();
        this.currentPage.Value = pageindex.ToString();
    }
Beispiel #7
0
    void OrdersBind(int pagesize, int pageindex)
    {
        EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User;
        StringBuilder            strbody = new StringBuilder();
        DataTable dt = bllCoupon.GetUserCouponByPage(" UserCode = '" + objUser.UserCode + "'", "Id", pagesize * (pageindex - 1), pagesize * pageindex).Tables[0];

        foreach (DataRow row in dt.Rows)
        {
            strbody.Append("<tr>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + row["CouponCode"] + "</td>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + row["CouponName"] + "</td>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + string.Format("{0:c2}", row["Price"]) + "</td>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + string.Format("{0:c2}", row["MinOrPrice"]) + "</td>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + DateTime.Parse(row["AbortUseDate"].ToString()).ToString("yyyy-MM-dd") + "</td>");
            strbody.Append("<td align='center' bgcolor='#FFFFFF'>" + ConvertCouponStatus(row["Status"].ToString()) + "</td>");
            strbody.Append("</tr>");
        }
        this.tbody.InnerHtml   = strbody.ToString();
        this.currentPage.Value = pageindex.ToString();
    }
Beispiel #8
0
    protected void btn_ChangePwd_Click(object sender, EventArgs e)
    {
        EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User;
        bool result = false;

        if (objUser.Password.Equals(this.oldpassword.Value))
        {
            if (this.newpassword.Value.Equals(this.confirmpassword.Value))
            {
                objUser.Password = this.newpassword.Value;
                result           = true;
            }
        }
        if (result)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新成功!');</script>");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新失败!');</script>");
        }
    }
Beispiel #9
0
 public int UpdateBasicInfo(EShop.Model.Account_User objUser, EShop.Model.Account_UserDetails objUserDetails)
 {
     return(dal.UpdateBasicInfo(objUser, objUserDetails));
 }
Beispiel #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(EShop.Model.Account_User model)
 {
     return(dal.Update(model));
 }
Beispiel #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(EShop.Model.Account_User model)
 {
     return(dal.Add(model));
 }