Exemplo n.º 1
0
 public ViewItemsControl(PasswordPopup popup)
 {
     InitializeComponent();
     AdminControl.Content = new DashboardControl();
     popup.Close();
 }
        private void adminScreenButtonEvent(Object Sender, RoutedEventArgs e)
        {
            PasswordPopup popup = new PasswordPopup(MainWindowControl);

            popup.ShowDialog();
        }
Exemplo n.º 3
0
        public static void mcdModificationCheck()
        {
            if (Directory.Exists(LoadProject.projectFolder + "\\src\\dao"))
            {
                if (checkMCDcoherence() == false)
                {
                    //DAO are deleted
                    Directory.Delete(LoadProject.projectFolder + "\\src\\dao", true);
                    File.Delete(LoadProject.projectFolder + "\\src\\hibernate.cfg.xml");
                    File.Delete(LoadProject.projectFolder + "\\src\\hibernate.reveng.xml");

                    //asks for MySQL root password then drops the existing database and recreates it with the new script
                    PasswordPopup pwp = new PasswordPopup(true);
                    pwp.Show();
                }
            }
        }
Exemplo n.º 4
0
 private static void createProjectDatabase()
 {
     //if the sql script exist, we generate the database
     if (File.Exists(LoadProject.projectFolder + "\\mcd.sql"))
     {
         //asks for MySQL root password and calls createProjectDatabaseAux
         PasswordPopup pwp = new PasswordPopup(false);
         pwp.Show();
     }
     else
         System.Windows.Forms.MessageBox.Show("Le script 'mcd.sql' n'a pas été trouvé, la base de données n'a pas pu être générée");
 }
Exemplo n.º 5
0
        private void keyEventHandler(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.F2:
                Invoice     invoice;
                MongoClient dbClient = new MongoClient("mongodb://*****:*****@127.0.0.1:27017?authSource=tutorial&readPreference=primary&appname=MongoDB%20Compass&ssl=false");
                try
                {
                    if (App.currentInvoice != null)
                    {
                        invoice = App.currentInvoice;
                    }
                    else
                    {
                        invoice = new Invoice()
                        {
                            Date = DateTime.Now.ToString("dd/M/yyyy")
                        };
                        App.currentInvoice = invoice;
                    }
                    MainWindowControl.Content = new BillingControl(invoice, MainWindowControl, false);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                MainWindowControl.Content = new BillingControl(App.currentInvoice, MainWindowControl, false);
                break;

            case Key.F3:
                MainWindowControl.Content = new InvoiceControl(MainWindowControl);
                break;

            case Key.F4:
                PasswordPopup popup = new PasswordPopup(MainWindowControl);
                popup.ShowDialog();
                break;

            case Key.Escape:
                if (MainWindowControl.Content is BillingControl)
                {
                    BillingControl billingControl = MainWindowControl.Content as BillingControl;
                    bool           result         = billingControl.exitBilling();
                    if (result)
                    {
                        MainWindowControl.Content = new HomeControl(MainWindowControl);
                    }
                }
                else
                {
                    MainWindowControl.Content = new HomeControl(MainWindowControl);
                }
                break;

            case Key.Insert:
                if (MainWindowControl.Content is ViewItemsControl)
                {
                    Product product = new Product()
                    {
                        Barcode      = "",
                        Name         = "",
                        SellingPrice = "",
                        Cost         = "",
                        MRP          = "",
                        stock        = 0,
                    };
                    ViewItemsControl control = MainWindowControl.Content as ViewItemsControl;
                    control.AdminControl.Content = new AddItemsControl(product);
                }
                break;
            }
        }