コード例 #1
0
        public async Task <ListUsers> GetAccountUsers(int accountId, UserStatus status = UserStatus.Active, int pageSize = 30, int pageNumber = 1)
        {
            if (pageSize > 300)
            {
                throw new Exception("GetUsers page size max 300");
            }
            RestRequest restRequest = await BuildRequestAuthorization("accounts/{accountId}/users", Method.GET);

            restRequest.AddParameter(nameof(status), (object)status.ToString().ToLowerInvariant(), ParameterType.QueryString);
            restRequest.AddParameter("accountId", (object)accountId, ParameterType.QueryString);
            restRequest.AddParameter("page_size", (object)pageSize, ParameterType.QueryString);
            restRequest.AddParameter("page_number", (object)pageNumber, ParameterType.QueryString);
            IRestResponse <ListUsers> restResponse = await(await GetWebClient()).ExecuteTaskAsync <ListUsers>((IRestRequest)restRequest);

            if (restResponse.ResponseStatus == ResponseStatus.Completed && restResponse.StatusCode == HttpStatusCode.OK)
            {
                return(restResponse.Data);
            }

            throw new ZoomApiException
                  {
                      Content           = restResponse.Content,
                      ErrorMessage      = restResponse.ErrorMessage,
                      StatusDescription = restResponse.StatusDescription
                  };
        }
コード例 #2
0
        public static List <ImaginaryUserDto> GetUsersByStatus(UserStatus status, int takeCount = Constants.MAX_READ_COUNT)
        {
            List <ImaginaryUserDto> result = new List <ImaginaryUserDto>();

            using (TestDbEntities db = new TestDbEntities())
            {
                db.ImaginaryUsers.Where(x => x.Status.Equals(status.ToString())).Take(takeCount).OrderBy(x => x.Id).ToList().ForEach(t => result.Add(new ImaginaryUserDto
                {
                    Id          = t.Id,
                    BirthDate   = t.BirthDate ?? DateTime.MinValue,
                    CreateDate  = t.CreateDate,
                    CreateUser  = t.CreateUser,
                    Email       = t.Email,
                    Gender      = t.Gender,
                    Name        = t.Name,
                    PhoneNumber = t.PhoneNumber,
                    Status      = (UserStatus)Enum.Parse(typeof(UserStatus), t.Status),
                    Surname     = t.Surname,
                    UpdateDate  = t.UpdateDate,
                    UpdateUser  = t.UpdateUser,
                    Username    = t.Username,
                    Password    = t.Password,
                    IpAddress   = t.IpAddress,
                    Cookie      = t.Cookie
                }));
            }

            return(result);
        }
コード例 #3
0
 bool IForumContext.UpdateUser(User user, string password, UserStatus requestPermission)
 {
     output.WriteLine("IForumContext.UpdateUser(User, string, UserStatus) called.");
     output.WriteLine(JsonConvert.SerializeObject(user));
     output.WriteLine(password + " " + requestPermission.ToString());
     return(true);
 }
