Exemplo n.º 1
0
        protected void Timer_Tick(object sender, EventArgs e)
        {
            int TimerTotalValue = Convert.ToInt32(((HiddenField)this.FindControl("TimerTotal")).Value) - 1;

            ((HiddenField)this.FindControl("TimerTotal")).Value = TimerTotalValue.ToString();
            ((Label)this.FindControl("WcfError_Label")).Text    = "目前無法連線至 WCF 服務,請確認 CrazyKTV 系統設定裡有啟用 WCF 服務, " + TimerTotalValue.ToString() + " 秒後系統將會再次嘗試連線。";

            if (TimerTotalValue == 0)
            {
                ((UpdateProgress)this.FindControl("UpdateProgress")).Visible = true;
            }
            if (TimerTotalValue == -1)
            {
                if (CrazyKTVWCF.checkWCF() == false)
                {
                    Response.Redirect("/gui_wcferror.aspx");
                }
                else
                {
                    System.Threading.Thread.Sleep(200);
                    GuiGlobal.SingerTypeDTStatus = GlobalFunctions.GetSingerTypeDT();
                    System.Threading.Thread.Sleep(200);
                    GuiGlobal.AllSongDTStatus = GlobalFunctions.GetAllSongDT();

                    if (GuiGlobal.SingerTypeDTStatus && GuiGlobal.AllSongDTStatus)
                    {
                        Response.Redirect("/default.aspx");
                    }
                    else
                    {
                        Response.Redirect("/gui_wcferror.aspx");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private string getSingerSex(string url, string singerType)
        {
            string _contecnt = CrazyKTVWCF.requestWeb(url);
            string _result   = "";

            MatchCollection _matches = Regex.Matches(_contecnt, "<td><a href(.*)</a>", RegexOptions.IgnoreCase | RegexOptions.Multiline);

            foreach (Match _match in _matches)
            {
                _result = _result + '"' + _match.ToString().Trim() + '"' + "," + singerType + Environment.NewLine;
            }

            _result = Regex.Replace(_result, "<(.|\\n)*?>", "", RegexOptions.Multiline | RegexOptions.IgnoreCase);
            _result = _result.Trim();
            _result = _result.Replace(@"&amp;", @"+");
            _result = _result.Replace(@" + ", @"+");
            _result = _result.Replace(@"&", @"+");
            _result = Regex.Replace(_result, "[%*/!!.-]", "", RegexOptions.Multiline | RegexOptions.IgnoreCase);
            _result = (@"<pre>" + Environment.NewLine + _result + Environment.NewLine + @"</pre>");



            // _contecnt = Regex.Replace(_contecnt, @"<(.|\n)*?>", "");

            // Match _match = Regex.Match(_contecnt, @"(\S*)mart10 link4 radius7 btlink2(.*)<div");
            // string key = @"<a " +_match.Groups[0].Value +@">";
            // _contecnt=Regex.Replace(key,@"<(?:([a-zA-Z\?][\w:\-]*)(\s(?:\s*[a-zA-Z][\w:\-]*(?:\s*=(?:\s*""(?:\\""|[^""])*""|\s*'(?:\\'|[^'])*'|[^\s>]+))?)*)?(\s*[\/\?]?)|\/([a-zA-Z][\w:\-]*)\s*|!--((?:[^\-]|-(?!->))*)--|!\[CDATA\[((?:[^\]]|\](?!\]>))*)\]\])>",Environment.NewLine);
            // _contecnt = (@"<pre>" + _contecnt + @"</pre>").Replace(Environment.NewLine + Environment.NewLine, singerType + Environment.NewLine);
            //// Console.WriteLine(_contecnt);

            return(_result);
        }
Exemplo n.º 3
0
        protected void BIns_Click(object sender, EventArgs e)
        {
            LinkButton  btn = (LinkButton)sender;
            GridViewRow row = (GridViewRow)btn.NamingContainer;

            var data = GridView1.DataKeys[row.RowIndex].Value.ToString(); //get hiddent Song_ID

            CrazyKTVWCF.DoCrazyKTV_Action(data.ToString().Trim(), "InsertV");
        }
Exemplo n.º 4
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            findCaller.Value = "";
            var data    = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0]; //get hidden Song_ID
            var dataStr = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[1]; //get hidden Song_Singer

            if (e.CommandName.ToLower().Trim() == "Add".ToLower().Trim())
            {
                // Convert the row index stored in the CommandArgument
                // property to an Integer.
                int index = Convert.ToInt32(e.CommandArgument);

                // Get the last name of the selected author from the appropriate
                // cell in the GridView control.

                //GridViewRow selectedRow = GridView1.Rows[index];
                //TableCell Song_Id = selectedRow.Cells[1];
                //CrazyKTVWCF.wcf_addsong(Song_Id.Text.Trim());

                CrazyKTVWCF.wcf_addsong(data.ToString().Trim());
            }
            else if (e.CommandName.ToLower().Trim() == "Insert".ToLower().Trim())
            {
                // Convert the row index stored in the CommandArgument
                // property to an Integer.
                int index = Convert.ToInt32(e.CommandArgument);

                // Get the last name of the selected author from the appropriate
                // cell in the GridView control.
                //GridViewRow selectedRow = GridView1.Rows[index];
                //TableCell Song_Id = selectedRow.Cells[1];
                //CrazyKTVWCF.wcf_insertsong(Song_Id.Text.Trim());

                CrazyKTVWCF.wcf_insertsong(data.ToString().Trim());
            }
            else if (e.CommandName.ToLower().Trim() == "Singer".ToLower().Trim())
            {
                //clean up data on display
                GridView1.DataSource = null;
                GridView1.DataBind();
                hideAllGridViewPanel();
                Panel2.Visible     = true;
                BNext.Visible      = false;
                BPrevious.Visible  = false;
                songDGpage.Value   = "0";
                LPageNumCount.Text = "1";

                findCaller.Value = "toTop";
                string _singer = dataStr.ToString().Trim(); // singer
                // gvMode.Value = data.ToString();
                tSearch.Text = _singer;
                SingerSongList(0, 100, _singer);
                ddSearchType.SelectedIndex = 1;
            }
        }
Exemplo n.º 5
0
        protected void BDel_Click(object sender, EventArgs e)
        {
            Button      btn = (Button)sender;
            GridViewRow row = (GridViewRow)btn.NamingContainer;
            //Response.Write("Row Index of Link button: " + row.RowIndex +
            //               "DataKey value:" + GridView1.DataKeys[row.RowIndex].Value.ToString());

            var data = GridView1.DataKeys[row.RowIndex].Value.ToString(); //get hiddent Song_ID

            CrazyKTVWCF.DoCrazyKTV_Action(data.ToString().Trim(), "Delete");
        }
Exemplo n.º 6
0
        private void getDataToGv()
        {
            string    jsonText = CrazyKTVWCF.ViewSong(0, 1000); // it will be very slow if more than 2000
            DataTable dt       = GlobalFunctions.JsontoDataTable(jsonText);

            DataView dv = new DataView(dt);

            //dv.Sort = "Song_Singer asc, Song_SongName asc, Song_Id asc";

            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
Exemplo n.º 7
0
        protected void Application_Start(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(500);
            if (CrazyKTVWCF.checkWCF())
            {
                if (GuiGlobal.SingerTypeDTStatus == false)
                {
                    GuiGlobal.SingerTypeDTStatus = GlobalFunctions.GetSingerTypeDT();
                    System.Threading.Thread.Sleep(200);
                }

                if (GuiGlobal.AllSongDTStatus == false)
                {
                    GuiGlobal.AllSongDTStatus = GlobalFunctions.GetAllSongDT();
                }
            }
        }
Exemplo n.º 8
0
        public static bool GetAllSongDT()
        {
            string jsonText = CrazyKTVWCF.QuerySong(null, null, null, null, 0, 1000000, "Song_Id");

            GuiGlobal.AllSongDT = GlobalFunctions.JsontoDataTable(jsonText);
            if (GuiGlobal.AllSongDT == null)
            {
                return(false);
            }
            System.Threading.Thread.Sleep(200);

            jsonText = CrazyKTVWCF.QuerySong(null, null, null, "Song_SingerType=3", 0, 1000000, "Song_Id");
            GuiGlobal.ChorusSongDT = GlobalFunctions.JsontoDataTable(jsonText);
            if (GuiGlobal.ChorusSongDT == null)
            {
                return(false);
            }
            System.Threading.Thread.Sleep(200);

            foreach (string langstr in GuiGlobal.SongLangList)
            {
                jsonText = CrazyKTVWCF.QuerySong(langstr, null, null, null, 0, GuiGlobal.MaxNewSongRows, "Song_CreatDate desc, Song_SongName");
                if (GlobalFunctions.JsontoDataTable(jsonText) == null)
                {
                    return(false);
                }
                GuiGlobal.NewSongDT.Merge(GlobalFunctions.JsontoDataTable(jsonText));
                System.Threading.Thread.Sleep(200);
            }

            foreach (string langstr in GuiGlobal.SongLangList)
            {
                jsonText = CrazyKTVWCF.QuerySong(langstr, null, null, "Song_PlayCount >= 1", 0, GuiGlobal.MaxTopSongRows, "Song_PlayCount desc, Song_SongName");
                if (GlobalFunctions.JsontoDataTable(jsonText) == null)
                {
                    return(false);
                }
                GuiGlobal.TopSongDT.Merge(GlobalFunctions.JsontoDataTable(jsonText));
                System.Threading.Thread.Sleep(200);
            }
            return(true);
        }
Exemplo n.º 9
0
        //protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
        //{
        //    //clean up data on display
        //    GridView1.DataSource = null;
        //    GridView1.DataBind();
        //    tSearch.Text = "";
        //    hideAllGridViewPanel();
        //    Panel2.Visible = true;
        //    BNext.Visible = false;
        //    BPrevious.Visible = false;
        //    songDGpage.Value = "0";
        //    LPageNumCount.Text = "1";

        //    var data = GridView2.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0]; //get DataKeyNames="User_ID"
        //    gvMode.Value = data.ToString();
        //    FSongList(0, 100, data.ToString());
        //}


        //protected void Bfavorite_Click(object sender, EventArgs e)
        //{
        //    //clean up data on display
        //    GridView1.DataSource = null;
        //    GridView1.DataBind();
        //    tSearch.Text = "";
        //    hideAllGridViewPanel();
        //    Panel2.Visible = true;
        //    BNext.Visible = false;
        //    BPrevious.Visible = false;
        //    songDGpage.Value = "0";
        //    LPageNumCount.Text = "1";


        //    //LocationID = Me.MyListView.DataKeys(currentItem.DataItemIndex)("LocationID")

        //    //var data = this.GridView2.DataKeys( ((Button)sender).Text.ToString(); //get DataKeyNames="User_ID"
        //    //gvMode.Value = data.ToString();
        //    //FSongList(0, 100, data.ToString());
        //}



        private void FSongList(int page, int rows, string user)
        {
            if (user.Length > 0)
            {
                CrazyKTVWCF.FavoriteLogin(user.ToString()); //need to login first to see favoritesongs
            }

            string jsonText = CrazyKTVWCF.FavoriteSong(user.ToString().Trim(), page, rows);

            DataTable dt3 = GlobalFunctions.JsontoDataTable(jsonText);
            DataView  dv3 = new DataView(dt3);

            //dv.Sort = "Song_Singer asc, Song_SongName asc, Song_Id asc";

            GridView1.DataSource = dv3;
            GridView1.DataBind();

            if (dv3.Count == rows)
            {
                BNext.Visible = true;
                if (page > 0)
                {
                    BPrevious.Visible = true;
                }
                else
                {
                    BPrevious.Visible = false;
                }
            }
            else
            {
                BNext.Visible = false;
                if (page > 0)
                {
                    BPrevious.Visible = true;
                }
                else
                {
                    BPrevious.Visible = false;
                }
            }
        }
Exemplo n.º 10
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                var data = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0]; //get hiddent Song_ID

                if (e.CommandName.ToLower().Trim() == "Insert".ToLower().Trim())
                {
                    int index = Convert.ToInt32(e.CommandArgument);
                    CrazyKTVWCF.DoCrazyKTV_Action(data.ToString().Trim(), "Insert");
                }
            }
            catch (Exception) { }


            //if (e.CommandName.ToLower().Trim() == "Del".ToLower().Trim())
            //{
            //    int index = Convert.ToInt32(e.CommandArgument);
            //    CrazyKTVWCF.DoCrazyKTV_Action(data.ToString().Trim(), "Delete");
            //}
        }
