Esempio n. 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Query_output Query = new Query_output();

            Query.Output(sql_query_rooms, db_rooms, table_rooms);
            Query.Output(sql_query_services, db_services, table_services);
        }
        public Customer_account()
        {
            InitializeComponent();
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
        }
        public Service_to_customers()
        {
            InitializeComponent();
            login_role.Text          = buffer.Role;
            login_object_output.Text = "Логин:" + buffer.login;
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
            Connect conn = new Connect();

            conn.connection();
            SqlCommand    command = new SqlCommand("EXEC sp_helpuser '" + buffer.login + "'", Connect.cnn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                string sql_Role = null;
                sql_Role = reader["RoleName"].ToString();
                if (sql_Role == "RP_Manager")
                {
                    staff.Visibility = Visibility.Hidden;
                    client.Margin    = new Thickness(835, 116, 0, 0);
                    service.Margin   = new Thickness(835, 181, 0, 0);
                    rooms.Margin     = new Thickness(835, 243, 0, 0);
                }
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     sql_explore = "SELECT Clients.ID_Client as [Код клиента],Clients.Surname  as [Фамилия],Clients.Name  as [Имя],Clients.Patronymic  as [Отчество],sum(Services.The_cost + Rooms.The_cost) as [Полный счет] FROM Clients INNER JOIN Rooms ON Clients.ID_Numbers = Rooms.ID_Numbers INNER JOIN [Services provided to the client] ON Clients.ID_Client = [Services provided to the client].ID_Client INNER JOIN Services ON [Services provided to the client].ID_Services = Services.ID_Services INNER JOIN Staff ON Clients.ID_Employee = Staff.ID_Employee";
     string[] explore = new string[] { "Код клиента", "Фамилия", "Имя", "Отчество" };
     if (explorer_textBox.Text == string.Empty)
     {
         MessageBox.Show("Поле поиска пустое", "Уведомление");
     }
     else if (explorer_box.ItemsSource == new TextBlock())
     {
         MessageBox.Show("Поле поиска пустое", "Уведомление");
     }
     else
     {
         for (int i = 0; i < explore.Length; i++)
         {
             if (explorer_box.Text == explore[i])
             {
                 sql_explore += " WHERE " + query_output_name[i] + " LIKE ";
             }
         }
         if (explorer_textBox.Text.Trim() == string.Empty)
         {
         }
         else
         {
             sql_explore += string.Format("\'{0}\'", explorer_textBox.Text);
         }
         sql_explore += " group by Clients.ID_Client,Clients.Surname,Clients.Name,Clients.Patronymic order by sum(Services.The_cost + Rooms.The_cost)";
         Query_output Query = new Query_output();
         Query.Output(sql_explore, db, table);
     }
 }
Esempio n. 5
0
        public Staff()
        {
            InitializeComponent();
            login_object_input.Text  = "Логин:" + buffer.login;
            login_object_output.Text = "Логин:" + buffer.login;
            login_object_сhange.Text = "Логин:" + buffer.login;
            login_role_input.Text    = buffer.Role;
            login_role_output.Text   = buffer.Role;
            login_role_change.Text   = buffer.Role;
            Data_entry.Visibility    = Visibility.Hidden;
            Data_output.Visibility   = Visibility.Hidden;
            Data_editing.Visibility  = Visibility.Hidden;
            Connect transition = new Connect();

            transition.Check(db, Data_entry, Data_output, Data_editing);
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);

            Connect conn = new Connect();

            conn.connection();
            SqlCommand    command = new SqlCommand("select ID_Position,Job_title from dbo.Positionen", Connect.cnn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                string       ID_Position = reader["ID_Position"].ToString();
                string       Job_title   = reader["Job_title"].ToString();
                ComboBoxItem box_item    = new ComboBoxItem();
                box_item.Content = ID_Position + " - " + Job_title;
                help.Items.Add(box_item);
            }
            conn.disconnection();
        }
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string       db    = "staff";
            string       sql   = "EXEC sp_helprotect Null,Null;";
            Query_output Query = new Query_output();

            Query.Output(sql, db, table);
        }
Esempio n. 7
0
        public Main_Client()
        {
            InitializeComponent();
            login_object.Text = "Логин:" + buffer.login;
            Query_output Query = new Query_output();

            Query.Output(sql_query_rooms, db_rooms, table_rooms);
            Query.Output(sql_query_services, db_services, table_services);
        }
        public personnel_department()
        {
            InitializeComponent();
            login_role.Text          = buffer.Role;
            login_object_output.Text = "Логин:" + buffer.login;
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
        }
