Example #1
0
        public ActionResult Edit(System.Int64? id, Z01Brand entity)
        {
            entity.BrandID = id;

            ValidateZ01Brand(entity);
            if (!ModelState.IsValid)
                return View(entity);
            try
            {
                if (id.HasValue && id > 0)
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Update) != Zippy.SaaS.Entity.CRUD.Update) return RedirectToAction("NoPermission", "Error");
                    db.Update(entity);
                }
                else
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Create) != Zippy.SaaS.Entity.CRUD.Create) return RedirectToAction("NoPermission", "Error");
                    entity.BrandID = null;
                    entity.TenantID = _tenant.TenantID;
                    db.Insert(entity);
                }

                return Return();
            }
            catch
            {
                return View(entity);
            }
        }
Example #2
0
        public ActionResult Edit(System.Int64? id, string act)
        {
            Z01Brand entity = null;
            if (id.HasValue && id > 0)
            {
                if (act == "detail")
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read) return RedirectToAction("NoPermission", "Error");
                    ViewData["VTitle"] = "查看品牌信息";
                    ViewData["IsDetail"] = true;
                }
                else
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Update) != Zippy.SaaS.Entity.CRUD.Update) return RedirectToAction("NoPermission", "Error");
                    ViewData["VTitle"] = "修改品牌信息";
                }
                entity = Z01BrandHelper.Create(db, id.Value);
            }
            else
            {
                if ((_crud & Zippy.SaaS.Entity.CRUD.Create) != Zippy.SaaS.Entity.CRUD.Create) return RedirectToAction("NoPermission", "Error");
                ViewData["VTitle"] = "新增品牌";
                entity = new Z01Brand();
            }

            string returnUrl = Request["ReturnUrl"];
            if (returnUrl.IsNullOrEmpty()) returnUrl = "/" + _ContollerName;
            ViewData["ReturnUrl"] = returnUrl;
            return View(entity);
        }
Example #3
0
        public ActionResult Details(System.Int64 id)
        {
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
            {
                return(RedirectToAction("NoPermission", "Error"));
            }
            Z01Brand entity = Z01BrandHelper.Create(db, id);

            return(View(entity));
        }
Example #4
0
 protected void ValidateZ01Brand(Z01Brand entity)
 {
     if (!string.IsNullOrEmpty(entity.Title) && entity.Title.Length > 300)
     {
         ModelState.AddModelError("Title string length error", "名称:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.ImagePath) && entity.ImagePath.Length > 500)
     {
         ModelState.AddModelError("ImagePath string length error", "Logo:填写的内容太多");
     }
 }
Example #5
0
        public ActionResult SaveAjax(string tt)
        {
            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            Z01Brand brand             = new Z01Brand();

            brand.Title    = tt;
            brand.TenantID = _tenant.TenantID;
            brand.Creator  = _user.UserID;
            var bid = db.Insert(brand);

            res._state = true;
            res._data.Add("title", tt);
            res._data.Add("id", bid);
            return(Content(res.ToJson()));
        }
Example #6
0
        public ActionResult Edit(System.Int64?id, string act)
        {
            Z01Brand entity = null;

            if (id.HasValue && id > 0)
            {
                if (act == "detail")
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    ViewData["VTitle"]   = "查看品牌信息";
                    ViewData["IsDetail"] = true;
                }
                else
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Update) != Zippy.SaaS.Entity.CRUD.Update)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    ViewData["VTitle"] = "修改品牌信息";
                }
                entity = Z01BrandHelper.Create(db, id.Value);
            }
            else
            {
                if ((_crud & Zippy.SaaS.Entity.CRUD.Create) != Zippy.SaaS.Entity.CRUD.Create)
                {
                    return(RedirectToAction("NoPermission", "Error"));
                }
                ViewData["VTitle"] = "新增品牌";
                entity             = new Z01Brand();
            }

            string returnUrl = Request["ReturnUrl"];

            if (returnUrl.IsNullOrEmpty())
            {
                returnUrl = "/" + _ContollerName;
            }
            ViewData["ReturnUrl"] = returnUrl;
            return(View(entity));
        }
Example #7
0
        public ActionResult Edit(System.Int64?id, Z01Brand entity)
        {
            entity.BrandID = id;


            ValidateZ01Brand(entity);
            if (!ModelState.IsValid)
            {
                return(View(entity));
            }
            try
            {
                if (id.HasValue && id > 0)
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Update) != Zippy.SaaS.Entity.CRUD.Update)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    db.Update(entity);
                }
                else
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Create) != Zippy.SaaS.Entity.CRUD.Create)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    entity.BrandID  = null;
                    entity.TenantID = _tenant.TenantID;
                    db.Insert(entity);
                }

                return(Return());
            }
            catch
            {
                return(View(entity));
            }
        }
Example #8
0
 public static int Update(Zippy.Data.IDalProvider db, Z01Brand entity)
 {
     return(db.Update(entity));
 }
Example #9
0
        public static int Insert(Zippy.Data.IDalProvider db, Z01Brand entity)
        {
            int rtn = db.Insert(entity);

            return(rtn);
        }
Example #10
0
        public static Z01Brand Create(Zippy.Data.IDalProvider db, Int64 _BrandID)
        {
            Z01Brand rtn = db.FindUnique <Z01Brand>(_BrandID);

            return(rtn);
        }
Example #11
0
 /// <summary>
 /// 表示 [生产商] 对应的实体
 /// </summary>
 public static Z01Customer GetProducerEntity(Zippy.Data.IDalProvider db, Z01Brand entity)
 {
     return(db.FindUnique <Z01Customer>("CustomerID=@CustomerID", db.CreateParameter("CustomerID", entity.Producer)));
 }
Example #12
0
 protected void ValidateZ01Brand(Z01Brand entity)
 {
     if (!string.IsNullOrEmpty(entity.Title) && entity.Title.Length > 300)
         ModelState.AddModelError("Title string length error", "名称:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.ImagePath) && entity.ImagePath.Length > 500)
         ModelState.AddModelError("ImagePath string length error", "Logo:填写的内容太多");
 }
Example #13
0
 public ActionResult SaveAjax(string tt)
 {
     EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
     Z01Brand brand = new Z01Brand();
     brand.Title = tt;
     brand.TenantID = _tenant.TenantID;
     brand.Creator = _user.UserID;
     var bid = db.Insert(brand);
     res._state = true;
     res._data.Add("title", tt);
     res._data.Add("id", bid);
     return Content(res.ToJson());
 }
Example #14
0
 public static int Insert(Zippy.Data.IDalProvider db, Z01Brand entity)
 {
     int rtn = db.Insert(entity);
     return rtn;
 }
Example #15
0
 /// <summary>
 /// 表示 [生产商] 对应的实体
 /// </summary>
 public static Z01Customer GetProducerEntity(Zippy.Data.IDalProvider db, Z01Brand entity)
 {
     return db.FindUnique<Z01Customer>("CustomerID=@CustomerID", db.CreateParameter("CustomerID", entity.Producer));
 }
Example #16
0
 public static int Update(Zippy.Data.IDalProvider db, Z01Brand entity)
 {
     return db.Update(entity);
 }