Exemplo n.º 11
0
        private void SingerSongList(int page, int rows, string Singer_Name)
        {
            string jsonText = CrazyKTVWCF.QuerySong(null, null, null, "Song_Singer like '%" + Singer_Name.Trim() + "%'", page, rows, "Song_Singer, Song_SongName");   //more than 2000 per rows will be super slow

            DataTable dt3 = GlobalFunctions.JsontoDataTable(jsonText);
            DataView  dv3 = new DataView(dt3);

            //dv.Sort = "Song_Singer asc, Song_SongName asc, Song_Id asc";

            GridView1.DataSource = dv3;
            GridView1.DataBind();

            if (dv3.Count == rows)
            {
                BNext.Visible = true;
                if (page > 0)
                {
                    BPrevious.Visible = true;
                }
                else
                {
                    BPrevious.Visible = false;
                }
            }
            else
            {
                BNext.Visible = false;
                if (page > 0)
                {
                    BPrevious.Visible = true;
                }
                else
                {
                    BPrevious.Visible = false;
                }
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Form["ddlanguage"] == null)
            {
                ddlanguage.SelectedValue = "zh-CHT";
                ddActions.SelectedValue  = "Waiting List";
                currentList1.Visible     = true;
            }



            // check if the WCF is alive
            if (CrazyKTVWCF.WCFlive == false)
            {
                if (CrazyKTVWCF.checkWCF() == false)
                {
                    // Response.Redirect("ErrorDeadWCF.aspx");
                }
            }

            GlobalFunctions.currentlang = ddlanguage.SelectedValue.ToString();
            // if WCF is alive then continue with other process
            System.Threading.Thread.Sleep(150);  // to display "loading" icon for 0.15 second
        }
