首页 > 代码库 > 第十八周 个人作业

第十八周 个人作业

开发流程如下:

·项目计划

   完成这个项目需要的时间:5-7天

·项目开发

  ·需求分析:

    ·作为一名排球赛事管理者,我希望能统计各个队伍间的比分情况,并计算出各个队伍的的积分,以便能给队伍进行排名。

  ·设计文档

    ·由排球比赛用户故事的需求分析可知,此程序是用来统计各个队伍的比分和积分情况的,并按照积分高低排名。

  ·计划复审

    ·正在进一步的商讨中。

  ·代码规范

    ·根据Visual Studio 2010规范去写。

  ·具体设计

   ·URL活动图如下:

技术分享

   ·URL类图如下:

技术分享

 

    public partial class volleyball : System.Web.UI.Page
    {
        private JuFen jf = new JuFen();

        private volleyballDAL dal = new volleyballDAL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               
            }
        }

        public void Add(string add)
        {
            jf.JuFenA = Convert.ToInt32(txtJuFenA.Text);
            jf.JuFenB = Convert.ToInt32(txtJuFenB.Text);
            jf.ZongA = Convert.ToInt32(txtZongA.Text);
            jf.ZongB = Convert.ToInt32(txtZongB.Text);
            jf.Num = jf.ZongA = jf.ZongB;
            if(add=="A1")
            {
                jf.JuFenA += 1;
                txtJuFenA.Text = jf.JuFenA.ToString();
                PanDuan();
            }
            else if(add=="B1")
            {
                jf.JuFenB += 1;
                txtJuFenB.Text=jf.JuFenB .ToString();
                PanDuan();
            }
        }

        public void Jian(string sub)
        {
            jf.JuFenA = Convert.ToInt32(txtJuFenA.Text);
            jf.JuFenB = Convert.ToInt32(txtJuFenB.Text);
            jf.ZongA = Convert.ToInt32(txtZongA.Text);
            jf.ZongB = Convert.ToInt32(txtZongB.Text);
            jf.Num = jf.ZongA +jf.ZongB;
            if(sub=="A2")
            {
                if (Convert.ToInt32(txtJuFenA.Text) == 0)
                {
                    jf.JuFenA =0;
                    txtJuFenA.Text = jf.JuFenA.ToString();
                }
                else
                {
                    jf.JuFenA -= 1;
                    txtJuFenA.Text = jf.JuFenA.ToString();
                }

            }
            else if(sub == "B2")
            {
                if (Convert.ToInt32(txtJuFenB.Text) == 0)
                {
                    jf.JuFenB = 0;
                    txtJuFenB.Text = jf.JuFenB.ToString();
                }
                else
                {
                    jf.JuFenB -= 1;
                    txtJuFenB.Text = jf.JuFenB.ToString();
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string add="A1";
            Add(add);
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            string sub = "A2";
            Jian(sub);
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string add = "B1";
            Add(add);
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            string sub = "B2";
            Jian(sub);
        }

        public void PanDuan()
        {
            if (Convert.ToInt32(txtJuFenA.Text) == 25)
            {
                jf.ZongA += 1;
                txtZongA.Text = jf.ZongA.ToString();
                txtJuFenXianShi.Text += "第" + (jf.JuNum) + "局:" + Convert.ToInt32(txtJuFenA.Text) + ":" + Convert.ToInt32(txtJuFenB.Text) + "\r\n";
            }
            else if (Convert.ToInt32(txtJuFenB.Text) == 25)
            {
                jf.ZongB += 1;
                txtZongB.Text = jf.ZongB.ToString();
                txtJuFenXianShi.Text += "第" + (jf.JuNum) + "局:" + Convert.ToInt32(txtJuFenA.Text) + ":" + Convert.ToInt32(txtJuFenB.Text) + "\r\n";
            }
        }

    }

 

第十八周 个人作业