private void Button_Click(object sender, RoutedEventArgs e) { try { if (txt_name.Text.Trim() != "" && cbx_owner.SelectedItem != null && txt_phone.Text.Trim() != "" && dp_date.SelectedDate != null && txt_number.Text.Trim() != "") { if (howform) { WorkSQL.sql_p = "select add_company('" + txt_name.Text.Trim() + "','" + cbx_owner.SelectedItem + "','" + txt_phone.Text.Trim() + "','" + ((DateTime)dp_date.SelectedDate).ToString("dd-MM-yyyy") + "','" + txt_number.Text.Trim() + "');"; WorkSQL.ExecuteSQL(); } else { WorkSQL.sql_p = "select update_company('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "','" + cbx_owner.SelectedItem + "','" + txt_phone.Text.Trim() + "','" + ((DateTime)dp_date.SelectedDate).ToString("dd-MM-yyyy") + "','" + txt_number.Text.Trim() + "');"; WorkSQL.ExecuteSQL(); } this.Close(); } else { MessageBox.Show("Заполните все поля!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (cbx_employee.SelectedItem != null && cbx_department.SelectedItem != null) { if (howform) { WorkSQL.sql_p = "select add_cross('" + cbx_department.SelectedItem + "','" + cbx_employee.SelectedItem + "');"; WorkSQL.ExecuteSQL(); } else { WorkSQL.sql_p = "select update_cross('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + cbx_department.SelectedItem + "','" + cbx_employee.SelectedItem + "');"; WorkSQL.ExecuteSQL(); } this.Close(); } else { MessageBox.Show("Заполните все поля!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddCompany(bool temp) { try { InitializeComponent(); howform = temp; WorkSQL.sql_p = "select \"Форма собственности\" from show_owner_ship"; cbx_owner.ItemsSource = WorkSQL.ConvertQueryToComboBox(); if (howform) { mainwin.Title = "Добавить предприятие"; btn_add.Content = "Добавить"; } else { mainwin.Title = "Изменить предприятие"; btn_add.Content = "Изменить"; txt_name.Text = WorkSQL.drv_p.Row.ItemArray[1].ToString(); cbx_owner.SelectedItem = WorkSQL.drv_p.Row.ItemArray[2]; txt_phone.Text = WorkSQL.drv_p.Row.ItemArray[3].ToString(); dp_date.SelectedDate = (DateTime)WorkSQL.drv_p.Row.ItemArray[4]; txt_number.Text = WorkSQL.drv_p.Row.ItemArray[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddDepartment(bool temp) { try { InitializeComponent(); howform = temp; WorkSQL.sql_p = "select Название from show_title"; cbx_title.ItemsSource = WorkSQL.ConvertQueryToComboBox(); WorkSQL.sql_p = "select Тип from show_type"; cbx_type.ItemsSource = WorkSQL.ConvertQueryToComboBox(); if (howform) { mainwin.Title = "Добавить отделение"; btn_add.Content = "Добавить"; } else { mainwin.Title = "Изменить отделение"; btn_add.Content = "Изменить"; cbx_title.SelectedItem = WorkSQL.drv_p.Row.ItemArray[1]; cbx_type.SelectedItem = WorkSQL.drv_p.Row.ItemArray[2]; dp_date.SelectedDate = (DateTime)WorkSQL.drv_p.Row.ItemArray[3]; txt_phone.Text = WorkSQL.drv_p.Row.ItemArray[4].ToString(); txt_address.Text = WorkSQL.drv_p.Row.ItemArray[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddCross(bool temp) { try { InitializeComponent(); howform = temp; WorkSQL.sql_p = "select Номер from show_department"; cbx_department.ItemsSource = WorkSQL.ConvertQueryToComboBox(); WorkSQL.sql_p = "select Номер from show_employee"; cbx_employee.ItemsSource = WorkSQL.ConvertQueryToComboBox(); if (howform) { mainwin.Title = "Добавить распределение"; btn_add.Content = "Добавить"; } else { mainwin.Title = "Изменить распределение"; btn_add.Content = "Изменить"; cbx_department.Text = WorkSQL.drv_p.Row.ItemArray[1].ToString(); cbx_employee.Text = WorkSQL.drv_p.Row.ItemArray[3].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddEmployee(bool temp) { try { InitializeComponent(); howform = temp; WorkSQL.sql_p = "select Образование from show_education"; cbx_education.ItemsSource = WorkSQL.ConvertQueryToComboBox(); if (howform) { mainwin.Title = "Добавить сотрудника"; btn_add.Content = "Добавить"; } else { mainwin.Title = "Изменить сотрудника"; btn_add.Content = "Изменить"; txt_first.Text = WorkSQL.drv_p.Row.ItemArray[1].ToString(); txt_second.Text = WorkSQL.drv_p.Row.ItemArray[2].ToString(); txt_middle.Text = WorkSQL.drv_p.Row.ItemArray[3].ToString(); dp_date.SelectedDate = (DateTime)WorkSQL.drv_p.Row.ItemArray[4]; txt_position.Text = WorkSQL.drv_p.Row.ItemArray[5].ToString(); txt_salary.Text = WorkSQL.drv_p.Row.ItemArray[6].ToString(); cbx_education.SelectedItem = WorkSQL.drv_p.Row.ItemArray[7]; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (cbx_login.SelectedItem != null) { WorkSQL.sql_p = "select drop_user('" + cbx_login.SelectedItem + "')"; WorkSQL.ExecuteSQL(); this.Close(); } else { MessageBox.Show("Заполните все поля!"); } }
//private async void Window_ContentRendered(object sender, EventArgs e) //{ //} private async void Window_Loaded(object sender, RoutedEventArgs e) { //log_prog.Visibility = Visibility.Visible; if (chart) { var temp = await Task.Run(() => WorkSQL.ConvertQueryToTable().DefaultView);; ResGrid.DataContext = temp; log_prog.Visibility = Visibility.Hidden; } else { showChart(); } }
async void showChart() { ResGrid.Visibility = Visibility.Hidden; diagr.Visibility = Visibility.Visible; var temp = await Task.Run(() => WorkSQL.ConvertQueryToTable().DefaultView); List <ForChart> r = new List <ForChart>(); for (int i = 0; i < temp.Count; i++) { r.Add(new ForChart { Name = temp[i].Row.ItemArray[0].ToString() + "-" + temp[i].Row.ItemArray[2].ToString(), Share = Convert.ToInt32(temp[i].Row.ItemArray[4]) }); } diagr.DataContext = r; log_prog.Visibility = Visibility.Hidden; }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (txt_login.Text.Trim() != "" && txt_password.Text.Trim() != "") { if (temp) { if (who) { WorkSQL.sql_p = "select create_user('" + txt_login.Text.Trim().ToLower() + "','" + txt_password.Text.Trim() + "','Tax_Employee');"; WorkSQL.ExecuteSQL(); WorkSQL.sql_p = "select add_users_employee('" + txt_login.Text.Trim().ToLower() + "');"; WorkSQL.ExecuteSQL(); } else { WorkSQL.sql_p = "select create_user('" + txt_login.Text.Trim().ToLower() + "','" + txt_password.Text.Trim() + "','Tax_SuperVisor');"; WorkSQL.ExecuteSQL(); } } else { } temp = false; this.Close(); } else { MessageBox.Show("Заполните все поля!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (txt_first.Text.Trim() != "" && txt_second.Text.Trim() != "" && txt_middle.Text.Trim() != "" && dp_date.SelectedDate != null && txt_position.Text.Trim() != "" && txt_salary.Text.Trim() != "" && cbx_education.SelectedItem != null) { if (howform) { WorkSQL.sql_p = "select add_employee('" + txt_first.Text.Trim() + "','" + txt_second.Text.Trim() + "','" + txt_middle.Text.Trim() + "','" + ((DateTime)dp_date.SelectedDate).ToString("dd-MM-yyyy") + "','" + txt_position.Text.Trim() + "','" + txt_salary.Text.Trim() + "','" + cbx_education.SelectedItem + "');"; WorkSQL.ExecuteSQL(); AddUsers au = new AddUsers(true, true); au.ShowDialog(); } else { WorkSQL.sql_p = "select update_employee('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_first.Text.Trim() + "','" + txt_second.Text.Trim() + "','" + txt_middle.Text.Trim() + "','" + ((DateTime)dp_date.SelectedDate).ToString("dd-MM-yyyy") + "','" + txt_position.Text.Trim() + "','" + txt_salary.Text.Trim() + "','" + cbx_education.SelectedItem + "');"; WorkSQL.ExecuteSQL(); } this.Close(); } else { MessageBox.Show("Заполните все поля!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddPayment(bool temp) { try { InitializeComponent(); howform = temp; WorkSQL.sql_p = "select Вид from show_kind"; cbx_kind.ItemsSource = WorkSQL.ConvertQueryToComboBox(); WorkSQL.sql_p = "select Номер from show_company"; cbx_company.ItemsSource = WorkSQL.ConvertQueryToComboBox(); WorkSQL.sql_p = "select department_code from show_available('" + WorkSQL.login_p + "');"; cbx_department.ItemsSource = WorkSQL.ConvertQueryToComboBox(); if (howform) { mainwin.Title = "Добавить платёж"; btn_add.Content = "Добавить"; } else { mainwin.Title = "Изменить платёж"; btn_add.Content = "Изменить"; cbx_kind.SelectedItem = WorkSQL.drv_p.Row.ItemArray[1]; dp_date.SelectedDate = (DateTime)WorkSQL.drv_p.Row.ItemArray[2]; txt_amount.Text = WorkSQL.drv_p.Row.ItemArray[3].ToString(); cbx_company.SelectedItem = WorkSQL.drv_p.Row.ItemArray[6].ToString(); cbx_department.SelectedItem = WorkSQL.drv_p.Row.ItemArray[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public DeleteUsers() { InitializeComponent(); WorkSQL.sql_p = "select select_all_users_from_group('Tax_SuperVisor')"; cbx_login.ItemsSource = WorkSQL.ConvertQueryToComboBox(); }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (txt_name.Text.Trim() != "") { if (howform) { switch (howhelper) { case 1: WorkSQL.sql_p = "select add_education('" + txt_name.Text.Trim() + "');"; break; case 2: WorkSQL.sql_p = "select add_type('" + txt_name.Text.Trim() + "');"; break; case 3: WorkSQL.sql_p = "select add_title('" + txt_name.Text.Trim() + "');"; break; case 4: WorkSQL.sql_p = "select add_kind('" + txt_name.Text.Trim() + "');"; break; case 5: WorkSQL.sql_p = "select add_owner_ship('" + txt_name.Text.Trim() + "');"; break; } WorkSQL.ExecuteSQL(); } else { switch (howhelper) { case 1: WorkSQL.sql_p = "select update_education('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "');"; break; case 2: WorkSQL.sql_p = "select update_type('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "');"; break; case 3: WorkSQL.sql_p = "select update_title('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "');"; break; case 4: WorkSQL.sql_p = "select update_kind('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "');"; break; case 5: WorkSQL.sql_p = "select update_owner_ship('" + WorkSQL.drv_p.Row.ItemArray[0] + "','" + txt_name.Text.Trim() + "');"; break; } WorkSQL.ExecuteSQL(); } this.Close(); } else { MessageBox.Show("Заполните все поля!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }