public ActionResult UseCouponSave() { JxLib.CouponController couponController = new JxLib.CouponController(); DatabaseLib.Tools tools = new DatabaseLib.Tools(); string strParam = Request.Form.ToString(); System.Collections.Hashtable data = tools.paramToData(strParam); System.Collections.Hashtable item = couponController.loadByPassword(data["Password"].ToString()); if (item == null || item["IsUse"].ToString() != "0") { //报错跳转页面 return Redirect("/manage/coupon/result"); } return Redirect("/manage/coupon/result/"+ item["CouponID"].ToString()); }
public ActionResult StudentCouponSave() { JxLib.CouponController couponController = new JxLib.CouponController(); DatabaseLib.Tools tools = new DatabaseLib.Tools(); string strParam = Request.Form.ToString(); System.Collections.Hashtable data = tools.paramToData(strParam); string password = couponController.getPassword(); data.Add("Password", password); string coupon_id = couponController.add(data); //失败应该有一个错误页面 if (coupon_id == "") { return RedirectToRoute("manage-student-list"); } return RedirectToRoute("manage-student-list"); }
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(); }
public ActionResult CouponResult(string id) { JxLib.CouponController couponController = new JxLib.CouponController(); this.init(); if (id == null) { //报错跳转页面 ViewData["data"] = -1; } else { System.Collections.Hashtable item = couponController.load(id); couponController.useCoupon(item); if (couponController.Result) { //验证成功跳转 ViewData["data"] = 1; } else { //报错跳转页面 ViewData["data"] = 0; } } ViewData["title"] = "优惠卷验证结果"; ViewData["open_menu"] = "驾校管理"; return View(); }
public ActionResult MyCoupon() { JxLib.CouponController couponController = new JxLib.CouponController(); DatabaseLib.Tools tools = new DatabaseLib.Tools(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string user_id = cookie.GetCookie("user_id"); List<System.Collections.Hashtable> list = couponController.getByStuentId(user_id); ViewData["data"] = list; ViewData["title"] = "我的优惠卷"; return View(); }