public Otdely(MySqlOperations mySqlOperations, MySqlQueries mySqlQueries, string iD) { InitializeComponent(); MySqlOperations = mySqlOperations; MySqlQueries = mySqlQueries; ID = iD; }
public Sotrudniki(MySqlOperations mySqlOperations, MySqlQueries mySqlQueries, string iD) { InitializeComponent(); MySqlOperations = mySqlOperations; MySqlQueries = mySqlQueries; ID = iD; MySqlOperations.Select_ComboBox(MySqlQueries.Select_Otdely_ComboBox, comboBox1); }
public Othody(MySqlOperations mySqlOperations, MySqlQueries mySqlQueries, string iD) { InitializeComponent(); MySqlOperations = mySqlOperations; MySqlQueries = mySqlQueries; ID = iD; comboBox1.SelectedItem = comboBox1.Items[0]; comboBox2.SelectedItem = comboBox2.Items[0]; }
public User_Main(string iD) { InitializeComponent(); MySqlQueries = new MySqlQueries(); MySqlOperations = new MySqlOperations(MySqlQueries); ID = iD; MySqlOperations.Select_DataGridView(MySqlQueries.Select_Kartochka_Otdela, dataGridView1, ID); identify = "kartochka"; }
public Kartochka(MySqlQueries mySqlQueries, MySqlOperations mySqlOperations, string iD) { InitializeComponent(); MySqlQueries = mySqlQueries; MySqlOperations = mySqlOperations; ID = iD; MySqlOperations.Select_ComboBox(MySqlQueries.Select_Otdely_ComboBox, comboBox1); MySqlOperations.Select_ComboBox(MySqlQueries.Select_Othody_ComboBox, comboBox2); }
public Ubytiya(MySqlQueries mySqlQueries, MySqlOperations mySqlOperations, string iD) { InitializeComponent(); MySqlQueries = mySqlQueries; MySqlOperations = mySqlOperations; ID = iD; MySqlOperations.Select_ComboBox(MySqlQueries.Select_Organizacii_ComboBox, comboBox1); string output = string.Empty; MySqlOperations.Select_Text(MySqlQueries.Select_Sum_Pribytiya, ref output, ID); textBox1.Text = output; }
public void Print_Vedomost(MySqlQueries mySqlQueries, SaveFileDialog saveFileDialog, DataGridView dataGridView, string ID = null) { ExcelApplication ExcelApp = null; Workbooks workbooks = null; Workbook workbook = null; string output = null; string fileName = null; Select_DataGridView(mySqlQueries.Select_Kartochka_Vedomost, dataGridView, ID); Select_Text(mySqlQueries.Select_Otdely_ComboBox_by_ID, ref output, ID); saveFileDialog.Title = "Сохранить ведомость как"; saveFileDialog.FileName = "Ведомость отходов " + output; saveFileDialog.InitialDirectory = Application.StartupPath + "\\Отчеты\\"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog.FileName; try { ExcelApp = new ExcelApplication(); workbooks = ExcelApp.Workbooks; workbook = workbooks.Open(Application.StartupPath + "\\Blanks\\Vedomost.xlsx"); int ExCol = 1; int ExRow = 9; for (int i = 0; i < dataGridView.Rows.Count - 1; i++) { for (int j = 0; j < dataGridView.Columns.Count; j++) { ExcelApp.Cells[ExRow, ExCol] = dataGridView.Rows[i].Cells[j].Value.ToString(); ExCol++; } ExCol = 1; ExRow++; } workbook.SaveAs(fileName); ExcelApp.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(workbooks); Marshal.ReleaseComObject(ExcelApp); } } }
//Универсальные методы //Методы печати public void Print_Passport(MySqlQueries mySqlQueries, SaveFileDialog saveFileDialog, string ID = null) { ExcelApplication ExcelApp = null; Workbooks workbooks = null; Workbook workbook = null; string output = null; string fileName = null; Select_Text(mySqlQueries.Select_Kartochka_Passport, ref output, ID); saveFileDialog.Title = "Сохранить сопроводительный паспорт как"; saveFileDialog.FileName = "Сопроводительный паспорт за " + output.Split(';')[0] + " (" + output.Split(';')[1] + ')'; saveFileDialog.InitialDirectory = Application.StartupPath + "\\Отчеты\\"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog.FileName; try { ExcelApp = new ExcelApplication(); workbooks = ExcelApp.Workbooks; workbook = workbooks.Open(Application.StartupPath + "\\Blanks\\Passport.xlsx"); ExcelApp.Cells[15, 4] = ID; ExcelApp.Cells[15, 6] = output.Split(';')[0]; ExcelApp.Cells[21, 10] = output.Split(';')[2]; ExcelApp.Cells[24, 6] = output.Split(';')[3]; workbook.SaveAs(fileName); ExcelApp.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(workbooks); Marshal.ReleaseComObject(ExcelApp); } } }
public MySqlOperations(MySqlQueries sqlQueries) { this.MySqlQueries = sqlQueries; }
public Avtorizacia() { InitializeComponent(); MySqlQueries = new MySqlQueries(); MySqlOperations = new MySqlOperations(MySqlQueries); }
public Main() { InitializeComponent(); MySqlQueries = new MySqlQueries(); MySqlOperations = new MySqlOperations(MySqlQueries); }