Esempio n. 9
0
        public Rooms()
        {
            InitializeComponent();
            login_object_input.Text  = "Логин:" + buffer.login;
            login_object_output.Text = "Логин:" + buffer.login;
            login_object_сhange.Text = "Логин:" + buffer.login;
            login_role_input.Text    = buffer.Role;
            login_role_output.Text   = buffer.Role;
            login_role_change.Text   = buffer.Role;
            Data_entry.Visibility    = Visibility.Hidden;
            Data_output.Visibility   = Visibility.Hidden;
            Data_editing.Visibility  = Visibility.Hidden;
            Connect transition = new Connect();

            transition.Check(db, Data_entry, Data_output, Data_editing);
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
            Connect conn = new Connect();

            conn.connection();
            SqlCommand    command = new SqlCommand("EXEC sp_helpuser '" + buffer.login + "'", Connect.cnn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                string sql = null;
                sql = reader["RoleName"].ToString();
                if (sql == "RP_Manager")
                {
                    Delet.Visibility        = Visibility.Hidden;
                    Delet_Button.Visibility = Visibility.Hidden;
                    Delet_label.Visibility  = Visibility.Hidden;
                    table.Margin            = new Thickness(10, 136, 0, 0);
                }
            }

            conn.connection();
            command = new SqlCommand("select ID_Employee,Surname,Name,Patronymic,Job_title FROM Staff INNER JOIN " +
                                     "Positionen ON Staff.ID_Position = Positionen.ID_Position", Connect.cnn);
            reader = command.ExecuteReader();
            while (reader.Read())
            {
                string       ID_Employee = reader["ID_Employee"].ToString();
                string       Surname     = reader["Surname"].ToString();
                string       Name        = reader["Name"].ToString();
                string       Patronymic  = reader["Patronymic"].ToString();
                string       Job_title   = reader["Job_title"].ToString();
                ComboBoxItem box_item    = new ComboBoxItem();
                box_item.Content = ID_Employee + " - " + Job_title + " " + Surname + " " + Name + " " + Patronymic;
                ID_EMP.Items.Add(box_item);
            }
            conn.disconnection();
        }
Esempio n. 10
0
 public void explorer_Query_Fil(string sql, string sql_query, string[] array, CheckBox[] array_check, string[] query_output_name, string[] array_ru_name, string[] explore, ComboBox explorer_box, TextBox explorer_textBox, string db, DataGrid table, string sql_fil_end)
 {
     if (explorer_textBox.Text == string.Empty)
     {
         MessageBox.Show("Поле поиска пустое", "Уведомление");
     }
     else if (explorer_box.ItemsSource == new TextBlock())
     {
         MessageBox.Show("Поле поиска пустое", "Уведомление");
     }
     else
     {
         for (int i = 0; i < array_check.Length; i++)
         {
             if (array_check[i].IsChecked == true)
             {
                 Array.Resize(ref array, array.Length + 1);
                 array[array.Length - 1] = query_output_name[i] + array_ru_name[i] + ",";
             }
         }
         for (int i = 0; i < array.Length; i++)
         {
             sql += array[i];
         }
         if (sql.EndsWith(","))
         {
             sql  = sql.Remove(sql.Length - 1);
             sql += sql_fil_end;
         }
         else
         {
             sql = sql_query;
         }
         for (int i = 0; i < explore.Length; i++)
         {
             if (explorer_box.Text == explore[i])
             {
                 sql += " WHERE " + query_output_name[i] + " LIKE ";
             }
         }
         if (explorer_textBox.Text.Trim() == string.Empty)
         {
         }
         else
         {
             sql += string.Format("\'{0}\'", "%" + explorer_textBox.Text + "%") + ";";
         }
         explorer_textBox.Clear();
         Query_output Query = new Query_output();
         Query.Output(sql, db, table);
     }
 }
Esempio n. 11
0
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            string sql_services = "Select Name as [Наименование], Description as [Описание], The_cost as [Стоимость] from dbo." + db_services;
            string sql_rooms    = "select Name as [Наименование номера],Capacity as [Вместимость номера],Description as [Описание номера],The_cost as [Стоимость номера] from dbo." + db_rooms;

            string[] explore_services = new string[] { "Наименование сервиса", "Описание сервиса", "Стоимость сервиса", "" };
            string[] explore_rooms    = new string[] { "Наименование номера", "Вместимость номера", "Описание номера", "Стоимость номера" };
            if (explorer_textBox.Text == string.Empty)
            {
                MessageBox.Show("Поле поиска пустое", "Уведомление");
            }
            else
            {
                for (int i = 0; i < explore_rooms.Length; i++)
                {
                    if (explorer_box.Text == explore_services[i])
                    {
                        sql_services += " WHERE " + query_output_services_name[i] + " LIKE ";
                    }
                    if (explorer_box.Text == explore_rooms[i])
                    {
                        sql_rooms += " WHERE " + query_output_rooms_name[i] + " LIKE ";
                    }
                }
                sql_services += string.Format("\'{0}\'", "%" + explorer_textBox.Text + "%") + ";";
                sql_rooms    += string.Format("\'{0}\'", "%" + explorer_textBox.Text + "%") + ";";
                for (int i = 0; i < explore_rooms.Length; i++)
                {
                    if (explorer_box.Text == explore_services[i])
                    {
                        explorer_textBox.Clear();
                        Query_output Query = new Query_output();
                        Query.Output(sql_services, db_services, table_services);
                    }
                    if (explorer_box.Text == explore_rooms[i])
                    {
                        explorer_textBox.Clear();
                        Query_output Query = new Query_output();
                        Query.Output(sql_rooms, db_rooms, table_rooms);
                    }
                }
            }
        }
