Пример #1
0
        /// <summary>
        /// 加载用户信息
        /// </summary>
        private void load_user()
        {
            //要查询的信息
            string UserPhone = "UserPhone";
            string UserName  = "******";
            string UserEmail = "UserEmail";
            string UserAdd   = "UserAdd";

            //开始查询
            DBO dbo = new DBO();

            dbo.Open();
            string tableName   = "user_table";
            string userNameCol = "user_id";
            string mge         = dbo.FindRow(tableName, userNameCol, this.userID);

            dbo.Close();
            //查询 结束
            if (mge == null)
            {
                MessageBox.Show("未查找到!", "错误");
                return;
            }
            string[] splitChar = { "," };
            string[] result    = mge.Split(splitChar, StringSplitOptions.None);

            this.phone    = result[1];
            this.username = result[2];
            this.email    = result[4];
            this.add      = result[6];

            this.refreshLbl();
            //MessageBox.Show(mge);
        }
Пример #2
0
        /// <summary>
        /// 菜单保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.game_id != null)
            {
                return;
            }
            //GUID生成GAME ID
            string game_id = Guid.NewGuid().ToString();

            this.game_id = game_id;

            DBO dbo = new DBO();

            dbo.Open();
            //在game table中插入初始化信息
            string[] mge1 = { "game_id", "match_id", "game_home_id", "game_visit_id", "game_date", "game_begin_time", "game_half_scored", "game_end_scored", "game_extra_time_scored", "game_penalty_scored", game_id, "01", "0001", "0002", "", "", "", "", "", "" };
            dbo.Insert("game_table", mge1.Length / 2, mge1);

            //在user_work中插入初始化信息
            string[] mge2 = { "user_work_id", "user_id", "game_id", "work_state", this.home.get_userId() + game_id, this.home.get_userId(), game_id, "未完成" };
            dbo.Insert("user_work_table", mge2.Length / 2, mge2);

            //GameRefereeTable中插入相关信息
            string[] mge3 = { "Greferee_id", "game_id", "referee_id_1", "0001" + game_id, game_id, "0001" };
            dbo.Insert("game_referee_table", mge3.Length / 2, mge3);

            //RefereeDataTable RefereePostionDataTable ActionDataTable 插入信息
            int rowLen = this.dataGridView1.Rows.Count;
            int colLen = this.dataGridView1.Columns.Count;

            for (int i = 0; i < rowLen; i++)
            {
                //this.dataGridView1[j, i].Value;
                //RefereeDataTable
                string   RefereeDataID = i.ToString() + game_id;
                string[] mge6          = { "referee_data_id", "game_id", RefereeDataID, game_id, };
                dbo.Insert("referee_data_table", mge6.Length / 2, mge6);
                //RefereePostionDataTable
                string   RPositionDataID = Guid.NewGuid().ToString();
                string[] mge4            = { "R_position_data_id", "referee_data_id", "R_position", "P_time", RPositionDataID, RefereeDataID, (string)this.dataGridView1[2, i].Value, (string)this.dataGridView1[1, i].Value };
                dbo.Insert("referee_postion_data_table", mge4.Length / 2, mge4);
                //ActionDataTable
                string   ActionDataID = Guid.NewGuid().ToString();
                string[] mge5         = { "action_data_id", "referee_data_id", "action_type", "action_position", "action_time", ActionDataID, RefereeDataID, "action id", (string)this.dataGridView1[4, i].Value, (string)this.dataGridView1[1, i].Value };
                dbo.Insert("action_data_table", mge5.Length / 2, mge5);
                //添加 RefereeDataTable 的信息
                string[] mge7 = { "action_data_id", ActionDataID, "R_position_id", RPositionDataID };
                dbo.Set("referee_data_table", "referee_data_id", RefereeDataID, mge7);
            }
            dbo.Close();

            MessageBox.Show("保存成功!");
        }
Пример #3
0
        /// <summary>
        /// 点击登陆按钮,检查输入后,从数据库中查找用户信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sign_Click(object sender, EventArgs e)
        {
            this.username = text_userName.Text;
            this.password = text_password.Text;
            bool isSuccess = false;

            //检查用户名和密码不能为空,为空者获得相应的输入焦点,并且函数return
            if (this.username == "" || this.username == null)
            {
                MessageBox.Show("请输入用户名!", "错误");
                text_userName.Focus();
                return;
            }
            if (this.password == "" || this.password == null)
            {
                MessageBox.Show("请输入密码!", "错误");
                text_password.Focus();
                return;
            }

            //要查询的信息
            string tableName   = "user_table";
            string userNameCol = "user_id";
            string passwordCol = "user_pwd";

            //数据库中检查用户名和密码
            //检查用户名和密码 开始
            DBO dbo = new DBO();

            dbo.Open();
            isSuccess = dbo.IsAllExisted(tableName, userNameCol, "123456", passwordCol, "123456");
            dbo.Close();
            //检查用户名和密码 结束

            //输入正确则打开主页面,不正确提示用户名或密码错误,清空密码,密码框获得焦点
            if (isSuccess)
            {
                MessageBox.Show("登陆成功!", "提示");

                //打开主页面
                this.Hide();
                optForm optform = new optForm(this.username);
                optform.StartPosition = FormStartPosition.CenterScreen;
                optform.Show();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!", "提示");
                text_password.Text = "";
                text_password.Focus();
            }
        }