Пример #1
0
        /// <summary>
        /// 构造函数初始化调整操作窗口在屏幕上的位置
        /// </summary>
        public dataCollectForm(optForm opt, createProForm1 c1, createProForm2 c2)
        {
            InitializeComponent();

            this.home = opt;
            this.c1   = c1;
            this.c2   = c2;

            //调整位置
            int w = Screen.GetWorkingArea(this).Width;
            int h = Screen.GetWorkingArea(this).Height;

            this.Left = w - this.Width;
            this.Top  = (h - this.Height) / 2;

            this.refereeData.Text = "主裁判:       第一助理裁判:        第二助理裁判:         第四官员:           ";

            this.number.Width              = this.dataGridView1.Size.Width / 7;
            this.timeOfEvent.Width         = this.dataGridView1.Size.Width / 7;
            this.coordinateOfReferee.Width = this.dataGridView1.Size.Width / 7;
            this.eventOfGame.Width         = this.dataGridView1.Size.Width * 25 / 70;
            this.coordinateOfEvent.Width   = this.dataGridView1.Size.Width / 7;

            this.pictureBox1.ContextMenuStrip = this.contextMenuStrip1;

            this.g = pictureBox1.CreateGraphics();

            //不显示横向滚动条
            this.HorizontalScroll.Maximum = 0;
            this.AutoScroll             = false;
            this.VerticalScroll.Visible = false;
            this.AutoScroll             = true;
        }
Пример #2
0
        /// <summary>
        /// 点击下一步时,检查是否获取足够的信息,且在数据库中核验信息是否正确
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            bool isSuccess = false;

            //检查信息是否完整,不完整的获取相应焦点
            if (this.gameCategory == null || comboBox1.SelectedIndex.ToString() == null)
            {
                MessageBox.Show("请选择比赛类别!", "提示");
                comboBox1.Focus();
                return;
            }
            if (this.gameTime == null)
            {
                MessageBox.Show("请选择比赛时间!", "提示");
                dateTimePicker1.Focus();
                return;
            }
            if (this.address == null || this.address == "")
            {
                MessageBox.Show("请输入地址信息", "提示");
                textBox1.Focus();
                return;
            }

            //获取在哪里查询
            string DBServer   = "localhost";
            string DBname     = "test_schema";
            string DBuserName = "******";
            string DBpassword = "******";
            string tableName  = "test_table1";
            string testTime   = "idtest_time";
            string testAdress = "test_address";

            /*
             * //数据库中检查比赛信息
             * //检查比赛信息 开始
             * MySqlCommand cmd;
             * MySqlConnection conn;
             * long num;
             *
             * string connstring = "Server=" + DBServer + ";Database =" + DBname + ";Uid=" + DBuserName + ";Pwd=" + DBpassword + ";";
             *
             * conn = new MySqlConnection(connstring);
             * conn.Open();
             *
             * string query = "select count(*) from " + tableName + " where " + testTime + "='" + this.gameTime + "' and " + testAdress + "='" + this.address + "';";
             * cmd = new MySqlCommand(query, conn);
             *
             * num = (long)cmd.ExecuteScalar();
             * if (num != 0l) isSuccess = true;
             * else isSuccess = false;
             *
             * conn.Close();
             * //检查比赛信息 结束
             */

            //test
            isSuccess = true;

            if (isSuccess)
            {
                this.Hide();
                createProForm2 next = new createProForm2(this, this.lastForm);
                next.StartPosition = FormStartPosition.CenterScreen;
                next.Show();
            }
            else
            {
                MessageBox.Show("比赛信息错误,请检查重试!", "提示");
            }
        }