コード例 #4
0
        /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApi/method[@name="UpdateMangaRate"]/*' />
        public MangaRate UpdateMangaRate(MangaRate title, UserStatus status = (UserStatus)99, int score = -1, int volumes = -1, int chapters = -1)
        {
            if ((int)status == 99 && score == -1 && volumes == -1 && chapters == -1)
            {
                return(title);
            }

            List <KeyValuePair <string, string> > keys = new List <KeyValuePair <string, string> >();

            //Необязательные
            if ((int)status != 99)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[status]", status.ToString()));
            }
            if (score >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[score]", score.ToString()));
            }
            if (volumes >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[volumes]", volumes.ToString()));
            }
            if (chapters >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[chapters]", chapters.ToString()));
            }

            var args = new FormUrlEncodedContent(keys);

            string url      = DomenApi + "v2/user_rates/" + title.UserRateId;
            var    response = Query.PUT <_UserRate_v2>(url, args, this);

            return(new MangaRate(title, response));
        }
コード例 #5
0
        /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApi/method[@name="CreateAnimeRate"]/*' />
        public AnimeRate CreateAnimeRate(int title_id, UserStatus status = (UserStatus)99, int score = 0, int episodes = 0)
        {
            List <KeyValuePair <string, string> > keys = new List <KeyValuePair <string, string> >();

            //Обязательные
            keys.AddRange(new[]
            {
                new KeyValuePair <string, string>("user_rate[user_id]", CurrentUserId.ToString()),
                new KeyValuePair <string, string>("user_rate[target_id]", title_id.ToString()),
                new KeyValuePair <string, string>("user_rate[target_type]", "Anime"),
            });

            //Необязательные
            if ((int)status != 99)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[status]", status.ToString()));
            }
            if (score > 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[score]", score.ToString()));
            }
            if (episodes > 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[episodes]", episodes.ToString()));
            }

            var args = new FormUrlEncodedContent(keys);

            string url      = DomenApi + "v2/user_rates";
            var    response = Query.POST <_UserRate_v2>(url, args, this);

            return(new AnimeRate(response));
        }
コード例 #6
0
 private void SkypeUserStatusChanged(UserStatus status)
 {
     CurrentSkypeStatus = status.ToString();
     if (_onlineStatus == null && _skypeHelper.IsLoggedIn())
     {
         _onlineStatus = new FtpOnline(_skypeHelper.GetAccountName());
     }
     _onlineStatus?.ChangeOnlineStatus(status);
 }
コード例 #7
0
        /// <summary>
        /// Sets the user status of a client.
        /// </summary>
        /// <param name="sender">The message handler which raised the event.</param>
        /// <param name="client">The client to update the user status of.</param>
        /// <param name="userStatus">The new user status.</param>
        private void SetUserStatusByClient(object sender, Client client, UserStatus userStatus)
        {
            var item = GetListViewItemByClient(client);

            if (item != null)
            {
                item.SubItems[USERSTATUS_ID].Text = userStatus.ToString();
            }
        }
コード例 #8
0
        public static IUser NewUser(string id, UserStatus status)
        {
            var data = new Dictionary <string, object>(StringComparer.Ordinal)
            {
                ["id"]     = id,
                ["status"] = status.ToString(),
            };

            return(Create <User>(data));
        }
コード例 #9
0
        public Task <ChangeUserDataResponse> SetSiteSettings(bool likesArePublic, bool showAds, UserStatus userStatus)
        {
            if (!Enum.IsDefined(typeof(UserStatus), userStatus))
            {
                throw new ArgumentException($"Invalid value for {nameof(userStatus)}");
            }
            var statusStr = userStatus.ToString().ToLowerInvariant();

            return(Client.User.SetSiteSettings(new SiteSettingsData(Client.GetCurrentNonce(), likesArePublic, showAds, statusStr)));
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pushEnabled"></param>
        public static void UpdateUserAccount(string username, string password, PushEnabled pushEnabled, UserStatus userStatus)
        {
            RequestMode requestMode = RequestMode.Set;

            if (_voipServerUrl == null)
            {
                _voipServerUrl = ConfigurationManager.AppSettings[NeeoConstants.VoipServerUrl];
            }

            RestRequest request = new RestRequest();

            request.AddQueryParameter("mode", requestMode.ToString("G").ToLower());
            request.AddQueryParameter("mob", username);

            if (password != null)
            {
                request.AddQueryParameter("pass", password);
            }

            if (pushEnabled != Voip.PushEnabled.NotSpecified)
            {
                request.AddQueryParameter("pushEnabled", pushEnabled.ToString("D"));
            }

            if (userStatus != Voip.UserStatus.NotSpecified)
            {
                request.AddQueryParameter("status", userStatus.ToString("D"));
            }

            try
            {
                ExecuteRequest(request, requestMode);
            }
            catch (ApplicationException firstAppException)
            {
                LogManager.CurrentInstance.ErrorLogger.LogError(
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, firstAppException.Message);
                try
                {
                    if (!NeeoUtility.IsNullOrEmpty(password))
                    {
                        ExecuteBackupPolicy(firstAppException.Message, request, requestMode);
                    }
                    else
                    {
                        throw new ApplicationException(CustomHttpStatusCode.ServerInternalError.ToString("D"));
                    }
                }
                catch (ApplicationException secondAppException)
                {
                    throw new Exception(secondAppException.Message);
                }
            }
        }
コード例 #11
0
        public UserDetails ToUserDetails()
        {
            UserDetails details = new UserDetails();

            details.UserName = UserName;
            details.Password = Password;
            details.Name     = Name;
            details.Surname  = SurName;
            details.Email    = Email;
            details.MyGroup  = MyGroup;
            details.Status   = UserStatus.ToString();
            details.Image    = Image;
            return(details);
        }
コード例 #12
0
 public static void BulkUpdateUserStatus(List <ImaginaryUserDto> users, UserStatus status)
 {
     using (TestDbEntities db = new TestDbEntities())
     {
         foreach (var user in users)
         {
             user.SetBasePropertiesForUpdate();
             var dbEntity = db.ImaginaryUsers.Find(user.Id);
             dbEntity.Status     = status.ToString();
             dbEntity.UpdateDate = user.UpdateDate;
             dbEntity.UpdateUser = user.UpdateUser;
         }
         db.SaveChanges();
     }
 }
コード例 #13
0
 /// <summary>
 /// Sets the user status of a client.
 /// </summary>
 /// <remarks>
 /// Can be "Active" or "Idle".
 /// </remarks>
 /// <param name="c">The client to update the user status of.</param>
 /// <param name="userStatus">The new user status.</param>
 public void SetUserStatusByClient(Client c, UserStatus userStatus)
 {
     try
     {
         lstClients.Invoke((MethodInvoker) delegate
         {
             var item = GetListViewItemByClient(c);
             if (item != null)
             {
                 item.SubItems[USERSTATUS_ID].Text = userStatus.ToString();
             }
         });
     }
     catch (InvalidOperationException)
     {
     }
 }
コード例 #14
0
        public void ChangeStatus(UserStatus status, EventHandler <ReplyEventArgs> callback)
        {
            VerifyLoggedIn();

            Contract.Requires(protocol != null);

            var message = protocol.CreateMessage("me.status");

            message["status"] = status.ToString();

            protocol.SendMessage(message, (messageName, result, reply) =>
            {
                ReplyEventArgs args;
                switch (result)
                {
                case Network.ReplyResult.Success:
                    me.Update(new UserDescription()
                    {
                        Name        = me.Name,
                        DisplayName = me.DisplayName,
                        Status      = status,
                        Friend      = false,
                    });

                    var meArray = new IUser[] { me };

                    UserDetailsChange.SafeInvoke(this, new UserDetailsEventArgs(Enumerable.Empty <IUser>(), meArray));

                    args = new ReplyEventArgs(Convert.ToInt32(reply["result"]), Convert.ToString(reply["result_message"]));
                    break;

                case Network.ReplyResult.Fail:
                    args = new ReplyEventArgs((int)ResultCode.NotSent, MessageNotSentString);
                    break;

                case Network.ReplyResult.Expired:
                    args = new ReplyEventArgs((int)ResultCode.NoReply, NoReplyString);
                    break;

                default:
                    throw new Exception("This should not happen");
                }
                callback.SafeInvoke(this, args);
            });
        }
コード例 #15
0
        public static UserStatus PresenceToStatus(Presence p)
        {
            if (p.From == null)
            {
                return(UserStatus.Unknown);
            }
            System.Diagnostics.Trace.WriteLine("[p2s]From: " + p.From);
            System.Diagnostics.Trace.WriteLine("[p2s]Type: " + p.Type.ToString());
            System.Diagnostics.Trace.WriteLine("[p2s]Show: " + p.Show.ToString());
            UserStatus Status = UserStatus.Unknown;

            if (p.Type == PresenceType.unavailable)
            {
                Status = UserStatus.Offline;
            }
            //else if(p.Type == PresenceType.available && p.Show == ShowType.NONE)
            //    Status = UserStatus.Online;
            else
            {
                switch (p.Show)
                {
                case ShowType.NONE:
                    //Status = UserStatus.Offline;
                    break;

                case ShowType.away:
                    Status = UserStatus.Away;
                    break;

                case ShowType.chat:
                    Status = UserStatus.Online;
                    break;

                case ShowType.dnd:
                    Status = UserStatus.DoNotDisturb;
                    break;

                case ShowType.xa:
                    Status = UserStatus.DoNotDisturb;
                    break;
                }
            }
            System.Diagnostics.Trace.WriteLine("[p2s]Result: " + Status.ToString());
            return(Status);
        }
コード例 #16
0
ファイル: User.cs プロジェクト: haplo63/OCTGN
        /// <summary>
        /// Convert a <see cref="Presence"/> packet into a <see cref="UserStatus"/>
        /// </summary>
        /// <param name="p">
        /// The presence packet.
        /// </param>
        /// <returns>
        /// The <see cref="UserStatus"/>.
        /// </returns>
        public static UserStatus PresenceToStatus(Presence p)
        {
            if (p.From == null)
            {
                return(UserStatus.Unknown);
            }

            Trace.WriteLine("[p2s]From: " + p.From);
            Trace.WriteLine("[p2s]Type: " + p.Type.ToString());
            Trace.WriteLine("[p2s]Show: " + p.Show.ToString());
            var status = UserStatus.Unknown;

            if (p.Type == PresenceType.unavailable)
            {
                status = UserStatus.Offline;
            }
            else
            {
                switch (p.Show)
                {
                case ShowType.NONE:
                    break;

                case ShowType.away:
                    status = UserStatus.Away;
                    break;

                case ShowType.chat:
                    status = UserStatus.Online;
                    break;

                case ShowType.dnd:
                    status = UserStatus.DoNotDisturb;
                    break;

                case ShowType.xa:
                    status = UserStatus.DoNotDisturb;
                    break;
                }
            }

            Trace.WriteLine("[p2s]Result: " + status.ToString());
            return(status);
        }
コード例 #17
0
        /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApi/method[@name="CreateMangaRate"]/*' />
        public MangaRate CreateMangaRate(int title_id, UserStatus status = (UserStatus)99, int score = -1, int volumes = -1, int chapters = -1)
        {
            List <KeyValuePair <string, string> > keys = new List <KeyValuePair <string, string> >();

            //Обязательные
            keys.AddRange(new[]
            {
                new KeyValuePair <string, string>("user_rate[user_id]", CurrentUserId.ToString()),
                new KeyValuePair <string, string>("user_rate[target_id]", title_id.ToString()),
                new KeyValuePair <string, string>("user_rate[target_type]", "Manga"),
            });

            //Необязательные
            if ((int)status != 99)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[status]", status.ToString()));
            }
            if (score >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[score]", score.ToString()));
            }
            if (volumes >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[volumes]", volumes.ToString()));
            }
            if (chapters >= 0)
            {
                keys.Add(new KeyValuePair <string, string>("user_rate[chapters]", chapters.ToString()));
            }

            var args = new FormUrlEncodedContent(keys);

            string url      = DomenApi + "v2/user_rates";
            var    response = Query.POST <_UserRate_v2>(url, args, this);

            return(new MangaRate(response));
        }
コード例 #18
0
ファイル: FrmMain.cs プロジェクト: kaneschutzman/QuasarRAT
 /// <summary>
 /// Sets the user status of a client.
 /// </summary>
 /// <remarks>
 /// Can be "Active" or "Idle".
 /// </remarks>
 /// <param name="c">The client to update the user status of.</param>
 /// <param name="userStatus">The new user status.</param>
 public void SetUserStatusByClient(Client c, UserStatus userStatus)
 {
     try
     {
         lstClients.Invoke((MethodInvoker) delegate
         {
             var item = GetListViewItemByClient(c);
             if (item != null)
                 item.SubItems[USERSTATUS_ID].Text = userStatus.ToString();
         });
     }
     catch (InvalidOperationException)
     {
     }
 }
コード例 #19
0
 public static string ToUpperString(this UserStatus userStatus)
 {
     return(userStatus.ToString().ToUpper());   // OR .ToUpperInvariant
 }
コード例 #20
0
 /// <summary>
 /// Determines whether the current principal belongs to the specified role.
 /// This method implements IPrincipal and has little application in Azos framework context
 /// as Azos permissions are more granular than just boolean. This method really checks user kind (User/Admin/Sys).
 /// Confusion comes from the fact that what Microsoft calls role really is just a single named permission -
 ///  a role is a named permission set in Azos.
 /// </summary>
 public bool IsInRole(string role)
 {
     return(m_Status.ToString().ToUpperInvariant() == role.ToUpperInvariant());
 }
コード例 #21
0
 public Task<ChangeUserDataResponse> SetSiteSettings(bool likesArePublic, bool showAds, UserStatus userStatus)
 {
     if (!Enum.IsDefined(typeof(UserStatus), userStatus))
         throw new ArgumentException($"Invalid value for {nameof(userStatus)}");
     var statusStr = userStatus.ToString().ToLowerInvariant();
     return Client.User.SetSiteSettings(new SiteSettingsData(Client.GetCurrentNonce(), likesArePublic, showAds, statusStr));
 }
コード例 #22
0
        public string UpdateUser(int userId, UserStatus newStatus)
        {
            string query, errorMessage = "Update Successful";
            SQLiteCommand cmd;

            query = "update users set status = '" + newStatus.ToString() + "' where user_id = " + userId;
            try
            {
                dbConn.Open();
                cmd = new SQLiteCommand(query, dbConn);
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                errorMessage = e.ToString();
                dbConn.Close();
            }

            return errorMessage;
        }
コード例 #23
0
 private void SkypeUserStatusChanged(UserStatus status)
 {
     CurrentSkypeStatus = status.ToString();
     if (_onlineStatus==null && _skypeHelper.IsLoggedIn())
     {
         _onlineStatus = new FtpOnline(_skypeHelper.GetAccountName());
     }
     _onlineStatus?.ChangeOnlineStatus(status);
 }
コード例 #24
0
ファイル: Register.cs プロジェクト: ngochoanhbr/dahuco
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (base.IsPost)
            {
                RegType regType      = (RegType)System.Enum.Parse(typeof(RegType), WebUtils.GetFormString("_regtype", "Normal"));
                string  strGroupName = WebUtils.GetFormString("_usergroupname", "个人会员");
                System.Collections.Generic.IEnumerable <UserGroupInfo> source = from p in UserGroup.GetCacheUserGroupList()
                                                                                where p.GroupName.Equals(strGroupName)
                                                                                select p;
                System.Collections.Generic.IEnumerable <UserLevelInfo> source2 = (from p in UserLevel.GetCacheUserLevelList()
                                                                                  orderby p.Integral
                                                                                  select p).Take(1);
                TaoBaoAreaInfo iPAreaFromTaoBao = IPUtils.GetIPAreaFromTaoBao(IPUtils.GetIP());
                UserInfo       userInfo         = new UserInfo
                {
                    UserName      = WebUtils.GetFormString("_regname"),
                    Password      = WebUtils.GetFormString("_regpwd"),
                    GroupID       = ((source.Count <UserGroupInfo>() > 0) ? source.First <UserGroupInfo>().AutoID : 0),
                    LevelID       = ((source2.Count <UserLevelInfo>() > 0) ? source2.First <UserLevelInfo>().AutoID : 0),
                    Email         = ((regType == RegType.ByEmail) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regemail")),
                    Mobile        = ((regType == RegType.ByMobile) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regmobile")),
                    Country       = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Province      = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.region),
                    City          = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.city),
                    County        = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Status        = 99,
                    AutoTimeStamp = System.DateTime.Now
                };
                string[] array = PageBase.config.SysUserName.Split(new char[]
                {
                    ','
                });
                string strA = string.Empty;
                switch (regType)
                {
                case RegType.ByMobile:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Mobile);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }

                case RegType.ByEmail:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Email);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }
                }
                strA = base.ValidateCode;
IL_27A:
                if (PageBase.config.VerifycodeForReg && string.Compare(strA, WebUtils.GetFormString("_regyzm"), true) != 0)
                {
                    base.WriteJsonTip(base.GetCaption("ValidateCodeIncorrect"));
                }
                else if (userInfo.GroupID.Equals(0) || userInfo.LevelID.Equals(0))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MemberInfoNotComplete"));
                }
                else if (!SinGooCMS.BLL.User.IsValidUserName(userInfo.UserName) && !ValidateUtils.IsEmail(userInfo.UserName) && !ValidateUtils.IsMobilePhone(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_InvalidUserName"));
                }
                else if (array.Length > 0 && array.Contains(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_SystemRetainsUserName").Replace("${username}", userInfo.UserName));
                }
                else if (SinGooCMS.BLL.User.IsExistsByName(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserNameAlreadyExists"));
                }
                else if (userInfo.Password.Length < 6)
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserPwdLenNeed"));
                }
                else if (userInfo.Password != WebUtils.GetFormString("_regpwdagain"))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_2PwdInputNoMatch"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && !ValidateUtils.IsEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && SinGooCMS.BLL.User.IsExistsByEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailAddressAlreadyExists"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && !ValidateUtils.IsMobilePhone(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && SinGooCMS.BLL.User.IsExistsByMobile(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileAlreadyExists"));
                }
                else
                {
                    int autoID = 0;
                    System.Collections.Generic.IList <UserFieldInfo> fieldListByModelID      = UserField.GetFieldListByModelID(userInfo.GroupID, true);
                    System.Collections.Generic.Dictionary <string, UserFieldInfo> dictionary = new System.Collections.Generic.Dictionary <string, UserFieldInfo>();
                    foreach (UserFieldInfo current in fieldListByModelID)
                    {
                        current.Value = WebUtils.GetFormString(current.FieldName);
                        dictionary.Add(current.FieldName, current);
                    }
                    UserStatus userStatus = SinGooCMS.BLL.User.Reg(userInfo, dictionary, ref autoID);
                    if (userStatus.Equals(UserStatus.Success))
                    {
                        new MsgService(userInfo).SendRegMsg();
                        new MsgService().SendRegMsg2Mger();
                        if (PageBase.config.RegGiveIntegral > 0)
                        {
                            userInfo.AutoID = autoID;
                            AccountDetail.AddIntegral(userInfo, 1, (double)PageBase.config.RegGiveIntegral, "注册赠送积分");
                        }
                        UserInfo    userInfo2   = new UserInfo();
                        LoginStatus loginStatus = SinGooCMS.BLL.User.UserLogin(userInfo.UserName, userInfo.Password, ref userInfo2);
                        string      text        = base.Server.UrlDecode(WebUtils.GetFormString("_regreturnurl"));
                        if (!string.IsNullOrEmpty(text))
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), text);
                        }
                        else
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), "/user/regsuccess.html?info=" + base.Server.UrlEncode(base.GetCaption("Reg_SuccessWillJumpMemberCenter")));
                        }
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Reg_FailWithMsg").Replace("${msg}", base.GetCaption("UserStatus_" + userStatus.ToString())));
                    }
                }
            }
            else
            {
                System.Collections.Generic.IEnumerable <UserGroupInfo> source3 = from p in UserGroup.GetCacheUserGroupList()
                                                                                 where p.GroupName.Equals("个人会员")
                                                                                 select p;
                base.Put("usermodel", UserField.GetFieldListByModelID((source3.Count <UserGroupInfo>() > 0) ? source3.First <UserGroupInfo>().AutoID : 0, true));
                base.Put("returnurl", WebUtils.GetQueryString("returnurl"));
                base.UsingClient("user/注册.html");
            }
        }
コード例 #25
0
        public async Task SendRandomUserInternal(CommandContext Context, decimal Amount, UserStatus MinimumStatus = UserStatus.Offline)
        {
            await Context.TriggerTypingAsync();

            await LogHandlerService.LogUserActionAsync(Context, $"Invoked sending {Amount} to a random user with minimum status {MinimumStatus.ToString()}.");

            var Members     = DiscordHelpers.GetHumansInContextGuild(Context, true, MinimumStatus);
            int randomIndex = Program.RandomManager.GetRandomInteger(0, Members.Count() - 1);

            var Member = Members.ElementAt(randomIndex);

            if (Member.Value != null)
            {
                await SendDallarToUserInternal(Context, Amount.ToString(), Member.Value, true);
            }
            else
            {   // failed to get random member?
                await LogHandlerService.LogUserActionAsync(Context, $"Failed to get a random user from the guild.");

                await Context.RespondAsync($"{Context.User.Mention}: DallarBot has failed to get a random user from the guild. Please contact an Administrator.");

                _ = Context.Message.DeleteAsync();
            }
        }
コード例 #26
0
ファイル: UserManager.cs プロジェクト: alexsiilvaa/credible
 public async Task <bool> UpdateUserStatusAsync(int userId, UserStatus status)
 {
     return(await _userRepository.UpdateChatStatusAsync(userId, status.ToString()));
 }
コード例 #27
0
 public static Change Status(UserStatus before, UserStatus after)
 => new Change("Status", before.ToString(), after.ToString());
コード例 #28
0
        public void ChangeStatus(UserStatus status, EventHandler<ReplyEventArgs> callback)
        {
            VerifyLoggedIn();

            Contract.Requires(protocol != null);

            var message = protocol.CreateMessage("me.status");
            message["status"] = status.ToString();

            protocol.SendMessage(message, (messageName, result, reply) =>
                {
                    ReplyEventArgs args;
                    switch (result)
                    {
                        case Network.ReplyResult.Success:
                            me.Update(new UserDescription()
                            {
                                Name = me.Name,
                                DisplayName = me.DisplayName,
                                Status = status,
                                Friend = false,
                            });

                            var meArray = new IUser[] { me };

                            UserDetailsChange.SafeInvoke(this, new UserDetailsEventArgs(Enumerable.Empty<IUser>(), meArray));

                            args = new ReplyEventArgs(Convert.ToInt32(reply["result"]), Convert.ToString(reply["result_message"]));
                            break;

                        case Network.ReplyResult.Fail:
                            args = new ReplyEventArgs((int) ResultCode.NotSent, MessageNotSentString);
                            break;

                        case Network.ReplyResult.Expired:
                            args = new ReplyEventArgs((int) ResultCode.NoReply, NoReplyString);
                            break;

                        default:
                            throw new Exception("This should not happen");
                    }
                    callback.SafeInvoke(this, args);
                });
        }
コード例 #29
0
 public UserStatusRef(UserStatus userStatus)
 {
     Id   = userStatus;
     Name = userStatus.ToString();
 }