public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string telphone = context.Request["telphone"];
            string pwd      = context.Request["pwd"];
            string repwd    = context.Request["repwd"];
            string yan      = context.Request["yan"];
            string code     = context.Session["code"].ToString();

            if (yan != code)
            {
                context.Response.Write("验证码不正确,请重试");
            }
            else
            {
                if (pwd != repwd)
                {
                    context.Response.Write("两次密码不一致,请重试");
                }
                else
                {
                    bool flag = ub.Update(telphone, pwd);
                    if (flag)
                    {
                        Users u = ub.GetModel(telphone, pwd);
                        context.Session["user"] = u;
                        context.Response.Write("ok");
                    }
                    else
                    {
                        context.Response.Write("系统繁忙,请稍后重试");
                    }
                }
            }
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int      useerid  = Convert.ToInt32(context.Request["id"]);
            int      updateid = Convert.ToInt32(context.Request["dele"]);
            Users    u        = new Users();
            UsersBll ub       = new UsersBll();

            u             = ub.GetModel(useerid);
            u.UserStateId = updateid;
            ub.Update(u);
        }
Exemple #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string act = context.Request["act"].Trim2();

            if (act == "getBananaCount")
            {
                int count = getBananaCount(context);
                context.Response.Write(count);
            }
            else
            {
                HttpCookie cookie1 = new HttpCookie("shop");
                cookie1.Expires = DateTime.Now.AddDays(-1);
                context.Response.Cookies.Add(cookie1);
                context.Request.Cookies.Remove("shop");
                string result = "";
                try
                {
                    string name    = context.Request.Form["name"].ToString();
                    string phone   = context.Request.Form["phone"].ToString();
                    string provice = context.Request.Form["provice"].ToString();
                    string city    = context.Request.Form["city"].ToString();
                    string address = context.Request.Form["address"].ToString();
                    string pno     = context.Request.Form["pno"].ToString();
                    //int pro_id = context.Request.Form["pro_id"].ToString().ToInt();
                    //int count = context.Request.Form["count"].ToString().ToInt();
                    string data        = context.Request.Form["data"].ToString();
                    string payMentType = context.Request.Form["payMentType"].ToString();
                    int    price       = context.Request.Form["price"].ToString().ToInt();
                    int    bananaCount = context.Request.Form["bananaCount"].ToInt() * 10;

                    if (string.IsNullOrEmpty(data) || data.IndexOf("|") == -1)
                    {
                        result = "-1";
                    }
                    else
                    {
                        int      userid = 0;
                        UsersBll ubll   = new UsersBll();
                        //Cookie.Get("AdminInfo") == null
                        if (context.Request.Cookies["AdminInfo"] == null)
                        {
                            context.Response.Redirect("http://www.ibananas.cn/", false);
                            //如果没登录  直接  注册会员

                            //Users model = new Users();
                            //model.HeadUrl = "images/head.png"; //默认会员头像
                            //model.Address = provice + "省 " + city + "市 " + address;
                            //model.AddTime = DateTime.Now;
                            //model.UserName = name; //13732243651
                            //model.UserPwd = phone.Substring(7, 4); //电话后4位
                            //model.ProvinceId = provice.ToInt();
                            //model.CityId = provice.ToInt();
                            //model.Mobile = phone;
                            //model.RealName = name;
                            //model.NickName = name;
                            //model.UserType = 3;
                            //int temp = 0;
                            //Random rand = new Random();
                            //temp = rand.Next(1, 61);
                            //model.HeadUrl = "headfile/00" + temp + ".jpg";
                            //userid = ubll.AddAndReturn(model);

                            ////登录后 创建一个HttpCookie对象
                            ////AdminInfo admin = new AdminInfo();
                            ////admin.AdminId = userid;
                            ////admin.HeadUrl = model.HeadUrl;
                            ////admin.NickName = model.UserName;
                            ////admin.UserName = model.UserName;
                            ////HttpContext.Current.Session["Admininfo"] = admin;

                            ////创建一个HttpCookie对象  对进行编码
                            ////HttpUtility.UrlEncode
                            //HttpCookie cookie = new HttpCookie("AdminInfo");
                            //cookie.Values.Add("AdminId", HttpUtility.UrlEncode(userid.ToString()));
                            //cookie.Values.Add("HeadUrl", HttpUtility.UrlEncode(model.HeadUrl));
                            //cookie.Values.Add("NickName", HttpUtility.UrlEncode(model.UserName));
                            //cookie.Values.Add("UserName", HttpUtility.UrlEncode(model.UserName)); //进行编码


                            ////设定此cookies值
                            ////设定cookie的生命周期
                            //cookie.Expires = DateTime.Now.AddDays(7);
                            ////加入此cookie
                            //context.Response.AppendCookie(cookie);
                        }
                        else
                        {
                            //AdminInfo admin = (AdminInfo)HttpContext.Current.Session["AdminInfo"];
                            HttpCookie cookie = Cookie.Get("AdminInfo");
                            //用户输入 了电话和地址  记录最新
                            var currentuser =
                                ubll.GetByPrimaryKey(HttpUtility.UrlDecode(cookie.Values["AdminId"]).ToInt()).Entity;
                            currentuser.UserName = name;
                            currentuser.RealName = name;

                            currentuser.Mobile  = phone;
                            currentuser.Address = provice + "省 " + city + "市 " + address;
                            ubll.Update(currentuser);

                            userid = currentuser.Id;
                        }



                        //添加 订单 添加订单详情表
                        result = AddOrder(userid, data, price, pno, payMentType, bananaCount);
                        //如果是登录 会员
                    }
                }
                catch
                {
                    result = "-1";
                }


                context.Response.Write(result);
            }
        }