Esempio n. 12
0
        public Positionen()
        {
            InitializeComponent();
            login_object_input.Text  = "Логин:" + buffer.login;
            login_object_output.Text = "Логин:" + buffer.login;
            login_object_сhange.Text = "Логин:" + buffer.login;
            login_role_input.Text    = buffer.Role;
            login_role_output.Text   = buffer.Role;
            login_role_change.Text   = buffer.Role;
            Data_entry.Visibility    = Visibility.Hidden;
            Data_output.Visibility   = Visibility.Hidden;
            Data_editing.Visibility  = Visibility.Hidden;
            Connect transition = new Connect();

            transition.Check(db, Data_entry, Data_output, Data_editing);
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
        }
Esempio n. 13
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            if (login_check.Text == string.Empty)
            {
                MessageBox.Show("Введите логин", "Уведомление");
            }
            else
            {
                string  db    = "staff";
                string  sql   = "EXEC sp_helprotect Null,Null";
                bool    check = false;
                Connect conn  = new Connect();
                conn.connection();
                SqlCommand command = new SqlCommand(sql, Connect.cnn);;

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    if (reader.GetValue(2).ToString() == login_check.Text)
                    {
                        check = true;
                        break;
                    }
                }
                conn.disconnection();
                if (check == true)
                {
                    sql = "EXEC sp_helprotect Null,'" + login_check.Text + "';";
                    Query_output Query = new Query_output();
                    Query.Output(sql, db, table);
                    login_check.Clear();
                }
                else
                {
                    MessageBox.Show("Профиль не существует", "Уведомление");
                }
            }
        }
Esempio n. 14
0
        public void Filter(string[] array, CheckBox[] array_check, string[] query_output_name, string[] array_ru_name, DataGrid table, string sql_query, string db)
        {
            Query_output Query = new Query_output();

            for (int i = 0; i < array_check.Length; i++)
            {
                if (array_check[i].IsChecked == true)
                {
                    Array.Resize(ref array, array.Length + 1);
                    array[array.Length - 1] = query_output_name[i] + array_ru_name[i];
                }
            }
            if (array.Length != 0)
            {
                string sql = "select ";
                for (int i = 0; i < array.Length; i++)
                {
                    if (array.Length > 1)
                    {
                        sql += array[i] + ",";
                    }
                    else
                    {
                        sql += array[i];
                    }
                }
                if (sql.EndsWith(","))
                {
                    sql = sql.Remove(sql.Length - 1);
                }
                sql += " from dbo." + db;
                Query.Output(sql, db, table);
            }
            else
            {
                Query.Output(sql_query, db, table);
            }
        }
Esempio n. 15
0
        public Services()
        {
            InitializeComponent();
            login_object_input.Text  = "Логин:" + buffer.login;
            login_object_output.Text = "Логин:" + buffer.login;
            login_object_сhange.Text = "Логин:" + buffer.login;
            login_role_input.Text    = buffer.Role;
            login_role_output.Text   = buffer.Role;
            login_role_change.Text   = buffer.Role;
            Data_entry.Visibility    = Visibility.Hidden;
            Data_output.Visibility   = Visibility.Hidden;
            Data_editing.Visibility  = Visibility.Hidden;
            Connect transition = new Connect();

            transition.Check(db, Data_entry, Data_output, Data_editing);
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
            Connect conn = new Connect();

            conn.connection();
            SqlCommand    command = new SqlCommand("EXEC sp_helpuser '" + buffer.login + "'", Connect.cnn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                string sql = null;
                sql = reader["RoleName"].ToString();
                if (sql == "RP_Manager")
                {
                    Delet.Visibility        = Visibility.Hidden;
                    Delet_Button.Visibility = Visibility.Hidden;
                    Delet_label.Visibility  = Visibility.Hidden;
                    table.Margin            = new Thickness(10, 136, 0, 0);
                }
            }
        }
