예제 #1
0
 //
 // GET: /CouPon/Create
 public ActionResult Create()
 {
     if (Session["ID"] != null)
     {
         CouPon cp = new CouPon();
         return View(cp);
     }
     else {
         Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "CouPon"));
         return RedirectToAction("LogOn", "Account");
     }
 }
예제 #2
0
        //
        // GET: /CouPon/Create
        public ActionResult Create()
        {
            Session.Add("ActiveClass", "CouPonCreate");
            if (Session["ID"] != null)
            {
                var shop = QLSHOPRes.GetShopByAccount(int.Parse(Session["ID"].ToString()));
                if (shop != null)
                {
                    CouPon cp = new CouPon();
                    return View(cp);
                }
                else
                {
                    ModelState.AddModelError("", "Bạn chưa có Shop");
                    return View("Error");
                }

            }
            else {
                Session.Add("UrlRedirect", Url.AbsoluteAction("Create", "CouPon"));
                return RedirectToAction("LogOn", "Account");
            }
        }
예제 #3
0
 public void Delete(CouPon dm)
 {
     en.DeleteObject(dm);
 }
예제 #4
0
 public void Add(CouPon dm)
 {
     /*  var q = (from p in en.CouPon select p).Max();
     dm.ID = q + 1;*/
     en.AddObject("CouPon", dm);
 }
예제 #5
0
        public ActionResult Create(FormCollection collection)
        {
            // TODO: Add insert logic here
            if (ModelState.IsValid)
            {
                var cp = new CouPon();
                // TODO: Add insert logic here
                cp.maCoupon = collection["maCoupon"];
                cp.diaChi = collection["diaChi"];
                cp.dienThoai = collection["dienThoai"];
                cp.diDong = collection["diDong"];
                cp.giaTri = collection["giaTri"];
                IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
                String datetime = collection["tuNgay"];
                DateTime tn = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                datetime = collection["denNgay"];
                DateTime dn = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                cp.tuNgay = tn;
                cp.denNgay = dn;
                cp.apDung = collection["apDung"];
                cp.khongApDung = collection["khongApDung"];
                cp.website = collection["website"];
                cp.ghiChu = collection["noidung"];
                cp.ngayTao = DateTime.Now;
                cp.account_ID = 1;
                if (collection["PreviewSubmitName"] == null && collection["PreviewBack"] == null)
                {
                    CPRes.Add(cp);
                    CPRes.Save();
                    if (collection["SaveSubmitName"] != null)
                    {
                        return RedirectToAction("Details", new { id = cp.CouPon_ID });
                    }
                    else if (collection["AddSubmitName"] != null)
                    {
                        return RedirectToAction("Create");
                    }
                    else if (collection["PreviewBack"] != null)
                    {
                        return View("Create",cp);
                    }
                    else {
                        return View();
                    }
                } if (collection["PreviewSubmitName"] != null)
                {
                    return View("Preview", cp);
                }
                else if (collection["PreviewBack"] != null)
                {
                    return View("Create", cp);
                }
                else {
                    return View();
                }

            }
            else
            {
                return View();
            }
        }
예제 #6
0
 //
 // GET: /CouPon/Create
 public ActionResult Create()
 {
     CouPon cp = new CouPon();
     return View(cp);
 }
 /// <summary>
 /// Create a new CouPon object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static CouPon CreateCouPon(global::System.Int32 id)
 {
     CouPon couPon = new CouPon();
     couPon.ID = id;
     return couPon;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the CouPons EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCouPons(CouPon couPon)
 {
     base.AddObject("CouPons", couPon);
 }