Ejemplo n.º 1
0
 //插入或者修改用户
 public bool EditOrUpdateUser(UserInfo user)
 {
     user.OrganIds=Request.Form["OrganIds"];
     user.LoginId = user.LoginId.ToLower();
     user.Email = (user.Email ?? "").ToLower();
     if (user.UserId != 0 && Limits.Contains(2))
     {
         if(!String.IsNullOrEmpty(user.Password))
         {
             user.Password =Md5Encrypt.PasswordEncode(user.Password);
             return Context.Instance.Update(user, new string[] { "password", "phonenumber", "email", "username", "states", "regionid", "roleid", "organid", "usertype", "sex", "nickname" }) > 0;
         }
         else
             return Context.Instance.Update(user, new string[] { "phonenumber", "email", "username", "states", "regionid", "roleid", "organid", "usertype", "sex", "nickname" }) > 0;
     }
     else
     {
         user.AddTime = DateTime.Now;
         user.LastLoginTime = DateTime.Now;
         user.Password = Md5Encrypt.PasswordEncode(user.Password);
         if (Limits.Contains(3))
         {
             return DbOp.Add(user) != null;
         }
         else
             return false;
     }
 }
Ejemplo n.º 2
0
 //编辑用户信息
 public ActionResult Edit(int userId=0)
 {
     UserInfo user;
     if (userId != 0)
         user = DbOp.GetModelById(userId);
     else
         user = new UserInfo();
     return View(user);
 }
Ejemplo n.º 3
0
        public object Add(UserInfo entity)
        {
            var context = Context.Instance;
            context.BeginTransaction();
            var id = 0;
            try
            {
                id = Convert.ToInt32(context.Insert(entity));
                var detail = new UserDetail();
                detail.UserId = id;
                detail.Birthday = DateTime.Now;
                var userPoint = new UserPoint();
                userPoint.UserId = id;
                context.Insert(detail);
                context.Insert(userPoint);
                context.CompleteTransaction();
            }
            catch
            {
                context.AbortTransaction();
            }

            return id;
        }
Ejemplo n.º 4
0
 public int Update(UserInfo entity, string[] columns)
 {
     var r = Context.Instance.Update(entity, columns);
     if (r > 0) CacheOp.UpdateAll();
     return r;
 }
Ejemplo n.º 5
0
 public int Update(UserInfo entity)
 {
     var r = Context.Instance.Update(entity);
     if (r > 0) CacheOp.UpdateAll();
     return r;
 }