Example #1
0
        public UserGUI(string uid)      //
        {
            InitializeComponent();
            this.uid = uid;
            bool HaveReservation = false;

            dbsql  db    = new dbsql();
            string query = "select * from User_Seat where U_ID =" + uid
                           + "AND Star_Time>" + System.DateTime.Now.ToShortDateString().ToString();

            DataTable selectTable = db.ExecuteQuery(query);

            if (selectTable != null && selectTable.Rows.Count > 0)
            {
                HaveReservation = true;
            }

            if (HaveReservation)
            {
                FloorBookBtn.Visible = false;
                TimeBookBtn.Visible  = false;
                query = "select Star_Time from User_Seat WHERE U_ID=" + uid;
                DataTable userTable = db.ExecuteQuery(query);
                StartTimeLabel.Text = userTable.Rows[0][0].ToString();

                query             = "select End_Time from User_Seat WHERE U_ID=" + uid;
                userTable         = db.ExecuteQuery(query);
                EndTimeLabel.Text = userTable.Rows[0][0].ToString();
            }
            else
            {
                CancelPanel.Visible = false;
            }
        }
Example #2
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            dbsql  db    = new dbsql();
            string query = "DELETE FROM User_Seat WHERE U_ID =" + uid;
            int    right = db.ExecuteUpdate(query);

            if (right == 3)
            {
                MessageBox.Show("删除预约成功", "成功");
            }
            this.Close();
        }
Example #3
0
        private bool VerifyID()                 //用于在登陆界面校验密码是否正确
        {
            String str1 = IDTextBox.Text;       //获取用户输入的ID
            String str2 = PasswordTextBox.Text; //获取用户输入的密码
            String str3;

            if (SelectUser.Checked)       //如果以学生身份
            {
                str3 = "select U_ID,Password FROM D_User WHERE U_ID='" + str1 + "'AND Password='******'";
                dbsql res = new dbsql();  
                                DataTable dt = new DataTable();    
                                          dt = res.ExecuteQuery(str3);      
                                            if (dt != null && dt.Rows.Count > 0)
                {
                                       //判断是否能找的匹配的数据
                                    {
                        return(true);  //身份校验成功
                    }
                }
            }

            if (SelectManager.Checked)       //如果以管理员身份
            {
                str3 = "select M_ID,M_Password FROM D_Manager WHERE M_ID='" + str1 + "'AND M_Password='******'";
                dbsql res = new dbsql();  
                                DataTable dt = new DataTable();  
                                          dt = res.ExecuteQuery(str3);      
                                            if (dt != null && dt.Rows.Count > 0)
                {
                                       //判断是否能找的匹配的数据
                                    {
                        return(true);  //身份校验成功
                    }
                }
            }

            return(false);       //身份校验失败
        }