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("Заказ совершен!");
        }
Example #2
0
 private void CurrentOrdersForm_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";
         FillService(admin);
         excel.OpenDocument(path);
         excel.WriteCurrentOrders(admin.services);
         excel.CloseDocument();
     }
 }