示例#1
0
        public void MigrateTwitchVODMetadata()
        {
            var channelId = _twitchService.GetChannelIdFromChannelName("dasmehdi").GetAwaiter().GetResult();

            ChannelVideos videos = null;

            var offset = 0;

            do
            {
                videos = _twitchService.GetVideosFromChannelId(channelId, offset).GetAwaiter().GetResult();

                videos.Videos.ForEach(video =>
                {
                    var vod = new Vod()
                    {
                        ImportedAt = DateTime.UtcNow,
                        Video      = video
                    };

                    var dbVod = _vodCollection.AddOrUpdateAsync(vod).GetAwaiter().GetResult();
                    Assert.IsInstanceOfType(dbVod, typeof(Vod));
                });

                offset += 100;
            } while (offset <= videos.Total);
        }
示例#2
0
 private void OK_Click(object sender, RoutedEventArgs e)
 {
     if (CheckFields())
     {
         if (SelectedId == 0)
         {
             db.Vods.Add(new Vod
             {
                 F     = F.Text,
                 I     = I.Text,
                 O     = O.Text,
                 Klass = Convert.ToInt32(Klass.Text),
                 Stazh = Convert.ToInt32(Stazh.Text)
             });
             LogInsert();
         }
         else
         {
             Vod vod = db.Vods.Where(e => e.IdVod == SelectedId).Single();
             LogUpdate(vod);
             vod.F     = F.Text;
             vod.I     = I.Text;
             vod.O     = O.Text;
             vod.Klass = Convert.ToInt32(Klass.Text);
             vod.Stazh = Convert.ToInt32(Stazh.Text);
         }
         db.SaveChanges();
         Exit();
     }
 }
示例#3
0
 public void Initialize(Vod entity)
 {
     Initialize();
     SelectedId = entity.IdVod;
     F.Text     = entity.F;
     I.Text     = entity.I;
     O.Text     = entity.O;
     Klass.Text = entity.Klass.ToString();
     Stazh.Text = entity.Stazh.ToString();
 }
示例#4
0
 private void Update_Click(object sender, RoutedEventArgs e)
 {
     if (VodTable.SelectedIndex >= 0)
     {
         Vod Item = (dynamic)VodTable.SelectedItem;
         VodEditView.IsEnabled  = true;
         VodEditView.Visibility = Visibility.Visible;
         VodEditView.Initialize(Item);
         EditHeight.Height = new GridLength(90);
     }
 }
    // 勝ち負け表示.
    // p_VoD	:	勝った色.
    private string VictoryText(Vod p_VoD)
    {
        string retText = "";
        if (p_VoD == Vod.white) {
            retText = "白の勝ち\n\n";
        } else if (p_VoD == Vod.black) {
            retText = "黒の勝ち\n\n";
        } else {
            retText = "引き分け\n\n";
        }

        retText += "黒の数:" + (board.StoneCount (false) + gameInfo.GetMultiplicationBlack) + "\n";
        retText += "白の数:" + (board.StoneCount (true) + gameInfo.GetMultiplicationWhite) + "\n";

        return retText;
    }
示例#6
0
        public Form1()
        {
            InitializeComponent();

            label4.Font      = new Font("Ariel", 14);
            this.label5.Font = new Font("Ariel", 14);

            cvor[0] = new Cvor(1, 11000, new List <int> {
                2
            });
            cvor[1] = new Cvor(2, 10900, new List <int> {
                1, 3
            });
            cvor[2] = new Cvor(3, 10800, new List <int> {
                2
            });
            cvor[3] = new Cvor(4, 10800, new List <int> {
                2, 5, 6
            });
            cvor[4] = new Cvor(5, 10700, new List <int> {
                4
            });
            cvor[5] = new Cvor(6, 10680, new List <int> {
                4
            });

            vod[0] = new Vod(12, 5.56, cvor[0], cvor[1]);
            vod[1] = new Vod(23, 5.56, cvor[1], cvor[2]);
            vod[2] = new Vod(24, 5.56, cvor[1], cvor[3]);
            vod[3] = new Vod(45, 5.71, cvor[3], cvor[4]);
            vod[4] = new Vod(46, 5.81, cvor[3], cvor[5]);

            for (int i = 0; i < cvor.Length; i++)
            {
                ListaCvorova.Add(cvor[i]);
            }

            for (int i = 0; i < vod.Length; i++)
            {
                ListaVodova.Add(vod[i]);
            }

            foreach (var item in ListaVodova)
            {
                listaParova.Add(new ParoviStruja(item.id));
            }
        }
示例#7
0
        private static VodMovie GetVodMovie(Vod vod, string provider, int providerMask, string category)
        {
            VodMovie vodMovie = new VodMovie();

            vodMovie.Provider         = provider;
            vodMovie.ProviderMask     = providerMask;
            vodMovie.ProviderCategory = category;
            vodMovie.ProviderId       = vod.id;
            vodMovie.Image            = vod.imageposter;
            vodMovie.Image_Local      = null;
            vodMovie.Title            = vod.title;
            vodMovie.Price            = vod.ppvprice / 100m;
            vodMovie.ValidFrom        =
                (new DateTime(1970, 1, 1)).AddSeconds(vod.validfrom).ToLocalTime();
            vodMovie.ValidUntil =
                (new DateTime(1970, 1, 1)).AddSeconds(vod.validuntil).ToLocalTime();
            return(vodMovie);
        }
