Esempio n. 1
0
        public ActionResult Edit(System.Int64? id, Z01Bank entity)
        {
            entity.BankID = id;

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

                return Return();
            }
            catch
            {
                return View(entity);
            }
        }
Esempio n. 2
0
        public ActionResult Edit(System.Int64? id, string act)
        {
            Z01Bank 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 = Z01BankHelper.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 Z01Bank();
            }

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

            return(View(entity));
        }
Esempio n. 4
0
        public ActionResult Edit(System.Int64?id, string act)
        {
            Z01Bank 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 = Z01BankHelper.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 Z01Bank();
            }

            string returnUrl = Request["ReturnUrl"];

            if (returnUrl.IsNullOrEmpty())
            {
                returnUrl = "/" + _ContollerName;
            }
            ViewData["ReturnUrl"] = returnUrl;
            return(View(entity));
        }
Esempio n. 5
0
 protected void ValidateZ01Bank(Z01Bank entity)
 {
     if (string.IsNullOrEmpty(entity.Title))
     {
         ModelState.AddModelError("Title required", "标题:必须填写");
     }
     else if (entity.Title.Length > 300)
     {
         ModelState.AddModelError("Title string length error", "标题:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Brief) && entity.Brief.Length > 20)
     {
         ModelState.AddModelError("Brief string length error", "简称:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Account) && entity.Account.Length > 50)
     {
         ModelState.AddModelError("Account string length error", "帐号:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Address) && entity.Address.Length > 300)
     {
         ModelState.AddModelError("Address string length error", "地址:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Contact) && entity.Contact.Length > 50)
     {
         ModelState.AddModelError("Contact string length error", "联系人:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Tel) && entity.Tel.Length > 20)
     {
         ModelState.AddModelError("Tel string length error", "电话:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Fax) && entity.Fax.Length > 20)
     {
         ModelState.AddModelError("Fax string length error", "传真:填写的内容太多");
     }
     if (!string.IsNullOrEmpty(entity.Url) && entity.Url.Length > 300)
     {
         ModelState.AddModelError("Url string length error", "银行网址:填写的内容太多");
     }
 }
Esempio n. 6
0
        public ActionResult Edit(System.Int64?id, Z01Bank entity)
        {
            entity.BankID = id;


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

                return(Return());
            }
            catch
            {
                return(View(entity));
            }
        }
Esempio n. 7
0
 public static int Insert(Zippy.Data.IDalProvider db, Z01Bank entity)
 {
     int rtn = db.Insert(entity);
     return rtn;
 }
Esempio n. 8
0
 /// <summary>
 /// 获取 [银行 的 银行] 的 [财务流水] 集合
 /// </summary>
 public static List<Z01FinancialFlow> GetBankID_Z01FinancialFlows(Zippy.Data.IDalProvider db, Z01Bank entity)
 {
     if (entity.BankID.HasValue)
            return db.Take<Z01FinancialFlow>("BankID=@BankID", db.CreateParameter("BankID", entity.BankID));
     return new List<Z01FinancialFlow>();
 }
Esempio n. 9
0
 public static int Update(Zippy.Data.IDalProvider db, Z01Bank entity)
 {
     return db.Update(entity);
 }
Esempio n. 10
0
 public static int Update(Zippy.Data.IDalProvider db, Z01Bank entity)
 {
     return(db.Update(entity));
 }
Esempio n. 11
0
        public static int Insert(Zippy.Data.IDalProvider db, Z01Bank entity)
        {
            int rtn = db.Insert(entity);

            return(rtn);
        }
Esempio n. 12
0
        public static Z01Bank Create(Zippy.Data.IDalProvider db, Int64 _BankID)
        {
            Z01Bank rtn = db.FindUnique <Z01Bank>(_BankID);

            return(rtn);
        }
Esempio n. 13
0
 /// <summary>
 /// 获取 [银行 的 银行] 的 [财务流水] 集合
 /// </summary>
 public static List <Z01FinancialFlow> GetBankID_Z01FinancialFlows(Zippy.Data.IDalProvider db, Z01Bank entity)
 {
     if (entity.BankID.HasValue)
     {
         return(db.Take <Z01FinancialFlow>("BankID=@BankID", db.CreateParameter("BankID", entity.BankID)));
     }
     return(new List <Z01FinancialFlow>());
 }
Esempio n. 14
0
 protected void ValidateZ01Bank(Z01Bank entity)
 {
     if (string.IsNullOrEmpty(entity.Title))
         ModelState.AddModelError("Title required", "标题:必须填写");
     else if (entity.Title.Length > 300)
         ModelState.AddModelError("Title string length error", "标题:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Brief) && entity.Brief.Length > 20)
         ModelState.AddModelError("Brief string length error", "简称:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Account) && entity.Account.Length > 50)
         ModelState.AddModelError("Account string length error", "帐号:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Address) && entity.Address.Length > 300)
         ModelState.AddModelError("Address string length error", "地址:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Contact) && entity.Contact.Length > 50)
         ModelState.AddModelError("Contact string length error", "联系人:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Tel) && entity.Tel.Length > 20)
         ModelState.AddModelError("Tel string length error", "电话:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Fax) && entity.Fax.Length > 20)
         ModelState.AddModelError("Fax string length error", "传真:填写的内容太多");
     if (!string.IsNullOrEmpty(entity.Url) && entity.Url.Length > 300)
         ModelState.AddModelError("Url string length error", "银行网址:填写的内容太多");
 }