Exemplo n.º 13
0
 protected void tuneDown_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(-1, "Pitch");
 }
Exemplo n.º 14
0
 protected void bAdd_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.wcf_addsong(tSongNumber.Text.Trim());
 }
Exemplo n.º 15
0
 protected void bInsert_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.wcf_insertsong(tSongNumber.Text.Trim());
 }
Exemplo n.º 16
0
 protected void FixVocal_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(null, "AmendSound");
 }
Exemplo n.º 17
0
 protected void FixVolume_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(null, "AmendVolume");
 }
Exemplo n.º 18
0
 protected void FastFoward_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "Forward");
 }
Exemplo n.º 19
0
 protected void FastBackward_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "Back");
 }
Exemplo n.º 20
0
 protected void Restart_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "RsetPlay");
 }
Exemplo n.º 21
0
 protected void Play_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "PlayPause");
 }
Exemplo n.º 22
0
 protected void Mute_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(null, "Mute");
 }
Exemplo n.º 23
0
 protected void FixedChannel_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(null, "Fixed");
 }
Exemplo n.º 24
0
 protected void Repeat_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "Replay");
 }
Exemplo n.º 25
0
 protected void BdForward_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "Forward");
     ((HiddenField)find.FindControl("findCaller")).Value = "";
 }
Exemplo n.º 26
0
 protected void tuneReset_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(-1, "DefaultPitch");
 }
Exemplo n.º 27
0
 protected void BdColumeUp_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(1, "Volume");
     ((HiddenField)find.FindControl("findCaller")).Value = "";
 }
Exemplo n.º 28
0
 protected void BdMute_Click(object sender, EventArgs e)
 {
     //CrazyKTVWCF.DoCrazyKTV_Control(null, "Mute");
     CrazyKTVWCF.DoCrazyKTV_Action(null, "SongRecoedList");
     ((HiddenField)find.FindControl("findCaller")).Value = "";
 }
Exemplo n.º 29
0
 protected void tuneWomanVoice_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Control(-1, "WomanVoice");
 }
Exemplo n.º 30
0
 protected void Cut_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.DoCrazyKTV_Action(null, "Cut");
 }