protected void Page_Load(object sender, EventArgs e) { KifuID = Int32.Parse(Request.QueryString["KifuID"]); Content = KifuService.GetKifuContent(KifuID); IsOwnKifu = false; if (Session["user"] != null) { favourite = new FavouriteKifu(KifuID, Session["user"].ToString()); IsFavour = FavouriteKifuService.IsFavour(favourite); IsOwnKifu = KifuService.IsOwnKifu(Session["user"].ToString(), KifuID); } if (!IsOwnKifu) { txtGameName.ReadOnly = true; txtGameEvent.ReadOnly = true; txtGameDate.ReadOnly = true; } if (!IsPostBack) { Content = KifuService.GetKifuContent(KifuID); txtGameDate.Text = DateTime.Parse(CommonService.GetContentInBracket(Content, "DT")).ToString("yyyy-MM-dd"); txtGameName.Text = CommonService.GetContentInBracket(Content, "GN"); txtGameEvent.Text = CommonService.GetContentInBracket(Content, "EV"); } rpComment.DataSource = FavouriteKifuService.GetKifuRating(KifuID); rpComment.DataBind(); lblRate.Text = FavouriteKifuService.GroupPointOfKifu(KifuID) + "/5"; GetOpen(); }
protected void btnIdentify_Click(object sender, EventArgs e) { ArrayList steps = KifuService.GetKifuStep(KifuID); string blackPlayer = CommonService.GetContentInBracket(Content, "PB"); string whitePlayer = CommonService.GetContentInBracket(Content, "PW"); KifuService.IdentifyOpening(KifuID, steps, blackPlayer, whitePlayer); }
protected void btnDelete_Click(object sender, EventArgs e) { if (Request.QueryString["KifuID"] != null) { KifuService.DeleteKifu(KifuID, Session["user"].ToString()); Response.Redirect("~/ThaPoTuMi/Home"); } }
protected void btnSearch_Click(object sender, EventArgs e) { if (cbOpening.Checked && !drOpen.SelectedValue.Equals("")) { SearchByOpening(drOpen.SelectedValue); } else { rptList.DataSource = KifuService.SearchKifu(txtGameName.Text, txtPlayerName.Text, drRank.SelectedValue); } rptList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("~/ThaPoTuMi/Home"); } if (!IsPostBack) { rptList.DataSource = KifuService.GetMyKifu(Session["user"].ToString()); rptList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rptTopNews.DataSource = KifuService.GetTopNewKifu(); rptTopNews.DataBind(); rptTopFavour.DataSource = FavouriteKifuService.GetTopFavouriteKifu(); rptTopFavour.DataBind(); rptTopOpening.DataSource = OpeningService.GetPopularOpening(); rptTopOpening.DataBind(); } }
protected void btnUpload_Click(object sender, EventArgs e) { string inputContent; //read content of sgf file using (StreamReader inputStreamReader = new StreamReader(KifuUpload.PostedFile.InputStream)) { inputContent = inputStreamReader.ReadToEnd(); } //process content KifuService.NewKifu(inputContent, Session["user"].ToString()); //increase point UserAccService.IncreasePoint(Session["user"].ToString()); }
private void GetOpen() { string blackPlayer = CommonService.GetContentInBracket(Content, "PB"); string whitePlayer = CommonService.GetContentInBracket(Content, "PW"); foreach (DataRow row in KifuService.GetKifuOpen(KifuID).Rows) { if (row["Player"].Equals(blackPlayer)) { txtBlackOpen.Text = row["OpenName"].ToString(); } else if (row["Player"].Equals(whitePlayer)) { txtWhiteOpen.Text = row["OpenName"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rptList.DataSource = KifuService.GetAllKifu(); rptList.DataBind(); drOpen.DataSource = KifuService.GetOpening(); drOpen.DataTextField = "OpenName"; drOpen.DataValueField = "OpenID"; drOpen.DataBind(); } if (Request.QueryString["openID"] != null) { SearchByOpening(Request.QueryString["openID"]); rptList.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { Kifu kifu = new Kifu(KifuID, txtGameName.Text, txtGameEvent.Text, DateTime.Parse(txtGameDate.Text)); int res = KifuService.UpdateGeneralInformation(kifu); }
protected void btnListMyKifu_Click(object sender, EventArgs e) { rptList.DataSource = KifuService.GetMyKifu(Session["user"].ToString()); rptList.DataBind(); }
private void SearchByOpening(string openID) { rptList.DataSource = KifuService.SearchKifuWithOpen(txtGameName.Text, txtPlayerName.Text, drRank.SelectedValue, openID); }