コード例 #1
0
ファイル: UserHandle.cs プロジェクト: ud223/jx
        /// <summary>
        /// 保存登陆用户票据
        /// </summary>
        /// <param name="key"></param>
        public void saveTicket(string key)
        {
            CacheLib.Cookie cookie = new CacheLib.Cookie();
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "auth", DateTime.Now, DateTime.Now.AddMinutes(60), false, key, FormsAuthentication.FormsCookiePath);

            string encTicket = FormsAuthentication.Encrypt(ticket);
            //清除老的票据
            cookie.Delete("auth");

            cookie.AddCookie("auth", encTicket);
        }
コード例 #2
0
ファイル: CodeHandle.cs プロジェクト: ud223/jx
        public void Save()
        {
            CacheLib.Cache cache = new CacheLib.Cache();
            CacheLib.Cookie cookie = new CacheLib.Cookie();

            string key = cache.Add<DataTable>("codes", this.Codes);

            cookie.AddCookie("codes", key);
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: ud223/jx
        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();
        }