Exemplo n.º 1
0
        public ActionResult RegUser()
        {
            string code = this.HttpContext.Request.QueryString["code"];
            string tmp_web_url = this.HttpContext.Request.QueryString["web_url"];

            string web_url = System.Web.HttpUtility.UrlDecode(tmp_web_url);

            if (CommonLib.Common.Validate.IsNullString(web_url) != "")
            {
                if (web_url == "http://wx.yune-jia.com/")
                {
                    web_url = "/";
                }
                else
                {
                    web_url = web_url.Replace("http://wx.yune-jia.com/", "/");
                }
            }
            else
            {
                web_url = "/";
            }

            string open_id = this.getOpenId(code);

            Models.Student stu = this.getUserInfo(open_id);

            string student_id = this.addStudent(stu);

            if (student_id == null)
                ViewData["data"] = "用户注册失败!";
            else
            {
                JxLib.StudentController studentController = new JxLib.StudentController();
                JxLib.CouponController couponController = new JxLib.CouponController();

                System.Collections.Hashtable item = studentController.load(student_id);

                //System.Collections.Hashtable coupon = new System.Collections.Hashtable();

                //coupon.Add("CouponText", "98元学车体验券");
                //coupon.Add("Amount", "98");
                //coupon.Add("Password", "");
                //coupon.Add("StudentID", student_id);
                //coupon.Add("CreateAt", DateTime.Now.ToString("yyyy-MM-dd"));
                //coupon.Add("ModifyAt", DateTime.Now.ToString("yyyy-MM-dd"));

                //couponController.add(coupon);

                if (item["SchoolID"].ToString() == "")
                {
                    System.Collections.Hashtable coupon1 = new System.Collections.Hashtable();

                    coupon1.Add("CouponText", "300元学车券");
                    coupon1.Add("Amount", "300");
                    coupon1.Add("Password", couponController.getPassword());
                    coupon1.Add("StudentID", student_id);
                    coupon1.Add("CreateAt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    coupon1.Add("ModifyAt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                    couponController.add(coupon1);
                }

                CacheLib.Cookie cookie = new CacheLib.Cookie();

                cookie.AddCookie("user_id", student_id);

                ViewData["data"] = student_id;
                ViewData["url"] = web_url;
            }

            return View();
        }
Exemplo n.º 2
0
 public ActionResult StudentCoupon(string id)
 {
     this.init();
     JxLib.StudentController studentController = new JxLib.StudentController();
     System.Collections.Hashtable item = studentController.load(id);
     ViewData["item"] = item;
     ViewData["title"] = "发放优惠卷";
     ViewData["open_menu"] = "驾校管理";
     return View();
 }
Exemplo n.º 3
0
        public ActionResult MyIndex()
        {
            JxLib.StudentController studentController = new JxLib.StudentController();
            CacheLib.Cookie cookie = new CacheLib.Cookie();

            string user_id = cookie.GetCookie("user_id");

            ViewData["data"] = studentController.load(user_id);
            ViewData["user_id"] = user_id;
            ViewData["title"] = "我的首页";

            return View();
        }