public override void Execute(TelegramBotClient botClient, System.Object message)
        {
            IStandartCommand standartCommand = new ThisIncomeUser();

            if (standartCommand.SetCallbackQuery(message, out _message))
            {
                return;
            }

            if (standartCommand.SetDataBase(out db))
            {
                return;
            }

            if (standartCommand.SetUserAndCheckIsNull(botClient, _message, out user, db))
            {
                return;
            }
            if (IsBan.Ban(botClient, message))
            {
                if (user.IsAdmin >= 2)
                {
                    SendMessage(botClient);

                    Income[] income = db.GetIncome();

                    PrintExel.GetAnaliticsIncome(income, botClient, _message, user);
                }
            }
        }
Ejemplo n.º 2
0
        private void SetIncome(List <ChannelInfo> channel, Int32 id, Single total)
        {
            DataBase db   = Singleton.GetInstance().Context;
            Int32    temp = channel.Count;

            foreach (var item in channel)
            {
                Income income = db.GetIncome(id, ((item.Channel.Id + 1000000000000) * -1));
                if (income == null)
                {
                    db.SetValue <Income>(new Income()
                    {
                        ChannelId = (item.Channel.Id + 1000000000000) * -1, UserId = id, dateTime = System.DateTime.Today, SumIncome = total / temp
                    });
                }
                else
                {
                    income.SumIncome = (total / temp) + income.SumIncome;
                }
            }
            db.Save();
        }