博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
作业个人
阅读量:6046 次
发布时间:2019-06-20

本文共 8704 字,大约阅读时间需要 29 分钟。

计划:

    估计该项目所用时间:   6天

开发:

  需求分析:作为一名排球比赛的观众,我希望知道每场比赛的得分,以便掌握比赛的赛程。(精确到每局得分)

  计划文档:比赛结果的查询。

 

 

 

 

 

 

  

 

 

public partial class Form1 : Form    {        Action action = new Action();        public Form1()        {            InitializeComponent();        }              int i = 1;        private void btnH_Click(object sender, EventArgs e)        {            int H = Convert.ToInt32(txtH.Text);            int L = Convert.ToInt32(txtL.Text);            int H1 = Convert.ToInt32(txtH1.Text);            int L1 = Convert.ToInt32(txtL1.Text);            txtH.Text = (H+1).ToString();                       if (H >= 24 && (H - L) > 1)            {                txtH1.Text = (Convert.ToInt32(txtH1.Text) + 1).ToString();                if ((H1 + L1) == 0)                {                    txtCount1.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 1)                {                    txtCount2.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 2)                {                    txtCount3.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 3)                {                    txtCount4.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 4)                {                    txtCount5.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                txtH.Text = "0";                txtL.Text = "0";                if (txtH1.Text == "3")                {                    MessageBox.Show("红方胜利");                    Insert();                    txtH.Text = "0";                    txtH1.Text = "0";                    txtL.Text = "0";                    txtL1.Text = "0";                    txtCount1.Clear();                    txtCount2.Clear();                    txtCount3.Clear();                    txtCount4.Clear();                    txtCount5.Clear();                }            }            if (H1 + L1 > 3)            {                if (H >= 14 && (H - L) > 1)                {                    txtH1.Text = (Convert.ToInt32(txtH1.Text) + 1).ToString();                    if ((H1 + L1) == 4)                    {                        txtCount5.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text + "\r\n";                    }                    txtH.Text = "0";                    txtL.Text = "0";                    if (txtH1.Text == "3")                    {                        MessageBox.Show("红方胜利");                        Insert();                        txtH.Text = "0";                        txtH1.Text = "0";                        txtL.Text = "0";                        txtL1.Text = "0";                        txtCount1.Clear();                        txtCount2.Clear();                        txtCount3.Clear();                        txtCount4.Clear();                        txtCount5.Clear();                        i = 1;                    }                }            }        }        private void btnL_Click(object sender, EventArgs e)        {                        int H = Convert.ToInt32(txtH.Text);            int L = Convert.ToInt32(txtL.Text);            int H1 = Convert.ToInt32(txtH1.Text);            int L1 = Convert.ToInt32(txtL1.Text);            txtL.Text = (L+1).ToString();            if (L>= 24&&(L-H )>1)            {                txtL1.Text = (Convert.ToInt32(txtL1.Text) + 1).ToString();                if ((H1 + L1) == 0)                {                    txtCount1.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                } if ((H1 + L1) == 1)                {                    txtCount2.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 2)                {                    txtCount3.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 3)                {                    txtCount4.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                if ((H1 + L1) == 4)                {                    txtCount5.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                }                txtH.Text = "0";                txtL.Text = "0";                if (txtL1.Text == "3")                {                    MessageBox.Show("蓝方胜利");                    Insert();                    txtH.Text = "0";                    txtH1.Text = "0";                    txtL.Text = "0";                    txtL1.Text = "0";                    txtCount1.Clear();                    txtCount2.Clear();                    txtCount3.Clear();                    txtCount4.Clear();                    txtCount5.Clear();                }            }            if (H1 + L1 > 3)            {                if (L >= 14 && (L - H) > 1)                {                    txtL1.Text = (Convert.ToInt32(txtL1.Text) + 1).ToString();                    if ((H1 + L1) == 4)                    {                        txtCount5.Text += "第" + (i++) + "局:" + txtH.Text + ":" + txtL.Text;                    }                    txtH.Text = "0";                    txtL.Text = "0";                    if (txtL1.Text == "3")                    {                        MessageBox.Show("蓝方胜利");                        Insert();                        txtH.Text = "0";                        txtH1.Text = "0";                        txtL.Text = "0";                        txtL1.Text = "0";                        txtCount1.Clear();                        txtCount2.Clear();                        txtCount3.Clear();                        txtCount4.Clear();                        txtCount5.Clear();                        i = 1;                    }                }            }                   }        private void button1_Click(object sender, EventArgs e)        {            Form2 f2 = new Form2();            f2.Show();        }        public void Insert()         {            Model M = new Model();            M.IDA = textBox1.Text.Trim().ToString();            M.IDB = textBox2.Text.Trim().ToString();            M.ONE = txtCount1.Text.Trim().Substring(4, 4);            M.TWO = txtCount2.Text.Trim().Substring(4, 4);            M.THREE = txtCount3.Text.Trim().Substring(4, 4);            if (txtCount4.Text == "")            {                M.FOUR = null;            }            else            {                M.FOUR = txtCount4.Text.Trim().Substring(4, 4);            }            if (txtCount5.Text == "")            {                M.FIVE = null;            }            else            {                M.FIVE = txtCount5.Text.Trim().Substring(4, 4);            }            M.SUM = txtH1.Text.ToString() + ":" + txtL1.Text.ToString();            action.InsertPK(M);        }           }
public partial class Form2 : Form    {        Action action = new Action();        public Form2()        {            InitializeComponent();        }        private void Form2_Load(object sender, EventArgs e)        {            dataGridView1.DataSource = action.DataGridViewLoad();        }    }
public class Model    {       public string IDA { get; set; }       public string IDB { get; set; }       public string ONE { get; set; }       public string TWO{ get; set; }       public string THREE { get; set; }       public string FOUR { get; set; }       public string FIVE { get; set; }       public string SUM { get; set; }    }
public class Action    {       public DataTable DataGridViewLoad()       {           string sql = "select * from ballgeren";           //SqlConnection con = new SqlConnection("server=.;database=itcast;Integrated Security=ture;");           DataTable dt = SqlHelper.ExecuteDataTable(sql);           return dt;       }       public int InsertPK(Model M)       {           string sql = "insert into ballgeren values(@IDA,@IDB,@ONE,@TWO,@THREE,@FOUR,@FIVE,@SUM)";           SqlParameter[] pms = { new SqlParameter("@IDA",M.IDA),                                new SqlParameter("@IDB",M.IDB),                                new SqlParameter("@ONE",M.ONE),                                new SqlParameter("@TWO",M.TWO),                                new SqlParameter("@THREE",M.THREE),                                new SqlParameter("@FOUR",M.FOUR==null?DBNull.Value.ToString():M.FOUR),                                new SqlParameter("@FIVE",M.FIVE==null?DBNull.Value.ToString():M.FIVE),                                new SqlParameter("@SUM",M.SUM)};           int count = SqlHelper.ExecuteNonQuery(sql, pms);           return count;       }    }

 

转载于:https://www.cnblogs.com/lpq1/p/6220185.html

你可能感兴趣的文章
golang+es 爬取网易云音乐评论
查看>>
Math Constants
查看>>
Ajax.BeginForm的异步提交数据 简介
查看>>
Oracle 11g不能导出空表的三种解决方法
查看>>
Wordpress 文章添加副标题
查看>>
21 段实用便捷的 PHP 代码
查看>>
包子凑数
查看>>
CocosStudio文件解析工具CsdAnalysis
查看>>
python 网络通信编程之tcp套接字socket
查看>>
Sql语句批量更新数据(多表关联)
查看>>
设置密码到期的天数
查看>>
Matlab M文件“程序块”注释方法
查看>>
当当网首页——html代码
查看>>
使用JDBCTemplate实现与Spring结合,方法公用 ——共用实现类(BaseImpl)
查看>>
asp.net mvc 实战化项目之三板斧
查看>>
使用stream类型的Result实现Ajax
查看>>
自己重新编译VLFeat
查看>>
Scrapy简介
查看>>
在本地计算机无法启动world wide web Publishing 服务或者安装iis5无法启动iis默认网站...
查看>>
c#如何操作excel文件、Interior.ColorIndex 色彩列表
查看>>