示例#1
0
 public ActionResult SupplierEdit()
 {
     int id = 0;
     int.TryParse(System.Web.HttpContext.Current.User.Identity.Name, out id);
     OUContext db = new OUContext();
     Supplier s = (from o in db.Suppliers where o.Id == id select o).FirstOrDefault();
     if(s==null)
     {
         s=new Supplier();
     }
     return View(s);
 }
示例#2
0
 public ActionResult ChangePassword(int id)
 {
     Supplier s=new Supplier();
     return View(s);
 }
示例#3
0
        public ActionResult SupplierEdit(int id,  FormCollection collection)
        {
            if (!UserInfo.CurUser.HasRight("供应商管理-供应商资料修改"))
            {
                return Redirect("~/content/AccessDeny.htm");
            }
            Supplier s = db.Suppliers.Find(id);
            if(s==null)
            {
                s = new Supplier ();
                db.Suppliers.Add(s);
            }
            //collection.Remove("");
            TryUpdateModel(s, "", new  string[]{}, new string[] { "Password","State"},collection);
            if (ModelState.IsValid)
            {
                s.Save(db);
                    db.SaveChanges();
                    if(id==0)
                    {
                        BLL.Utilities.AddLog(s.Id,Supplier.LogClass, "创建", "");

                    }
                    else
                    {
                        BLL.Utilities.AddLog(s.Id, Supplier.LogClass, "修改", "");
                    }
                return Redirect("../SupplierView/" + s.Id);
            }

            return View(s);
        }
示例#4
0
 public ActionResult SupplierEdit(int id)
 {
     if (!UserInfo.CurUser.HasRight("供应商管理-供应商资料修改"))
     {
         return Redirect("~/content/AccessDeny.htm");
     }
     Supplier s = db.Suppliers.Find(id);
     if(s==null)
     {
         s=new Supplier();
     }
     return View(s);
 }
示例#5
0
        public ActionResult SupplierRegister( FormCollection collection)
        {
            Supplier s = new Supplier();
            s.Level = (int) SupplierLevel.F;
            TryUpdateModel(s, "", new string[] { }, new string[] { "Level", "State" }, collection);
            s.Name = s.Name.Trim();
            if(collection["ConfirmPassword"]!=s.Password)
                {
                    ModelState.AddModelError("ConfirmPassword", "两个密码不一致");
                }
                if( (from o in db.Suppliers where o.Name==s.Name select o).Count()>0)
                {
                    ModelState.AddModelError("","供应商名称已存在");
                }
            if (ModelState.IsValid)
            {
                    s.Save(db);
                    db.SaveChanges();
                    BLL.Utilities.AddLog(s.Id, Supplier.LogClass, "创建", "");
                System.Web.Security.FormsAuthentication.SetAuthCookie(s.Id.ToString(),false);
                    return Redirect("SupplierView" );

            }
            return View(s);
        }
示例#6
0
 public ActionResult SupplierRegister()
 {
     Supplier s = new Supplier();
     return View(s);
 }