Esempio n. 1
0
        private CoolQRouteMessage AddCount(CoolQRouteMessage cm)
        {
            string user = cm.UserId, group = cm.GroupId;

            try
            {
                Logger.Warn("发现好图,存了");
                if (!UserCount.ContainsKey(user))
                {
                    UserCount.Add(user, 2);
                }
                UserCount[user]--;
                if (UserCount[user] != 0)
                {
                    return(cm.ToSource("?", true));
                }
                else
                {
                    UserCount[user] = 2;
                    CoolQHttpApiClient.SetGroupBan(group, user, (int)(0.5 * 60 * 60));
                    return(cm.ToSource("?", true));
                }
            }
            finally
            {
                SaveSettings(UserCount);
            }
        }
Esempio n. 2
0
        private CommonMessageResponse AddCount(CommonMessage cm)
        {
            string user = cm.UserId, group = cm.GroupId;

            try
            {
                Logger.Warn("发现好图,存了");
                if (!UserCount.ContainsKey(user))
                {
                    UserCount.Add(user, 2);
                }
                UserCount[user]--;
                if (UserCount[user] != 0)
                {
                    return(new CommonMessageResponse("?", cm, true));
                }
                else
                {
                    UserCount[user] = 2;
                    CqApi.SetGroupBan(group, user, (int)(0.5 * 60 * 60));
                    return(new CommonMessageResponse("?", cm, true));
                }
            }
            finally
            {
                SaveSettings(UserCount);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 异步查询数据库最近七天每天增加用户数
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns>某七天的每天用户增量</returns>
        public async Task <UserCountList> GetUserChangeCountAsync(string startTime, string endTime)
        {
            string sql = $"select count(*) as num,convert(varchar(10),user_main.create_time,120) as dates from user_main " +
                         $"join user_type on user_main.id=user_type.user_id " +
                         $"where user_type.user_type=3  and  user_main.create_time BETWEEN '{startTime}' AND '{endTime}'" +
                         $"group by convert(varchar(10),user_main.create_time,120)" +
                         $"order by convert(varchar(10),user_main.create_time,120) asc";
            var list = await DapperHelper.GetListAsync <UserCount>(sql, this._conn);

            UserCount     temp   = null;
            UserCountList result = new UserCountList
            {
                list = new List <UserCount>()
            };

            foreach (var item in list)
            {
                temp = new UserCount
                {
                    dates = item.dates,
                    num   = item.num
                };
                result.list.Add(temp);
            }
            return(result);
        }
Esempio n. 4
0
 public int CompareTo(RoomInfo other)
 {
     if (UserCount == other.UserCount)
     {
         return(RoomId.CompareTo(other.RoomId));
     }
     return(-UserCount.CompareTo(other.UserCount));
 }
        public object Any(UserCount request)
        {
            var resp = new Dto <long>();

            resp.Result = Handler.Count();

            return(resp);
        }
Esempio n. 6
0
        public string DatasetBrief(string title)
        {
            string brief = "";

            brief += Utils.CreateHeading(title);
            brief += Utils.PrintValueToString("# of users", UserCount.ToString("D")) + "\n";
            brief += Utils.PrintValueToString("# of items", ItemCount.ToString("D")) + "\n";
            brief += Utils.PrintValueToString("# of ratings", NonZerosCount.ToString("D")) + "\n";
            brief += Utils.PrintValueToString("Density level", Density.ToString("P")) + "\n";
            brief += Utils.PrintValueToString("Global mean", GetGlobalMean().ToString("0.00"));
            return(brief);
        }
        public JsonResult UserCount()
        {
            List <UserCount> lstSummary = new List <UserCount>();

            foreach (DataRow dr in GetUserCount().Rows)
            {
                UserCount summary = new UserCount();
                //summary.Item = dr[0].ToString().Trim();
                //summary.Value = Convert.ToInt32(dr[1]);
                summary.Item  = dr[0].ToString();
                summary.Value = Convert.ToInt32(dr[1]);
                lstSummary.Add(summary);
            }
            return(Json(lstSummary.ToList(), JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
            public int CompareTo(HostInfo other)
            {
                int ret = UserCount.CompareTo(other.UserCount);

                if (ret != 0)
                {
                    return(ret);
                }
                ret = -LastAlive.CompareTo(other.LastAlive);
                if (ret != 0)
                {
                    return(ret);
                }
                return(Host.CompareTo(other.Host));
            }
Esempio n. 9
0
        public UserCount GetUserCount(int extent)
        {
            var userCount = new UserCount();
            //获取所有用户信息
            var filterUser = Builders <IW2SUser> .Filter.Empty;
            var users      = MongoDBHelper.Instance.Get_IW2SUser().Find(filterUser).ToList();

            DateTime dt = DateTime.Now.AddDays(-extent);

            userCount.ActiveUser           = users.Count(x => x.LastLoginAt > dt);
            userCount.ActiveUserPercent    = (double)userCount.ActiveUser / users.Count;
            userCount.NewFreeUser          = users.Where(x => x.UsrRole == UserTypes.Free).Count(x => x.CreatedAt > dt);
            userCount.NewPurchaseUser      = users.Where(x => x.UsrRole != UserTypes.Admin && x.UsrRole != UserTypes.Free && x.UsrRole != UserTypes.Engineer).Count(x => x.PurchaseAt > dt);
            userCount.PurchaseUser         = users.Count(x => x.UsrRole != UserTypes.Admin && x.UsrRole != UserTypes.Free && x.UsrRole != UserTypes.Engineer);
            userCount.PurchaseeUserPercent = (double)userCount.PurchaseUser / users.Count;
            return(userCount);
        }
Esempio n. 10
0
        public IActionResult Index(string actions, string email, string password)
        {
            UserCount userCount = new UserCount(email, password);

            switch (actions)
            {
            case "Get in":
                string userStatus = userCount.status == 0 ? "Jefe" : "empleado";

                if (userCount.email != null)
                {
                    ViewData["Success"] = "Todo bien " + userStatus;
                }
                else
                {
                    ViewData["Danger"] = "No es un usuario valido";
                }
                break;
            }

            return(View());
        }
Esempio n. 11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            map = new Bitmap(this.panel1.Width, this.panel1.Height);

            gs  = Graphics.FromImage(map);
            gs2 = this.panel1.CreateGraphics();

            Br = new SolidBrush(Color.FromArgb(new Random().Next()));

            Client = new ZYNetClient();
            if (Client.Connect(ZYSocket.share.RConfig.ReadString("host"), ZYSocket.share.RConfig.ReadInt("ServicePort")))
            {
                LogOn tmp = new LogOn(Client);
                tmp.ShowDialog();

                if (tmp.IsLogOn)
                {
                    Client.ServerDisconnect += Client_ServerDisconnect;
                    Client.DataInput        += Client_DataInput;

                    UserCount count = new UserCount();
                    Client.SendDataToServer(BufferFormat.FormatFCA(count));

                    this.Text = tmp.Names;
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("无法连接服务器");
                this.Close();
            }
        }
Esempio n. 12
0
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser,
                                  Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            string propName = propertyName.ToLowerInvariant();

            switch (propName)
            {
            case "roleid":
                return(PropertyAccess.FormatString(RoleID.ToString(), format));

            case "groupid":
                return(PropertyAccess.FormatString(RoleID.ToString(), format));

            case "status":
                return(PropertyAccess.FormatString(Status.ToString(), format));

            case "groupname":
                return(PropertyAccess.FormatString(RoleName, format));

            case "rolename":
                return(PropertyAccess.FormatString(RoleName, format));

            case "groupdescription":
                return(PropertyAccess.FormatString(Description, format));

            case "description":
                return(PropertyAccess.FormatString(Description, format));

            case "usercount":
                return(PropertyAccess.FormatString(UserCount.ToString(), format));

            case "street":
                return(PropertyAccess.FormatString(GetString("Street", string.Empty), format));

            case "city":
                return(PropertyAccess.FormatString(GetString("City", string.Empty), format));

            case "region":
                return(PropertyAccess.FormatString(GetString("Region", string.Empty), format));

            case "country":
                return(PropertyAccess.FormatString(GetString("Country", string.Empty), format));

            case "postalcode":
                return(PropertyAccess.FormatString(GetString("PostalCode", string.Empty), format));

            case "website":
                return(PropertyAccess.FormatString(GetString("Website", string.Empty), format));

            case "datecreated":
                return(PropertyAccess.FormatString(CreatedOnDate.ToString(), format));

            case "photourl":
                return(PropertyAccess.FormatString(FormatUrl(PhotoURL), format));

            case "stat_status":
                return(PropertyAccess.FormatString(GetString("stat_status", string.Empty), format));

            case "stat_photo":
                return(PropertyAccess.FormatString(GetString("stat_photo", string.Empty), format));

            case "stat_file":
                return(PropertyAccess.FormatString(GetString("stat_file", string.Empty), format));

            case "url":
                return(PropertyAccess.FormatString(FormatUrl(GetString("URL", string.Empty)), format));

            case "issystemrole":
                return(PropertyAccess.Boolean2LocalizedYesNo(IsSystemRole, formatProvider));

            case "grouptype":
                return(IsPublic ? "Public.Text" : "Private.Text");

            case "groupcreatorname":
                return(PropertyAccess.FormatString(GetString("GroupCreatorName", string.Empty), format));

            default:
                if (Settings.ContainsKey(propertyName))
                {
                    return(PropertyAccess.FormatString(GetString(propertyName, string.Empty), format));
                }

                propertyNotFound = true;
                return(string.Empty);
            }
        }
 public override int GetHashCode()
 {
     return(DurationSec.GetHashCode() + StartDateUtc.GetHashCode() + UserCount.GetHashCode());
 }
Esempio n. 14
0
 public DragAndDropHub(List <Quote> quotes, UserCount userCount)
 {
     _quotes    = quotes;
     _userCount = userCount;
 }
Esempio n. 15
0
        public IActionResult HandleUser(string actions, string email, string password, string status)
        {
            UserCount user = new UserCount(email, password);

            switch (actions)
            {
            case "Add":
                if (!string.IsNullOrEmpty(user.email))
                {
                    ViewData["Success"] = "El usuario ya existe";
                    return(View());
                }
                else
                {
                    UserCount userCount = new UserCount();
                    userCount.email    = email;
                    userCount.password = password;
                    userCount.status   = int.Parse(status);

                    if (new UserCount().AddUserCount(userCount))
                    {
                        ViewData["Success"] = "Se ha agregado el usuario de forma correcta";
                        return(View());
                    }
                }
                break;

            case "Update":
                if (string.IsNullOrEmpty(user.email))
                {
                    ViewData["Success"] = "El usuario no existe";
                    return(View());
                }
                else
                {
                    UserCount userCount = new UserCount();
                    userCount.email       = email;
                    userCount.password    = password;
                    userCount.status      = int.Parse(status);
                    userCount.idUserCount = user.idUserCount;

                    if (new UserCount().UpdateUserCount(userCount))
                    {
                        ViewData["Success"] = "Se ha actualzado de forma correcta";
                        return(View());
                    }
                }
                break;

            case "Delete":
                if (string.IsNullOrEmpty(user.email))
                {
                    ViewData["Success"] = "El usuario no existe";
                    return(View());
                }
                else
                {
                    if (new UserCount().DeleteUserCount(user.idUserCount, user.email))
                    {
                        ViewData["Success"] = "El usuario ha sido eliminado de forma correcta";
                        return(View());
                    }
                }
                break;
            }
            return(View());
        }
Esempio n. 16
0
 private void _checkForConfigFileUpdate()
 {
     if( ( Deactivated.wasAnySubFieldModified() || IPFilterRegex.wasAnySubFieldModified() || UserCount.wasAnySubFieldModified() ) && _CompanyIDDefined() )
     {
         UpdateConfigFile = true;
     }
 }
Esempio n. 17
0
        // MESSAGE RECEIVED
        public void MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            foreach (var m in e.MessageContainer.Messages)
            {
                if (m as DrawData != null)
                {
                    DrawData drawData = (DrawData)m;
                    if (ApplicationMode == Modes.Server)
                    {
                        server.SendAll(drawData);
                    }
                    UseDispatcher(Canvas_Drawing, delegate
                    {
                        Draw(Canvas_Drawing,
                             new CustomBrush(drawData.Color, drawData.Thickness), drawData.X1, drawData.Y1, drawData.X2, drawData.Y2);
                    });
                }
                else if (m as DrawClear != null)
                {
                    UseDispatcher(Canvas_Drawing, delegate
                    {
                        Canvas_Drawing.Children.Clear();
                    });
                    if (ApplicationMode == Modes.Server)
                    {
                        server.SendAll(m);
                    }
                }

                //Client only receives
                else if (ApplicationMode == Modes.Client)
                {
                    if (m as UserCount != null)
                    {
                        UserCount userC = (UserCount)m;
                        UserCount = userC.Count;
                    }
                    else if (m as DrawLock != null)
                    {
                        UseDispatcher(SP_Board, DispatcherPriority.Send, delegate { SP_Board.IsEnabled = false; });
                        DrawingLocked = true;
                        UseDispatcher(TBl_ControlPanel, delegate { TBl_ControlPanel.Text = Translation.ControlMenu_Lock_Text; });
                    }
                    else if (m as DrawUnlock != null)
                    {
                        UseDispatcher(SP_Board, DispatcherPriority.Send, delegate { SP_Board.IsEnabled = true; });
                        DrawingLocked = false;
                        UseDispatcher(TBl_ControlPanel, delegate { TBl_ControlPanel.Text = string.Empty; });
                    }
                    else if (m as DrawDataBlockFlag != null)
                    {
                        StartLoading();
                        UseDispatcher(TBl_ControlPanel, delegate { WriteDebug("DrawDataBlock Flag", LogLevels.Debug); });
                    }
                    else if (m as DrawDataBlock != null)
                    {
                        DrawDataBlock drawDataBlock = (DrawDataBlock)m;
                        if (ApplicationMode == Modes.Server)
                        {
                            server.SendAll(drawDataBlock);
                        }
                        StopLoading();
                        UseDispatcher(SP_Board, delegate
                        {
                            foreach (var line in drawDataBlock.Lines)
                            {
                                Draw(Canvas_Drawing,
                                     new CustomBrush(drawDataBlock.Color, drawDataBlock.Thickness), line.X1, line.Y1, line.X2, line.Y2);
                            }
                        });
                        UseDispatcher(TBl_ControlPanel, delegate { WriteDebug("DrawDataBlock", LogLevels.Debug); });
                    }
                    else if (m as ServerDisconnect != null)
                    {
                        client.OnServerDisconnect();
                    }
                }

                //Server only receives
                else if (ApplicationMode == Modes.Server)
                {
                    if (m as ClientDisconnect != null)
                    {
                        server.OnClientDisconnect((Transfer <MessageContainer>)sender);
                    }
                }
            }
        }