Example #1
0
        public ActionResult Add(SIS_User user)
        {
            user.Salt = PasswordProvider.GetSalt();
            user.Password = PasswordProvider.EncryptPassword(user.Password, user.Salt);
            DbModelDataContext db = DbContextFactory.Create();
            if (db.SIS_User.Where(u => u.Username == user.Username).Count() == 0)
            {
                user.Status = "正常";
                user.GroupId = user.GroupId;
                db.SIS_User.InsertOnSubmit(user);
                db.SubmitChanges();
                ViewBag.Class = "alert-success";
                ViewBag.Hint = "用户添加成功!";
                ViewBag.Show = true;
                user = null;
                return View(user);
            }
            else
            {
                ViewBag.Class = "alert-error";
                ViewBag.Hint = "该用户名已被使用。";
                ViewBag.Show = true;
            }

            return View();
        }
Example #2
0
 public ActionResult Edit(SIS_User user)
 {
     DbModelDataContext db=DbContextFactory.Create();
     try
     {
         SIS_User user_db = db.SIS_User.Single(u => u.Id == user.Id);
         user_db.GroupId = user.GroupId;
         user_db.Status = user.Status;
         db.SubmitChanges();
     }
     catch (InvalidOperationException)
     {
         return View("Error");
     }
     return RedirectToAction("Edit", new { id=user.Id });
 }
Example #3
0
 partial void DeleteSIS_User(SIS_User instance);
Example #4
0
 partial void UpdateSIS_User(SIS_User instance);
Example #5
0
 partial void InsertSIS_User(SIS_User instance);
Example #6
0
		private void detach_SIS_User(SIS_User entity)
		{
			this.SendPropertyChanging();
			entity.SIS_UserGroup = null;
		}
Example #7
0
		private void attach_SIS_User(SIS_User entity)
		{
			this.SendPropertyChanging();
			entity.SIS_UserGroup = this;
		}