コード例 #1
0
        private void CheckUpdate()
        {
            if (!Page.IsPostBack)
            {
                return;
            }

            string id  = Page.Request.Form["toUpdate"];
            string val = Page.Request.Form["newValue"];

            if (id == null || val == null || id.Length == 0 || val.Length == 0)
            {
                return;
            }

            User user = (User)Page.User;

            if (user.AllianceId != Current.Id)
            {
                return;
            }
            if (user.AllianceRank < AllianceMember.Role.Admiral)
            {
                return;
            }

            User wannabe = UserUtility.bd.getUser(int.Parse(id));

            if (val == "Remove")
            {
                Current.RemoveMember(wannabe.UserId);
                wannabe.AllianceId = 0;
                UserUtility.bd.saveUser(wannabe, "");
                if (wannabe.UserId == user.UserId)
                {
                    user.AllianceId = 0;
                }
                return;
            }

            AllianceMember.Role role = (AllianceMember.Role)Enum.Parse(typeof(AllianceMember.Role), val);
            wannabe.AllianceRank = role;
            UserUtility.bd.saveUser(wannabe, "");
            Current = null;
            if (wannabe.UserId == user.UserId)
            {
                user.AllianceRank = role;
            }
        }
コード例 #2
0
ファイル: AllianceInfo.cs プロジェクト: zi-yu/orionsbelt
 public static string FromAllianceRole(AllianceMember.Role role)
 {
     return(role.ToString());
 }