コード例 #1
0
ファイル: UserBLL.cs プロジェクト: shuxin556/LdxyFaction
 /// <summary>
 /// 添加用户积分
 /// </summary>
 public void AddUserScore(UserScore score)
 {
     using (LdxyDBEntities dbcontext = new LdxyDBEntities())
     {
         dbcontext.UserScores.AddObject(score);
         dbcontext.SaveChanges();
     }
 }
コード例 #2
0
ファイル: UserBLL.cs プロジェクト: shuxin556/LdxyFaction
        public void BacthAddUser(List<BacthUserItem> users, int facID)
        {
            List<User> userlist = new List<User>();

            using (LdxyDBEntities dbcontext = new LdxyDBEntities())
            {
                foreach (var u in users)
                {
                    User us = new Models.User()
                        {
                            UserName = "******",
                            Name = u.UserName,
                            Password = "******",
                            RoleID = 1,
                            CreateTime = DateTime.Now,
                            Type=(int)UserType.帮派玩家,
                            FanctionID=facID,
                            UserID=0,
                            State = 0,
                        };
                    userlist.Add(us);
                    dbcontext.Users.AddObject(us);
                }
                dbcontext.SaveChanges();
                foreach (var u in userlist)
                {
                    UserScore score = new UserScore()
                    {
                        Score = users.Where(j => j.UserName == u.Name).FirstOrDefault().Score,
                        OUserID = u.OUserID,
                        ScoreType = (int)ScoreTypeEnum.初始积分,
                        CreatTime = DateTime.Now,
                        Desciption = "初始积分",
                        FanctionID = facID,
                        CostType = (int)CostTypeEnum.加分
                    };
                    dbcontext.UserScores.AddObject(score);
                    UserInfo.Instence.AddFactionMsg(u.Name + "加入帮派,初始积分" + score.Score);
                }
                dbcontext.SaveChanges();

            }
        }
コード例 #3
0
 public ActionResult AddScore(UserScore model)
 {
     try
     {
         if (ValidateRequest)
         {
             model.CostType = (int)CostTypeEnum.加分;
             model.CreatTime = DateTime.Now;
             model.FanctionID = UserInfo.Instence.CurrentFaction.FactionID;
             UserBLL.AddUserScore(model);
             var user = UserBLL.GetUserByOID(model.OUserID);
             UserInfo.Instence.AddFactionMsg(user.Name + "+" + model.Score + "分");
             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('创建失败!');"));
         }
     }
     catch (Exception ex)
     {
         return Content(String.Format("<script type='text/javascript'>{0}</script>", "top.dialog.get(window).close();parent.ShowMsg('" + ex.Message + "');"));
     }
 }
コード例 #4
0
 /// <summary>
 /// 用于向 UserScores EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUserScores(UserScore userScore)
 {
     base.AddObject("UserScores", userScore);
 }
コード例 #5
0
 /// <summary>
 /// 创建新的 UserScore 对象。
 /// </summary>
 /// <param name="userScoreID">UserScoreID 属性的初始值。</param>
 /// <param name="oUserID">OUserID 属性的初始值。</param>
 /// <param name="score">Score 属性的初始值。</param>
 /// <param name="scoreType">ScoreType 属性的初始值。</param>
 /// <param name="costType">CostType 属性的初始值。</param>
 /// <param name="creatTime">CreatTime 属性的初始值。</param>
 /// <param name="fanctionID">FanctionID 属性的初始值。</param>
 public static UserScore CreateUserScore(global::System.Int64 userScoreID, global::System.Int32 oUserID, global::System.Int32 score, global::System.Int32 scoreType, global::System.Int32 costType, global::System.DateTime creatTime, global::System.Int32 fanctionID)
 {
     UserScore userScore = new UserScore();
     userScore.UserScoreID = userScoreID;
     userScore.OUserID = oUserID;
     userScore.Score = score;
     userScore.ScoreType = scoreType;
     userScore.CostType = costType;
     userScore.CreatTime = creatTime;
     userScore.FanctionID = fanctionID;
     return userScore;
 }