コード例 #1
0
        private void UpdateTree()
        {
            treeView1.BeginUpdate();
            var userIdx = 0;

            foreach (KeyValuePair <string, Stats> item in UserInfos.OrderBy(key => - key.Value.Likes))
            {
                var userNode = userIdx < GetUsersNode().Nodes.Count ? GetUsersNode().Nodes[userIdx++] : GetUsersNode().Nodes.Add(userIdx++.ToString());
                userNode.Text        = item.Key + " — " + item.Value.ToShortString();
                userNode.ToolTipText = item.Key + "\r\n" + item.Value.ToString();
                userNode.Tag         = item.Key;
            }
            GetUsersNode().Text = "Юзеры — " + UserInfos.Count();
            var catIdx = 0;

            foreach (KeyValuePair <string, Stats> item in CatInfos.OrderBy(key => key.Key))
            {
                var catNode = catIdx < GetCatsNode().Nodes.Count ? GetCatsNode().Nodes[catIdx++] : GetCatsNode().Nodes.Add(catIdx++.ToString());
                catNode.Text        = item.Key + " — " + item.Value.ToShortString();
                catNode.ToolTipText = item.Key + "\r\n" + item.Value.ToString();
                catNode.Tag         = item.Key;
            }
            GetCatsNode().Text = "Категории — " + CatInfos.Count();
            var monthIdx = 0;

            foreach (KeyValuePair <MonthYear, Stats> item in MonthInfos.OrderBy(key => key.Key.GetDate(1)).Reverse())
            {
                var monthNode = monthIdx < GetMonthsNode().Nodes.Count ? GetMonthsNode().Nodes[monthIdx++] : GetMonthsNode().Nodes.Add(monthIdx++.ToString());
                monthNode.Text        = item.Key.ToString() + " — " + item.Value.ToShortString();
                monthNode.ToolTipText = item.Key.ToString() + "\r\n" + item.Value.ToString();
                monthNode.Tag         = item.Key;
            }
            GetMonthsNode().Text = "Месяцы — " + MonthInfos.Count();
            treeView1.EndUpdate();
        }
コード例 #2
0
        // public IUserContract UserContract { get; set; }
        /// <summary>
        /// 获取手机验证码
        /// </summary>
        /// <param name="phoneNo">手机号</param>
        /// <param name="codeType"></param>
        /// <returns>业务操作结果</returns>
        public async Task <OperationResult> GetSmsValidateCode(string phoneNo, CodeType codeType)
        {
            var    user         = UserInfos.Count(x => x.SysUser.PhoneNumber == phoneNo);
            string validateCode = new ValidateCoder().GetCode(6, ValidateCodeType.Number);
            var    codeEntity   = new ValidateCode()
            {
                CodeKey      = phoneNo,
                Code         = validateCode,
                ValidateType = ValidateType.手机,
                CodeType     = codeType
            };
            await ValidateCodeRepo.InsertAsync(codeEntity);

            if (codeType == CodeType.临时密码 || codeType == CodeType.找回密码)
            {
                if (user == 0)
                {
                    return(new OperationResult(OperationResultType.NoChanged, "此帐号还未注册", 0));
                }
                var results = SendMsg53kf.HttpGet((int)codeType, validateCode, phoneNo);
                if (results.code == 0)
                {
                    return(new OperationResult(OperationResultType.Success, "验证码发送成功,注意查看短信", 0));
                }
                return(new OperationResult(OperationResultType.Error, "短信系统繁忙,请稍后再试", 0));
            }
            else
            {
                if (user > 0)
                {
                    return(new OperationResult(OperationResultType.NoChanged, "此帐号已注册", 0));
                }
                var result = SendMsg53kf.HttpGet((int)codeType, validateCode, phoneNo);
                if (result.code == 0)
                {
                    return(new OperationResult(OperationResultType.Success, "验证码发送成功,注意查看短信", 0));
                }
                return(new OperationResult(OperationResultType.Error, "短信系统繁忙,请稍后再试", 0));
            }
        }