Ejemplo n.º 1
0
        public ActionResult Edit(System.Int64? id, Z01PaperTemplate entity)
        {
            entity.TemplateID = id;
            string formPaperTemplateType = Request.Form["PaperTemplateType"];
            entity.PaperTemplateType = formPaperTemplateType.ToEnumInt32();

            ValidateZ01PaperTemplate(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.TemplateID = null;
                    entity.TenantID = _tenant.TenantID;
                    db.Insert(entity);
                }

                return Return();
            }
            catch
            {
                return View(entity);
            }
        }
Ejemplo n.º 2
0
 protected void ValidateZ01PaperTemplate(Z01PaperTemplate entity)
 {
     if (!string.IsNullOrEmpty(entity.Title) && entity.Title.Length > 300)
     {
         ModelState.AddModelError("Title string length error", "标题:填写的内容太多");
     }
 }
Ejemplo n.º 3
0
 public ActionResult Edit(System.Int64? id, string act)
 {
     Z01PaperTemplate 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 = Z01PaperTemplateHelper.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 Z01PaperTemplate();
     }
     string returnUrl                         = Request["ReturnUrl"];
     if (returnUrl.IsNullOrEmpty()) returnUrl = "/" + _ContollerName;
     ViewData["ReturnUrl"] = returnUrl;
     return View(entity);
 }
Ejemplo n.º 4
0
        public ActionResult Details(System.Int64 id)
        {
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
            {
                return(RedirectToAction("NoPermission", "Error"));
            }
            Z01PaperTemplate entity = Z01PaperTemplateHelper.Create(db, id);

            return(View(entity));
        }
Ejemplo n.º 5
0
        public ActionResult Edit(System.Int64?id, string act)
        {
            Z01PaperTemplate 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 = Z01PaperTemplateHelper.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 Z01PaperTemplate();
            }
            string returnUrl = Request["ReturnUrl"];

            if (returnUrl.IsNullOrEmpty())
            {
                returnUrl = "/" + _ContollerName;
            }
            ViewData["ReturnUrl"] = returnUrl;
            return(View(entity));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(System.Int64?id, Z01PaperTemplate entity)
        {
            entity.TemplateID = id;
            string formPaperTemplateType = Request.Form["PaperTemplateType"];

            entity.PaperTemplateType = formPaperTemplateType.ToEnumInt32();


            ValidateZ01PaperTemplate(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.TemplateID = null;
                    entity.TenantID   = _tenant.TenantID;
                    db.Insert(entity);
                }

                return(Return());
            }
            catch
            {
                return(View(entity));
            }
        }
Ejemplo n.º 7
0
 public static int Insert(Zippy.Data.IDalProvider db, Z01PaperTemplate entity)
 {
     int rtn = db.Insert(entity);
     return rtn;
 }
Ejemplo n.º 8
0
 public static int Update(Zippy.Data.IDalProvider db, Z01PaperTemplate entity)
 {
     return db.Update(entity);
 }
Ejemplo n.º 9
0
 public static int Update(Zippy.Data.IDalProvider db, Z01PaperTemplate entity)
 {
     return(db.Update(entity));
 }
Ejemplo n.º 10
0
        public static int Insert(Zippy.Data.IDalProvider db, Z01PaperTemplate entity)
        {
            int rtn = db.Insert(entity);

            return(rtn);
        }
Ejemplo n.º 11
0
        public static Z01PaperTemplate Create(Zippy.Data.IDalProvider db, Int64 _TemplateID)
        {
            Z01PaperTemplate rtn = db.FindUnique <Z01PaperTemplate>(_TemplateID);

            return(rtn);
        }
Ejemplo n.º 12
0
 protected void ValidateZ01PaperTemplate(Z01PaperTemplate entity)
 {
     if (!string.IsNullOrEmpty(entity.Title) && entity.Title.Length > 300)
         ModelState.AddModelError("Title string length error", "标题:填写的内容太多");
 }