public override void Execute(TelegramBotClient botClient, System.Object message) { IStandartCommand standartCommand = new ThisIncomeAdmin(); 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); IncomeChannelAdmin[] income = db.GetIncomeChannelsAdmin(); PrintExel.GetAnaliticsIncomeAdmin(income, botClient, _message, user); } } }
private void SetIncomeChannelAdmin(List <ChannelInfo> channel, Single total) { if (channel == null) { throw new ArgumentNullException(nameof(channel)); } DataBase db = Singleton.GetInstance().Context; total = (total * 20) / 100; foreach (var item in channel) { Int32 temp = item.Admins.Count; foreach (var admin in item.Admins) { IncomeChannelAdmin income = db.GetIncomeChannelsAdmin(admin.Id, ((item.Channel.Id + 1000000000000) * -1)); if (admin.Id != BotClient.BotId) { if (income == null) { db.SetValue <IncomeChannelAdmin>(new IncomeChannelAdmin() { ChannelId = (item.Channel.Id + 1000000000000) * -1, UserId = admin.Id, DateTime = System.DateTime.Today, SumIncome = total / temp }); } else { income.SumIncome = (total / temp) + income.SumIncome; } } } } db.Save(); }