private void Services_Load(object sender, EventArgs e) { ExcelService excel = new ExcelService(); if ((user.GetType() == typeof(Administration))) { col_services.ReadOnly = false; col_price.ReadOnly = false; col_priceForVIP.ReadOnly = false; col_leadTime.ReadOnly = false; ms_toOrder.Visible = false; } else { ms_delete.Visible = false; } string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (excel.ExcelIsPresent()) { if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } excel.ReadServiceList(service); FillDataGridView(); excel.CloseDocument(); } }
private void ms_toOrder_Click(object sender, EventArgs e) { Client client = (Client)user; client.services.Add(service[dgv_service.CurrentCell.RowIndex]); client.services[client.services.Count - 1].status = "Выполняется"; client.services[client.services.Count - 1].customer = client.FullName; ExcelService excel = new ExcelService(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (excel.ExcelIsPresent()) { if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } excel.WriteCurrentOrders(client.services); excel.CloseDocument(); } MessageBox.Show("Заказ совершен!"); }
private void bt_register_Click(object sender, EventArgs e) { if (allFieldsFull() && excel.ExcelIsPresent()) { client.Login = tb_login.Text; client.Password = tb_password.Text; client.FullName = tb_fullName.Text; client.YearOfBirth = tb_year.Text; client.CarModel = tb_modelCar.Text; client.LicensePlate = tb_licensePlate.Text; client.YearOfCarManufacture = tb_yearOfCar.Text; client.VIP = false; string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } if (!excel.ExistClient(client, tb_login.Text, tb_password.Text)) { excel.WriteDataUser(client); } else { MessageBox.Show("Пользователь с таким логином уже существует!"); this.Close(); } if (!File.Exists(path)) { excel.SaveAsDocument(path); } else { excel.SaveDocument(); } excel.CloseDocument(); } }
private void bt_ok_Click(object sender, EventArgs e) { string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (excel.ExcelIsPresent()) { if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } if (excel.ExistAdministration(admin, tb_login.Text, tb_password.Text)) { this.Hide(); excel.CloseDocument(); MainMenuForm menu = new MainMenuForm(admin); menu.ShowDialog(); this.Close(); } else if (excel.ExistClient(client, tb_login.Text, tb_password.Text)) { this.Hide(); excel.CloseDocument(); MainMenuForm menu = new MainMenuForm(client); menu.ShowDialog(); this.Close(); } else { MessageBox.Show("Пользователь с таким логином и паролем не найден!"); } } }
private void ServicesForm_FormClosing(object sender, FormClosingEventArgs e) { if ((user.GetType() == typeof(Administration))) { Administration admin = (Administration)user; ExcelService excel = new ExcelService(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (excel.ExcelIsPresent()) { if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } FillService(); excel.WriteServiceList(service); excel.CloseDocument(); } } }