Exemple #1
0
        private void SetIncomeChannel(TelegramBotClient botClient)
        {
            DataBase db = Singleton.GetInstance().Context;

            var total = ConvertInUAH();

            List <ChannelInfo> channel = null;

            channel = StartSession.Test(db.GetChannelsList(), user.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, user.ID, total);
            SetIncomeChannelAdmin(channel, total, botClient);
        }
        public List <object> getOutputNode(
            List <object> aCompressesMediaTypes,
            StartSession aStartSession,
            StartSession aStopSession,
            WriteClientIP aWriteClientIP)
        {
            HttpOutputByteStream.WebServerConfiguration lConfig = new HttpOutputByteStream.WebServerConfiguration();

            lConfig.ServerName = "MP4 Screen capture server";

            lConfig.IPAddress = IPAddress.Loopback;

            lConfig.MIME = "video/mp4";

            lConfig.Port = 8080;

            mServer = HttpOutputByteStream.createByteStream(lConfig, aStartSession, aStopSession, aWriteClientIP);

            mIMFByteStream = mServer;

            List <object> lTopologyOutputNodesList = new List <object>();

            if (mIMFByteStream != null)
            {
                mSinkFactory.createOutputNodes(
                    aCompressesMediaTypes,
                    mIMFByteStream,
                    out lTopologyOutputNodesList);
            }

            return(lTopologyOutputNodesList);
        }
    public dynamic StartSes(int duration)
    {
        StartSession startSession = new StartSession();

        startSession.id       = "StartSession";
        startSession.duration = duration;
        return(startSession);
    }
 public static HttpOutputByteStream createByteStream(
     WebServerConfiguration aConfig,
     StartSession aStartSession,
     StartSession aStopSession,
     WriteClientIP aWriteClientIP)
 {
     return(new HttpOutputByteStream(aConfig, aStartSession, aStopSession, aWriteClientIP));
 }
            private HttpOutputByteStream(
                WebServerConfiguration aConfig,
                StartSession aStartSession,
                StartSession aStopSession,
                WriteClientIP aWriteClientIP)
            {
                mWebServer = new WebServer(aConfig, aStartSession, aStopSession, aWriteClientIP);

                mWebServer.Start();
            }
        public static String GetPriceString(PostTemplate template)
        {
            StringBuilder builder = new StringBuilder();
            DataBase      db      = Singleton.GetInstance().Context;

            Single totalPrice = 0.0f;

            builder.Append("Чек:\n");

            builder.Append($"Тип поста ({GetPostTypeName((TypePostTime)template.isPinnedMessage)}): {GetPostTypePrice((TypePostTime)template.isPinnedMessage)} грн\n");
            if (template.isPinnedMessage == 0)
            {
                builder.Append("Старндартное сообщение постится в указаное время!\n");
            }
            else
            {
                builder.Append("Сообщение с закрепом постится каждый день в 12:00, удалятся каждый день в 11:00!\n");
            }

            //totalPrice += GetPostTypePrice((TypePostTime)template.isPinnedMessage);

            foreach (PostChannel item in template.PostChannel)
            {
                if (item.Channel != null)
                {
                    totalPrice += StartSession.NumberOfParticipants(item.Channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
                else
                {
                    Channel channel = db.GetChannel(item.ChannelId);
                    totalPrice += StartSession.NumberOfParticipants(channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
                builder.Append($"{item.Channel.ChannelName}: {item.Channel.Price} грн\n");
            }

            builder.Append($"\n");



            foreach (PostTime item in template.PostTime)
            {
                if (item.Time != System.DateTime.Today)
                {
                    totalPrice += PriceData.postTypeTime;

                    builder.Append($"\nПост на {item.Time.ToString("hh:mm:ss, dd.MM.yyyy")}: {PriceData.postTypeTime} грн");
                }
            }

            builder.Append($"\n\nВсего: {(Int32)totalPrice} грн");

            return(builder.ToString());
        }
Exemple #7
0
        public virtual async Task SerializeConcretTypeDeserializeBaseType()
        {
            this.stream.Register <StartSession>();
            var value = new StartSession();

            await this.stream.Write(value);

            this.memory.Seek(0, SeekOrigin.Begin);
            var result = await this.stream.Read <Event>();

            Assert.Equal(result, value);
        }
        public static LabeledPrice[] GetLabelPrices(PostTemplate template)
        {
            List <LabeledPrice> prices = new List <LabeledPrice>();
            DataBase            db     = Singleton.GetInstance().Context;

            Single totalPrice = 0.0f;

            //totalPrice += GetPostTypePrice((TypePostTime)template.isPinnedMessage);
            String temp = "";

            if (template.isPinnedMessage == 0)
            {
                temp = "Старндартное сообщение постится в указаное время!\n";
            }
            else
            {
                temp = "Сообщение с закрепом постится каждый день в 12:00, удалятся каждый день в 11:00!\n";
            }

            prices.Add(new LabeledPrice($"Тип поста: {GetPostTypeName((TypePostTime)template.isPinnedMessage)} " + temp, (Int32)GetPostTypePrice((TypePostTime)template.isPinnedMessage) * 100));


            foreach (PostChannel item in template.PostChannel)
            {
                if (item.Channel != null)
                {
                    totalPrice = StartSession.NumberOfParticipants(item.Channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
                else
                {
                    Channel channel = db.GetChannel(item.ChannelId);
                    totalPrice = StartSession.NumberOfParticipants(channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
                if (totalPrice < 0)
                {
                    totalPrice = 1;
                }
                prices.Add(new LabeledPrice($"Чат {item.Channel.ChannelName}", ((Int32)item.Channel.Price * 100) + (Convert.ToInt32(totalPrice) * 100)));
            }

            foreach (PostTime item in template.PostTime)
            {
                if (item.Time != System.DateTime.Today)
                {
                    prices.Add(new LabeledPrice($"Пост на {item.Time.ToString("hh:mm:ss, dd.MM.yyyy:")} ", (Int32)PriceData.postTypeTime * 100));
                }
            }

            return(prices.ToArray());
        }
                /// <summary>
                /// New WebServer
                /// </summary>
                /// <param name="webServerConf">WebServer Configuration</param>
                public WebServer(
                    WebServerConfiguration webServerConf,
                    StartSession aStartSession,
                    StartSession aStopSession,
                    WriteClientIP aWriteClientIP)
                {
                    this.Configuration = webServerConf;

                    mStartSession += aStartSession;

                    mStopSession += aStopSession;

                    mWriteClientIP += aWriteClientIP;
                }
Exemple #10
0
        public async Task StartAsync(StartSession cmd)
        {
            cmd.Validate();

            var session = await _sessionsDao.GetAsync(cmd.Id);

            if (session == null)
            {
                throw new ObjectNotFoundException(cmd.Id, typeof(Student));
            }

            session.Start();
            await _sessionsDao.UpdateAsync(session);
        }
Exemple #11
0
        /// <inheritdoc/>
        public override void OnActivate()
        {
            base.OnActivate();

            // When there are profiles available from before (connecting to the same server again),
            // and there is exactly one profile available, auto-connect.
            if (Profiles != null && Profiles.Count == 1)
            {
                SelectedProfile = Profiles[0];
                if (StartSession.CanExecute())
                {
                    StartSession.Execute();
                }
            }
        }
        public static Single GetTotalPrice(PostTemplate template)
        {
            DataBase db         = Singleton.GetInstance().Context;
            Single   totalPrice = 0.0f;

            //totalPrice += GetPostTypePrice((TypePostTime)template.isPinnedMessage);

            foreach (PostChannel item in template.PostChannel)
            {
                if (item.Channel != null)
                {
                    totalPrice += StartSession.NumberOfParticipants(item.Channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
                else
                {
                    Channel channel = db.GetChannel(item.ChannelId);
                    totalPrice += StartSession.NumberOfParticipants(channel.InviteLink.Split("@")[1]) * (item.Channel.Price + GetPostTypePrice((TypePostTime)template.isPinnedMessage));
                }
            }

            foreach (PostTime item in template.PostTime)
            {
                if (item.Time != System.DateTime.Today)
                {
                    totalPrice += PriceData.postTypeTime;
                }
            }
            if ((totalPrice * 100) > 0)
            {
                return(totalPrice * 100);
            }
            else
            {
                return(100);
            }
        }