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); } }
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); }
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)); }
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:填写的内容太多"); } }
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())); }
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)); }
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)); } }
public static int Update(Zippy.Data.IDalProvider db, Z01Brand entity) { return(db.Update(entity)); }
public static int Insert(Zippy.Data.IDalProvider db, Z01Brand entity) { int rtn = db.Insert(entity); return(rtn); }
public static Z01Brand Create(Zippy.Data.IDalProvider db, Int64 _BrandID) { Z01Brand rtn = db.FindUnique <Z01Brand>(_BrandID); return(rtn); }
/// <summary> /// 表示 [生产商] 对应的实体 /// </summary> public static Z01Customer GetProducerEntity(Zippy.Data.IDalProvider db, Z01Brand entity) { return(db.FindUnique <Z01Customer>("CustomerID=@CustomerID", db.CreateParameter("CustomerID", entity.Producer))); }
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:填写的内容太多"); }
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()); }
public static int Insert(Zippy.Data.IDalProvider db, Z01Brand entity) { int rtn = db.Insert(entity); return rtn; }
/// <summary> /// 表示 [生产商] 对应的实体 /// </summary> public static Z01Customer GetProducerEntity(Zippy.Data.IDalProvider db, Z01Brand entity) { return db.FindUnique<Z01Customer>("CustomerID=@CustomerID", db.CreateParameter("CustomerID", entity.Producer)); }
public static int Update(Zippy.Data.IDalProvider db, Z01Brand entity) { return db.Update(entity); }