示例#8
0
 private void LogUpdate(Vod vod)
 {
     try
     {
         System.IO.StreamWriter writer = new System.IO.StreamWriter(@"Log.txt", true);
         writer.WriteLine(DateTime.Now.ToString() + " Пользователь " + ActiveUser.NameUser + " отредактировал запись в таблице VOD: " +
                          +vod.IdVod + "^" + vod.F + "^" + vod.I + "^" + vod.O + "^" + vod.Klass + "^" + vod.Stazh);
         writer.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exception: " + ex.Message);
     }
     finally
     {
         Console.WriteLine("");
     }
 }
        public async Task <HttpResponseMessage> Get(string searchVal)
        {
            LogWriter._other(TAG, string.Format(@"[>>] Request: [{0}]", searchVal));
            HttpResponseMessage    message  = new HttpResponseMessage();
            refreshServiceResponse response = new refreshServiceResponse();
            string ip       = httpUtil.GetClientIPAddress(HttpContext.Current.Request);
            string secToken = string.Empty;

            try
            {
                secToken = HttpContext.Current.Request.Headers["Authorization"].Replace("Basic ", "").Trim();
                if (dbconn.idbStatOK())
                {
                    string insId    = string.Empty;
                    string insPhone = string.Empty;
                    if (dbconn.tabletCheckToken(secToken, out insId, out insPhone))
                    {
                        LogWriter._noti(TAG, string.Format(@"Request Token: [{0}], InstallerId: [{1}]", secToken, insId));
                        DataTable dt = dtS(searchVal);
                        if (dt.Rows.Count == 1)
                        {
                            string         fName    = dt.Rows[0]["SUBSCRIBER_FNAME"].ToString();
                            string         cardNo   = dt.Rows[0]["CARD_NO"].ToString();
                            string         admin    = dt.Rows[0]["PHONE_NO"].ToString();
                            DataTable      dtP      = dbconn.getTable(appServiceQry._getRefProduct(cardNo));
                            DataTable      dtN      = dbconn.getTable(appServiceQry._getRefNvod(cardNo));
                            DataTable      dtL      = dbconn.getTable(appServiceQry._getRefLive(cardNo));
                            List <Product> prodList = new List <Product>();
                            List <Vod>     vodList  = new List <Vod>();
                            List <Live>    liveList = new List <Live>();
                            foreach (DataRow item in dtP.Rows)
                            {
                                Product prd = new Product();
                                prd.productName = item["PRODUCT_NAME_MON"].ToString();
                                prd.endDate     = item["ENDTIME"].ToString();
                                prodList.Add(prd);
                            }
                            foreach (DataRow item in dtN.Rows)
                            {
                                Vod vod = new Vod();
                                vod.contentName = item["NAME_MON"].ToString();
                                vod.endDate     = item["ENDTIME"].ToString();
                                vodList.Add(vod);
                            }
                            foreach (DataRow item in dtL.Rows)
                            {
                                Live live = new Live();
                                live.concertName = item["CONTENT_NAME"].ToString();
                                live.endDate     = item["ENDTIME"].ToString();
                                liveList.Add(live);
                            }
                            response.isSuccess     = true;
                            response.errorCode     = Convert.ToString((int)HttpStatusCode.OK);
                            response.resultMessage = "success";
                            response.firstName     = fName;
                            response.cardNo        = cardNo;
                            response.adminNo       = admin;
                            response.products      = prodList;
                            response.vods          = vodList;
                            response.lives         = liveList;
                        }
                        else
                        {
                            response.isSuccess     = false;
                            response.errorCode     = Convert.ToString((int)HttpStatusCode.NotFound);
                            response.resultMessage = "Хайлтын үр дүн хоосон байна.";
                        }
                    }
                    else
                    {
                        response.isSuccess     = false;
                        response.errorCode     = Convert.ToString((int)HttpStatusCode.Unauthorized);
                        response.resultMessage = "Session has expired";
                    }
                }
                else
                {
                    response.isSuccess     = false;
                    response.errorCode     = Convert.ToString((int)HttpStatusCode.InternalServerError);
                    response.resultMessage = "Internal Error";
                }
            }
            catch (Exception ex)
            {
                LogWriter._error(TAG, string.Format(@"Token: [{0}], Exception: [{1}]", secToken, ex.ToString()));
                response.isSuccess     = false;
                response.errorCode     = Convert.ToString((int)HttpStatusCode.InternalServerError);
                response.resultMessage = ex.Message;
            }
            LogWriter._other(TAG, string.Format(@"[<<] ClientIp: [{0}], Response: [{1}]", ip, serializer.Serialize(response)));
            message = Request.CreateResponse(HttpStatusCode.OK, response);
            return(message);
        }