예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["KifuID"] != null)
     {
         KifuService.DeleteKifu(KifuID, Session["user"].ToString());
         Response.Redirect("~/ThaPoTuMi/Home");
     }
 }
예제 #4
0
 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();
 }
예제 #5
0
        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();
            }
        }
예제 #6
0
        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();
            }
        }
예제 #7
0
        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());
        }
예제 #8
0
        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();
                }
            }
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
 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);
 }
예제 #11
0
 protected void btnListMyKifu_Click(object sender, EventArgs e)
 {
     rptList.DataSource = KifuService.GetMyKifu(Session["user"].ToString());
     rptList.DataBind();
 }
예제 #12
0
 private void SearchByOpening(string openID)
 {
     rptList.DataSource = KifuService.SearchKifuWithOpen(txtGameName.Text, txtPlayerName.Text, drRank.SelectedValue, openID);
 }