private void DeleteRegisterRoom(int room_num)
        {
            SqlConnection sql_connection = main_window.Sqlcon();

            try
            {
                sql_connection.Open();
                string     commandStr  = $"delete register where 房间号='{room_num}'";
                SqlCommand sql_command = new SqlCommand(commandStr, sql_connection);
                sql_command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sql_connection.Close();
            }
        }
        private void AddRetister()
        {
            SqlConnection sql_connection = main_window.Sqlcon();

            try
            {
                sql_connection.Open();
                string commandStr = "insert register (房间号,房间类型,入住人,身份证号,联系方式,交易码,实收,房间状态,入住时间,备注)values" +
                                    $"('{Convert.ToInt32(tbLiveInNum.Text)}','{cbLiveInType.Text}','{tbLiveInName.Text}','{tbLiveInId.Text}'," +
                                    $"'{tbLiveInTel.Text}','{tbLiveInSign.Text}','{Convert.ToDecimal(tbLiveInIncome.Text)}'," +
                                    $"'{cbLiveInStatus.Text}','{DateTime.Now}','{tbLiveInRemark.Text}')";
                SqlCommand sql_command = new SqlCommand(commandStr, sql_connection);
                sql_command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sql_connection.Close();
            }
        }
Exemple #3
0
        public DataSet CheckAccountValue()
        {
            SqlConnection sql_connection = main_window.Sqlcon();
            DataSet       data_set       = new DataSet();

            try
            {
                sql_connection.Open();
                string         adapterStr  = "select * from account";
                SqlDataAdapter sql_adapter = new SqlDataAdapter(adapterStr, sql_connection);
                sql_adapter.Fill(data_set, "account");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sql_connection.Close();
            }
            return(data_set);
        }
        private void AddRoom()
        {
            SqlConnection sql_connection = main_window.Sqlcon();

            try
            {
                sql_connection.Open();
                string commandStr = "insert roomTable (房间号,房间类型,所在楼层,价格,房间状态,备注) values" +
                                    $"('{tbAddroomNum.Text}','{cbAddroomType.Text}','{cbAddroomLevel.Text}'," +
                                    $"'{tbAddroomPrice.Text}','{cbAddroomStatus.Text}','{tbAddroomRemark.Text}')";
                SqlCommand sql_command = new SqlCommand(commandStr, sql_connection);
                sql_command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sql_connection.Close();
            }
        }
        private void AddAccount()
        {
            SqlConnection sql_connection = main_window.Sqlcon();

            try
            {
                sql_connection.Open();
                string commandStr = "insert account (username,pwd,权限,备注) values " +
                                    $"('{tbAccount_name.Text}','{tbAccount_pwd.Text}','{cbAccount_power.Text}'," +
                                    $"'{tbAccount_remark.Text}')";
                SqlCommand sql_command = new SqlCommand(commandStr, sql_connection);
                sql_command.ExecuteNonQuery();
            }
            //catch (Exception ex)
            //{

            //    MessageBox.Show(ex.Message);
            //}
            finally
            {
                sql_connection.Close();
            }
        }