Example #1
0
 public GroupNum AddGroupMemberNum(group_Infor _group, int num)
 {
     if (_group.memberNum + num > _group.maxNum)
     {
         return GroupNum.超过人数上线;
     }
     _group.memberNum += num;
     GroupInforRepository.Update(_group);
     return GroupNum.操作成功;
 }
Example #2
0
 /// <summary>
 /// 用于向 group_Infor EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTogroup_Infor(group_Infor group_Infor)
 {
     base.AddObject("group_Infor", group_Infor);
 }
Example #3
0
 /// <summary>
 /// 创建新的 group_Infor 对象。
 /// </summary>
 /// <param name="gId">gId 属性的初始值。</param>
 public static group_Infor Creategroup_Infor(global::System.Int32 gId)
 {
     group_Infor group_Infor = new group_Infor();
     group_Infor.gId = gId;
     return group_Infor;
 }
Example #4
0
 public GroupNum DeleteGroupMemberNum(group_Infor _group, int num)
 {
     if (_group.memberNum - num <= 0)
         _group.memberNum = 1;
     else
         _group.memberNum -= num;
     GroupInforRepository.Update(_group);
     return GroupNum.操作成功;
 }
Example #5
0
        public bool CreateGroup(CreateGroupModel CreateGroupModel, HttpPostedFileBase gPic, out int gid)
        {
            gid = 0;
            int rst = 1;
            string smallimg = "";
            #region 上传图片到服务器
            if (gPic != null && gPic.ContentLength != 0)
               rst = UploadGroupICO_Simple(gPic.InputStream, gPic.FileName, out smallimg);
            if(rst!=1)
            {
                return false;
            }
            #endregion
            Kt.GameGroup.Data.group_Infor groupInfor = new Kt.GameGroup.Data.group_Infor()
            //this.GroupInforRepository.Add(new group_Infor
            {
                createDate = System.DateTime.Now,
                gameId = CreateGroupModel.gameId,
                memberNum = 1,
                account = CreateGroupModel.account,
                gName = CreateGroupModel.gName,
                postNum = 0,
                platFormId = CreateGroupModel.platFormId,
                gameserverid = CreateGroupModel.gameserverid,
                uId = CreateGroupModel.uId,
                joinPerm = CreateGroupModel.joinPerm,
                viewPerm = CreateGroupModel.viewPerm,
                points = 0,
                maxNum = 200,
                postPerm = true,
                recommend= false,
                isClass = false,
                isOpenSort = false,
                isPrefix = false,
                gPic = smallimg     //hjm创建游戏团时先插入图片,避免图片报错但数据库已插入记录的bug

            };

            //add by lxzh 2011-5-10 对group_member表 增加记录
            var addGroupInfo = this.GroupInforRepository.Add(groupInfor);
            this.GroupMemberRepository.Add(new group_member
            {
                myUid = addGroupInfo.uId,
                uType = 1,
                gId = addGroupInfo.gId,
                state = true,
                revTime = System.DateTime.Now,
                GradeId=1
            });
            int rstgrade = SetIniGroupGrade(addGroupInfo.gId);
            //更新统计表中数据,不存在则insert , 否则 +1
            var gamestate = this.GroupGameStatRepository.First(x => x.gameId == addGroupInfo.gameId);

            if (gamestate == null)
            {
                this.GroupGameStatRepository.Add(new group_gameStat { gameId = (int)addGroupInfo.gameId, groupNum = 1 });
            }
            else
            {
                gamestate.groupNum++;

                this.GroupGameStatRepository.Update(gamestate);
            }

            gid = addGroupInfo.gId;
            return true;
        }
Example #6
0
        /// <summary>
        /// 创建游戏团
        /// </summary>
        /// <returns></returns>
        public bool CreateGroup(decimal uId, int gameId, int platFormId, int gameserverid, string gName, string descript, int joinPerm, bool viewPerm)
        {
            Kt.GameGroup.Data.group_Infor groupInfor = new Kt.GameGroup.Data.group_Infor()
            //this.GroupInforRepository.Add(new group_Infor
            {
                createDate = System.DateTime.Now,
                gameId = gameId,
                memberNum = 1,
                account = descript,
                gName = gName,
                postNum = 0,
                platFormId = platFormId,
                gameserverid = gameserverid,
                uId = uId,
                joinPerm = joinPerm,
                viewPerm = viewPerm,
                points = 0,
                maxNum = 200,
                postPerm = true,
                recommend = false,
                isClass = false,
                isOpenSort = false,
                isPrefix = false

            };

            //add by lxzh 2011-5-10 对group_member表 增加记录
            var addGroupInfo = this.GroupInforRepository.Add(groupInfor);
            this.GroupMemberRepository.Add(new group_member
            {
                myUid = uId,
                uType = 1,
                gId = addGroupInfo.gId,
                state = true,
                revTime = System.DateTime.Now,
                GradeId = 1

            });
            int rstgrade = SetIniGroupGrade(addGroupInfo.gId);
            //更新统计表中数据,不存在则insert , 否则 +1
            var gamestate = this.GroupGameStatRepository.First(x => x.gameId == gameId);

            if (gamestate == null)
            {
                this.GroupGameStatRepository.Add(new group_gameStat { gameId = gameId, groupNum = 1 });
            }
            else
            {
                gamestate.groupNum++;

                this.GroupGameStatRepository.Update(gamestate);
            }

            return true;
        }