Exemplo n.º 1
0
 protected void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         Muser.Id = userid;
         if (txfUserName.Value == String.Empty)
         {
             Response.Write("<script>alert('用户名不能为空,请重新输入')</script>");
             return;
         }
         if (txfPhone.Value == String.Empty)
         {
             Response.Write("<script>alert('电话不能为空,请重新输入')</script>");
             return;
         }
         if (txfNickName.Value == String.Empty)
         {
             Response.Write("<script>alert('昵称不能为空,请重新输入')</script>");
             return;
         }
         Muser.Username = txfUserName.Value;
         Muser.Phone    = txfPhone.Value;
         Muser.Mail     = txfEmail.Value;
         Muser.Nickname = txfNickName.Value;
         Muser.Address  = txfAddress.Value;
         user.Update(Muser);
         Session["username"] = Muser.Username;
         Response.Write("<script>alert('修改成功')</script>");
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('修改失败')</script>");
         return;
     }
 }
Exemplo n.º 2
0
        protected void btnModPwd_Click(object sender, EventArgs e)
        {
            try
            {
                // === modified bu jeffery
                //DataHandler.PageAction pa = new DataHandler.PageAction();
                // ===
                QPS.NEW.BLL.Users   Buser = new QPS.NEW.BLL.Users();
                QPS.NEW.Model.Users Muser = Buser.GetModel(userid);
                // === modified by jeffery
                //if (pa.getStatus(pa.ModifyPwd("http://59.175.238.107:8080", Session["username"].ToString(), txfModPwd.Value, "dfd8915f711b45c78c2b15ef70528699")) != "true")
                //{
                //    Response.Write("<script>alert('修改密码失败')</script>");
                //    return;
                //}
                // ===
                if (QPS.NEW.BLL.MD5Helper.Encode(txfOriginalPwd.Value) != Muser.Password)
                {
                    Response.Write("<script>alert('原始密码错误,请重新输入')</script>");
                    return;
                }
                if (txfModPwd.Value != txfRepwd.Value)
                {
                    Response.Write("<script>alert('确认密码与修改密码不一致,请重新输入')</script>");
                    return;
                }
                if (txfModPwd.Value == string.Empty)
                {
                    Response.Write("<script>alert('确认密码不能为空,请重新输入')</script>");
                    return;
                }
                Muser.Password = QPS.NEW.BLL.MD5Helper.Encode(txfModPwd.Value);
                Muser.Usertype = 0;
                user.Update(Muser);

                Response.Write("<script>alert('密码修改成功!')</script>");
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('修改失败!" + ex.ToString() + "')</script>");
            }
        }
Exemplo n.º 3
0
        protected void btnSub_Click(object sender, EventArgs e)
        {
            if (txbPhone.Text == "")
            {
                Response.Write("<script>alert('请填写手机号!')</script>");
                return;
            }
            string erromsg    = string.Empty;
            string celpattern = @"(^18\d{9}$)|(^13\d{9}$)|(^15\d{9}$)";

            if (txbNum.Text == "")
            {
                Response.Write("<script>alert('请填写预定人数!')</script>");
                return;
            }
            string IsNumeric = @"^[0-9]+$";

            if (!System.Text.RegularExpressions.Regex.IsMatch(txbNum.Text, IsNumeric))
            {
                Response.Write("<script>alert('请填写数字!')</script>");
                return;
            }
            if (Calendar1.SelectedDate.ToString() == "" || Calendar2.SelectedDate.ToString() == "")
            {
                Response.Write("<script>alert('请填写预定预定时间!')</script>");
                return;
            }
            if (txbPhone.Text != "")
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(txbPhone.Text, celpattern))
                {
                    Response.Write("<script>alert('输入的手机号有错误,请重新输入!')</script>");
                    return;
                }
            }
            try
            {
                //生成一张订单 然后 修改房间信息表的房间状态  最后添加积分信息
                double   starthour = Convert.ToDouble(this.dplStartTime.SelectedValue);
                DateTime ddd       = this.Calendar1.SelectedDate;
                DateTime startdate = this.Calendar1.SelectedDate.AddHours(starthour);
                double   endhour   = Convert.ToDouble(this.dplEndTime.SelectedValue);
                DateTime enddate   = this.Calendar2.SelectedDate.AddHours(endhour);
                if (startdate >= enddate)
                {
                    Response.Write("<script>alert('起始时间不应该早于结束时间,请认真填写预定时间')</script>");
                    return;
                }
                Morder.Roomid      = roomid;
                Morder.Userid      = userid;
                Morder.StartTime   = startdate;
                Morder.endTime     = enddate;
                Morder.OrderNumber = txbNum.Text.Trim();
                Border.Add(Morder);
                QPS.NEW.Model.Room r = room.GetModel(roomid);
                r.RoomState = 1;
                room.Update(r);
                QPS.NEW.BLL.Users   Buser = new QPS.NEW.BLL.Users();
                QPS.NEW.Model.Users Muser = Buser.GetModel(userid);
                Muser.Phone = txbPhone.Text.Trim();
                Buser.Update(Muser);
                Response.Write("<script>alert('预定成功!');window.location.href='MainPage.aspx'</script>");
                //Response.Redirect("MainPage.aspx", false);
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('预定失败!')</script>");
                return;
            }
        }
