Ejemplo n.º 1
0
        private void SetIncomeChannel(Int32 id, Single total, PostTemplate postTemplate = null)
        {
            DataBase           db      = Singleton.GetInstance().Context;
            List <ChannelInfo> channel = null;

            if (postTemplate == null)
            {
                channel = StartSession.Test(db.GetChannelsList(), id);
            }
            else
            {
                List <Channel> channels = new List <Channel>();
                foreach (var item in postTemplate.PostChannel)
                {
                    Channel Thischannel = db.GetChannel(item.ChannelId);
                    channels.Add(Thischannel);
                }
                channel = StartSession.Test(channels, id);
            }

            Int32 temp = channel.Count;

            foreach (var item in channel)
            {
                IncomeChannel incomeChannel = db.GetIncomeChannels((item.Channel.Id + 1000000000000) * -1);
                if (incomeChannel == null)
                {
                    db.SetValue <IncomeChannel>(new IncomeChannel()
                    {
                        ChannelId = (item.Channel.Id + 1000000000000) * -1, DateTime = System.DateTime.Today, SumIncome = total / temp
                    });
                }
                else
                {
                    incomeChannel.SumIncome = (total / temp) + incomeChannel.SumIncome;
                }
            }
            db.Save();
            SetIncome(channel, id, total);
            SetIncomeChannelAdmin(channel, total);
        }
 private Boolean SetCode(TelegramBotClient botClient) => StartSession.SetCode(botClient, _message, _message.Text, user, db);
 private void SetNumber() => StartSession.AddNumber(_message.Text.Replace(" ", "").Replace("(", " ").Replace(")", "").Replace("+", ""));