Esempio n. 16
0
        public Services_provided_to_the_client()
        {
            InitializeComponent();
            login_object_input.Text  = "Логин:" + buffer.login;
            login_object_output.Text = "Логин:" + buffer.login;
            login_object_сhange.Text = "Логин:" + buffer.login;
            login_role_input.Text    = buffer.Role;
            login_role_output.Text   = buffer.Role;
            login_role_change.Text   = buffer.Role;
            Data_entry.Visibility    = Visibility.Hidden;
            Data_output.Visibility   = Visibility.Hidden;
            Data_editing.Visibility  = Visibility.Hidden;
            Connect transition = new Connect();

            transition.Check(db, Data_entry, Data_output, Data_editing);
            Query_output Query = new Query_output();

            Query.Output(sql_query, db, table);
            Connect conn = new Connect();

            conn.connection();
            SqlCommand    command = new SqlCommand("EXEC sp_helpuser '" + buffer.login + "'", Connect.cnn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                string sql = null;
                sql = reader["RoleName"].ToString();
                if (sql == "ST_Manager")
                {
                    Delet.Visibility        = Visibility.Hidden;
                    Delet_Button.Visibility = Visibility.Hidden;
                    Delet_label.Visibility  = Visibility.Hidden;
                    table.Margin            = new Thickness(10, 136, 0, 0);
                }
            }
            conn.connection();
            command = new SqlCommand("select ID_Client,Surname,Name,Patronymic from dbo.Clients", Connect.cnn);
            reader  = command.ExecuteReader();
            while (reader.Read())
            {
                string       ID_Client  = reader["ID_Client"].ToString();
                string       Surname    = reader["Surname"].ToString();
                string       Name       = reader["Name"].ToString();
                string       Patronymic = reader["Patronymic"].ToString();
                ComboBoxItem box_item   = new ComboBoxItem();
                box_item.Content = ID_Client + " - " + Surname + " " + Name + " " + Patronymic;
                ID_Cli.Items.Add(box_item);
            }
            conn.disconnection();
            conn.connection();
            command = new SqlCommand("select ID_Services,Name,Description,The_cost from dbo.Services;", Connect.cnn);
            reader  = command.ExecuteReader();
            while (reader.Read())
            {
                string       ID_Services = reader["ID_Services"].ToString();
                string       Name        = reader["Name"].ToString();
                string       Description = reader["Description"].ToString();
                string       The_cost    = reader["The_cost"].ToString();
                ComboBoxItem box_item    = new ComboBoxItem();
                box_item.Content = ID_Services + " - Наименование:" + Name + " Описание:" + Description + " Цена:" + The_cost;
                ID_Ser.Items.Add(box_item);
            }
            conn.disconnection();
        }
Esempio n. 17
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string sql_query = SQL.Text;
            string db        = "";
            string dbo       = "";

            string[] exp      = sql_query.ToLower().Split(' ');
            string[] array_db = new string[] { "Staff", "Positionen", "Client", "Rooms", "Services", "Services provided to the client",
                                               "staff", "positionen", "client", "rooms", "services", "services provided to the client" };
            string[] array_dbo = new string[] { "dbo.[Staff]", "dbo.[Positionen]", "dbo.[Client]", "dbo.[Rooms]", "dbo.[Services]", "dbo.[Services provided to the client]",
                                                "dbo.[staff]", "dbo.[positionen]", "dbo.[client]", "dbo.[rooms]", "dbo.[services]", "dbo.[services provided to the client]" };
            for (int i = 0; i < array_db.Length; i++)
            {
                if (sql_query.Contains(array_db[i]))
                {
                    db += array_db[i];
                }
                if (sql_query.Contains(array_dbo[i]))
                {
                    dbo += array_db[i];
                }
            }
            foreach (string i in exp)
            {
                if (i == "GRANT SELECT")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "select")
                {
                    sql_query = SQL.Text;
                    Query_output Query = new Query_output();
                    Query.Output(sql_query, db, table);
                    break;
                }
                if (i == "select*from")
                {
                    sql_query = SQL.Text;
                    Query_output Query = new Query_output();
                    Query.Output(sql_query, db, table);
                    break;
                }
                if (i == "alter")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "insert")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "drop")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "update")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "delete")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "exec")
                {
                    sql_query = SQL.Text;
                    Query_output Query = new Query_output();
                    Query.Output(sql_query, db, table);
                    break;
                }
                if (i == "create")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                if (i == "execute")
                {
                    sql_query = SQL.Text;
                    Query_input Query = new Query_input();
                    Query.input(sql_query);
                    break;
                }
                else
                {
                    MessageBox.Show("Запрос задан не верно или данная команда не используется в интерфейсе", "Уведомление");
                    break;
                }
            }
        }