示例#1
0
 private void CurrentOrdersForm_Load(object sender, EventArgs e)
 {
     if ((user.GetType() == typeof(Client)))
     {
         col_customer.Visible = false;
         ms_delete.Visible    = false;
         Client client = (Client)user;
         for (int i = 0; i < client.services.Count; i++)
         {
             if (client.FullName == client.services[i].customer)
             {
                 dgv_service.Rows.Add(client.services[i].service, client.services[i].price, client.services[i].priceForVIP, client.services[i].leadTime, client.services[i].status, client.services[i].customer);
             }
         }
     }
     else
     {
         col_status.ReadOnly      = false;
         col_price.ReadOnly       = false;
         col_priceForVIP.ReadOnly = false;
         col_order.ReadOnly       = false;
         col_leadTime.ReadOnly    = false;
         col_customer.ReadOnly    = false;
         Administration admin = (Administration)user;
         ExcelService   excel = new ExcelService();
         string         path  = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls";
         excel.OpenDocument(path);
         excel.ReadCurrentOrders(admin);
         excel.CloseDocument();
         for (int i = 0; i < admin.services.Count; i++)
         {
             dgv_service.Rows.Add(admin.services[i].service, admin.services[i].price, admin.services[i].priceForVIP, admin.services[i].leadTime, admin.services[i].status, admin.services[i].customer);
         }
     }
 }
        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 BaseClientsForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ExcelService excel = new ExcelService();
            string       path  = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls";

            excel.OpenDocument(path);

            FillClientList();
            excel.WriteDataAllUsers(client);
            excel.CloseDocument();
        }
        private void BaseClientsForm_Load(object sender, EventArgs e)
        {
            ExcelService excel = new ExcelService();
            string       path  = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls";

            excel.OpenDocument(path);
            client = excel.ReadDataUser();
            excel.CloseDocument();

            FillDataGridView();
        }
示例#6
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();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            Administration admin = new Administration();

            admin.Login       = tb_login.Text;
            admin.Password    = tb_password.Text;
            admin.FullName    = tb_fullName.Text;
            admin.YearOfBirth = tb_yearOfBirth.Text;
            admin.Position    = tb_position.Text;
            admin.Salary      = tb_salary.Text;

            ExcelService excel = new ExcelService();
            string       path  = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls";

            excel.OpenDocument(path);
            excel.WriteDataAdministration(admin);
            excel.CloseDocument();

            this.Close();
        }
示例#8
0
        private void modeForm(User user)
        {
            if (user.GetType() == typeof(Client))
            {
                this.user               = (Client)user;
                bt_сlientBase.Visible   = false;
                bt_registration.Visible = false;
                lb_fullName.Text        = "Приветствуем вас, " + user.FullName;

                Client       client = (Client)this.user;
                ExcelService excel  = new ExcelService();
                string       path   = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls";
                excel.OpenDocument(path);
                excel.ReadCurrentOrders(user);
                excel.CloseDocument();
            }
            else
            {
                this.user        = (Administration)user;
                lb_fullName.Text = "Приветствуем вас, " + user.FullName;
            }
        }
        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();
                }
            }
        }