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"); } } } }
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(@"&", @"+"); _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); }
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"); }
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; } }
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"); }
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(); }
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(); } } }
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); }
//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; } } }
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"); //} }
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; } } }
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 }
protected void tuneDown_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(-1, "Pitch"); }
protected void bAdd_Click(object sender, EventArgs e) { CrazyKTVWCF.wcf_addsong(tSongNumber.Text.Trim()); }
protected void bInsert_Click(object sender, EventArgs e) { CrazyKTVWCF.wcf_insertsong(tSongNumber.Text.Trim()); }
protected void FixVocal_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(null, "AmendSound"); }
protected void FixVolume_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(null, "AmendVolume"); }
protected void FastFoward_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "Forward"); }
protected void FastBackward_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "Back"); }
protected void Restart_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "RsetPlay"); }
protected void Play_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "PlayPause"); }
protected void Mute_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(null, "Mute"); }
protected void FixedChannel_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(null, "Fixed"); }
protected void Repeat_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "Replay"); }
protected void BdForward_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "Forward"); ((HiddenField)find.FindControl("findCaller")).Value = ""; }
protected void tuneReset_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(-1, "DefaultPitch"); }
protected void BdColumeUp_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(1, "Volume"); ((HiddenField)find.FindControl("findCaller")).Value = ""; }
protected void BdMute_Click(object sender, EventArgs e) { //CrazyKTVWCF.DoCrazyKTV_Control(null, "Mute"); CrazyKTVWCF.DoCrazyKTV_Action(null, "SongRecoedList"); ((HiddenField)find.FindControl("findCaller")).Value = ""; }
protected void tuneWomanVoice_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Control(-1, "WomanVoice"); }
protected void Cut_Click(object sender, EventArgs e) { CrazyKTVWCF.DoCrazyKTV_Action(null, "Cut"); }