Ejemplo n.º 1
0
        public void AddFaction(Faction fan, User user)
        {
            using (LdxyDBEntities dbcontext = new LdxyDBEntities())
            {
                fan.CreateTime = DateTime.Now;
                dbcontext.Factions.AddObject(fan);
                dbcontext.SaveChanges();

                User us = new Models.User()
                {
                    UserName = "******",
                    Name = user.Name,
                    Password = "******",
                    RoleID = 1,
                    CreateTime = DateTime.Now,
                    Type = (int)UserType.帮派玩家,
                    FanctionID = fan.FactionID,
                    UserID = user.OUserID,
                    State = 0,
                };
                dbcontext.Users.AddObject(us);
                dbcontext.SaveChanges();

                UserRole urole = new UserRole()
                {
                    FanctionID = fan.FactionID,
                    OUserID = us.OUserID,
                    RoleID = (int)RoleEnum.帮主,
                };
                dbcontext.UserRoles.AddObject(urole);
                dbcontext.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public ActionResult Login(User user)
        {
            if (ValidateRequest)
            {
                User us = UserBLL.GetdbUser(user);
                if (us != null)
                {
                    UserInfo.Instence.SetUser(us);
                    return Content(String.Format("<script type='text/javascript'>{0}</script>", "top.dialog.get(window).close();top.dialog.get(window).remove();"));
                }
                else
                {
                    return Content(String.Format("<script type='text/javascript'>{0}</script>", "top.dialog.get(window).close();parent.ShowMsg('用户名或密码错误!');"));

                }
            }
            return Content(String.Format("<script type='text/javascript'>{0}</script>", "top.dialog.get(window).close();top.dialog.get(window).remove();"));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 用于向 Users EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 创建新的 User 对象。
 /// </summary>
 /// <param name="oUserID">OUserID 属性的初始值。</param>
 /// <param name="userID">UserID 属性的初始值。</param>
 /// <param name="userName">UserName 属性的初始值。</param>
 /// <param name="password">Password 属性的初始值。</param>
 /// <param name="roleID">RoleID 属性的初始值。</param>
 /// <param name="createTime">CreateTime 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 /// <param name="state">State 属性的初始值。</param>
 /// <param name="type">Type 属性的初始值。</param>
 /// <param name="fanctionID">FanctionID 属性的初始值。</param>
 public static User CreateUser(global::System.Int32 oUserID, global::System.Int32 userID, global::System.String userName, global::System.String password, global::System.Int32 roleID, global::System.DateTime createTime, global::System.String name, global::System.Int32 state, global::System.Int32 type, global::System.Int32 fanctionID)
 {
     User user = new User();
     user.OUserID = oUserID;
     user.UserID = userID;
     user.UserName = userName;
     user.Password = password;
     user.RoleID = roleID;
     user.CreateTime = createTime;
     user.Name = name;
     user.State = state;
     user.Type = type;
     user.FanctionID = fanctionID;
     return user;
 }
Ejemplo n.º 5
0
 public User GetdbUser(User user)
 {
     using (LdxyDBEntities dbcontext = new LdxyDBEntities())
     {
         return dbcontext.Users.Where(u => u.UserName == user.UserName && u.Password == user.Password).FirstOrDefault();
     }
 }
Ejemplo n.º 6
0
 public void CreatManager(User user)
 {
     using (LdxyDBEntities dbcontext = new LdxyDBEntities())
     {
         dbcontext.Users.AddObject(user);
         dbcontext.SaveChanges();
     }
 }
Ejemplo n.º 7
0
 public void SetUser(User user)
 {
     HttpContext.Current.Session["user"] = user;
 }