Exemplo n.º 4
0
        public string getResult(string action)
        {
            switch (action)
            {
            case "register":
                if (validate("register"))
                {
                    Muser.Username = ht["username"].ToString();
                    Muser.Nickname = ht["nickname"].ToString();
                    Muser.Password = ht["password"].ToString();
                    Muser.Sign     = "";
                    Muser.Usertype = 0;
                    if (Buser.Add(Muser) > 0)
                    {
                        return("true");
                    }
                    else
                    {
                        return("false");
                    }
                }
                else
                {
                    return("false");
                }

            case "login":
                if (validate("login"))
                {
                    if (Buser.Denglu(ht["username"].ToString(), ht["password"].ToString()))
                    {
                        Session["username"] = ht["username"].ToString();
                        return("true");
                    }
                    else
                    {
                        return("false");
                    }
                }
                else
                {
                    return("false");
                }

            case "score":
                if (validate("score"))
                {
                    string  uname  = ht["username"].ToString();
                    DataSet dsUser = Buser.GetList("Username='******'");
                    userid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]);
                    QPS.NEW.Model.Integral u = BInt.GetModel(userid);

                    if (u.TotalMoney == (int)ht["originalscore"])
                    {
                        u.TotalMoney = +(int)ht["score"];
                        if (BInt.Update(u))
                        {
                            return("true");
                        }
                        else
                        {
                            return("fales");
                        }
                    }
                    else
                    {
                        return("false");
                    }
                }
                else
                {
                    return("false");
                }

            case "editpwd":
                if (validate("editpwd"))
                {
                    string  uname  = ht["username"].ToString();
                    DataSet dsUser = Buser.GetList("Username='******'");
                    userid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]);
                    QPS.NEW.Model.Users u = Buser.GetModel(userid);
                    u.Password = ht["newpassword"].ToString();
                    if (Buser.Update(u))
                    {
                        return("true");
                    }
                    else
                    {
                        return("false");
                    }
                }
                else
                {
                    return("false");
                }

            case "logout":
                if (validate("logout"))
                {
                    if (Session["username"] != null)
                    {
                        Session.Remove("username");
                        return("true");
                    }
                    else
                    {
                        return("false");
                    }
                }
                else
                {
                    return("false");
                }

            default: return("false");
            }
        }
Exemplo n.º 5
0
 protected void btnSub_Click(object sender, EventArgs e)
 {
     if (txbPhone.Text == "")
     {
         Response.Write("<script>alert('请填写手机号!')</script>");
         return;
     }
     string erromsg = string.Empty;
     string celpattern = @"(^18\d{9}$)|(^13\d{9}$)|(^15\d{9}$)";
     if (txbNum.Text == "")
     {
         Response.Write("<script>alert('请填写预定人数!')</script>");
         return;
     }
     string IsNumeric = @"^[0-9]+$";
     if (!System.Text.RegularExpressions.Regex.IsMatch(txbNum.Text, IsNumeric))
     {
         Response.Write("<script>alert('请填写数字!')</script>");
         return;
     }
     if (Calendar1.SelectedDate.ToString() == "" || Calendar2.SelectedDate.ToString() == "")
     {
         Response.Write("<script>alert('请填写预定预定时间!')</script>");
         return;
     }
     if (txbPhone.Text != "")
     {
         if (!System.Text.RegularExpressions.Regex.IsMatch(txbPhone.Text, celpattern))
         {
             Response.Write("<script>alert('输入的手机号有错误,请重新输入!')</script>");
             return;
         }
     }
     try
     {
         //生成一张订单 然后 修改房间信息表的房间状态  最后添加积分信息
         double starthour = Convert.ToDouble(this.dplStartTime.SelectedValue);
         DateTime ddd = this.Calendar1.SelectedDate;
         DateTime startdate = this.Calendar1.SelectedDate.AddHours(starthour);
         double endhour = Convert.ToDouble(this.dplEndTime.SelectedValue);
         DateTime enddate = this.Calendar2.SelectedDate.AddHours(endhour);
         if (startdate >= enddate)
         {
             Response.Write("<script>alert('起始时间不应该早于结束时间,请认真填写预定时间')</script>");
             return;
         }
         Morder.Roomid = roomid;
         Morder.Userid = userid;
         Morder.StartTime = startdate;
         Morder.endTime = enddate;
         Morder.OrderNumber = txbNum.Text.Trim();
         Border.Add(Morder);
         QPS.NEW.Model.Room r = room.GetModel(roomid);
         r.RoomState = 1;
         room.Update(r);
         QPS.NEW.BLL.Users Buser = new QPS.NEW.BLL.Users();
         QPS.NEW.Model.Users Muser = Buser.GetModel(userid);
         Muser.Phone = txbPhone.Text.Trim();
         Buser.Update(Muser);
         Response.Write("<script>alert('预定成功!');window.location.href='MainPage.aspx'</script>");
         //Response.Redirect("MainPage.aspx", false);
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('预定失败!')</script>");
         return;
     }
 }