示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (NewLocation.Text == "")
            {
                MessageBox.Show(" Enter a Location and Countinue");
            }
            else
            {
                string sql = "INSERT INTO `location` (`location`) VALUES ('" + NewLocation.Text + "')";
                cmd = new MySqlCommand(sql, con);
                try
                {
                    con.Open();
                    cmd.ExecuteNonQuery();


                    MessageBox.Show("Successfully Location Added");
                    this.Close();
                    StockManagement s = new StockManagement();
                    s.Show();
                }
                catch (Exception except)
                { MessageBox.Show(except.Message); }

                //reload the combo box
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            StockManagement f1 = new StockManagement();

            f1.Show();
        }
示例#3
0
        private void StockManagement_Click(object sender, EventArgs e)
        {
            if (isConfigurationFileLocked)
            {
                int screenWidth  = Screen.FromControl(this).WorkingArea.Width;
                int screenHeigth = Screen.FromControl(this).WorkingArea.Height;

                stockManagementMenu = new StockManagement
                {
                    // User defined variables
                    DoesConfigurationFileExist = doesConfigurationFileExists,
                    IsConfigurationFileLocked  = isConfigurationFileLocked,
                    CurrentLanguage            = (StockManagement.Languages)CurrentLanguagePublic,
                    FileLogging = fileLogging,
                    Xdoc        = xdoc,
                    //Localisation = localisation,

                    // Program defined variables
                    Height        = (screenHeigth / 10) * 9,
                    Location      = Screen.FromControl(this).Bounds.Location,
                    StartPosition = FormStartPosition.CenterScreen,
                    Width         = (screenWidth / 10) * 9
                };

                // Initialize the file watcher to track the current-user file
                stockManagementMenu.FileLockNotificationPublic                     = new FileSystemWatcher();
                stockManagementMenu.FileLockNotificationPublic.Path                = CoreFunctions.GetExecutingDirectoryName() + "config";
                stockManagementMenu.FileLockNotificationPublic.Filter              = Path.GetFileName(applicationConfigurationFile);
                stockManagementMenu.FileLockNotificationPublic.NotifyFilter        = NotifyFilters.LastWrite;
                stockManagementMenu.FileLockNotificationPublic.Changed            += new FileSystemEventHandler(stockManagementMenu.FileLockNotification_Changed);
                stockManagementMenu.FileLockNotificationPublic.EnableRaisingEvents = true;

                // Close the file watcher of this class
                FileLockNotification.EnableRaisingEvents = false;
                FileLockNotification = null;

                hasProgrammeLoaded = true;

                if (settingsMenu != null)
                {
                    settingsMenu = null;
                }

                stockManagementMenu.Show();

                this.Close();
            }
            else
            {
                // TODO: Clear
                //CustomMessageBox.Show("Das Programm wird gerade von " + currentUser + " benutzt.\nSie werden benachrichtigt, sobald das Programm wieder verfügbar ist.", "Programmverwendung", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                //return;

                XElement xmlElements = xdoc.Element("ConfigFile").Element("ApplicationSettings").Element("DataReferences");

                if (File.Exists(xmlElements.Element("CustomerFile").Value))
                {
                    int screenWidth  = Screen.FromControl(this).WorkingArea.Width;
                    int screenHeigth = Screen.FromControl(this).WorkingArea.Height;

                    stockManagementMenu = new StockManagement
                    {
                        // User defined variables
                        DoesConfigurationFileExist = doesConfigurationFileExists,
                        IsConfigurationFileLocked  = isConfigurationFileLocked,
                        ConfugurationFileLocking   = confugurationFileLocking,
                        CurrentLanguage            = (StockManagement.Languages)CurrentLanguagePublic,
                        FileLogging = fileLogging,
                        Xdoc        = xdoc,
                        //Localisation = localisation,

                        // Program defined variables
                        Height        = (screenHeigth / 10) * 9,
                        Location      = Screen.FromControl(this).Bounds.Location,
                        StartPosition = FormStartPosition.CenterScreen,
                        Width         = (screenWidth / 10) * 9
                    };

                    hasProgrammeLoaded = true;
                    if (settingsMenu != null)
                    {
                        settingsMenu = null;
                    }

                    stockManagementMenu.Show();

                    this.Close();
                }
                else
                {
                    // TODO: Localisize this
                    CustomMessageBox.Show("Der Pfad der Quelldatei ist nicht korrekt gesetzt, setzen Sie den korrekten Pfad", "Quelldatei Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);

                    if (settingsMenu == null)
                    {
                        settingsMenu = new Settings
                        {
                            ConfigurationFileExists  = doesConfigurationFileExists,
                            ConfugurationFileLocking = confugurationFileLocking,
                            MainMenuPublic           = this,
                            //Localisation = localisation,

                            Owner         = this,
                            StartPosition = FormStartPosition.CenterParent,
                            Visible       = true
                        };

                        this.Visible = false;
                    }
                    else if (!settingsMenu.Visible)
                    {
                        //int screenWidth = Screen.FromControl(this).WorkingArea.Width;
                        //int screenHeigth = Screen.FromControl(this).WorkingArea.Height;

                        settingsMenu.Owner         = this;
                        settingsMenu.StartPosition = FormStartPosition.CenterScreen;
                        settingsMenu.Visible       = true;

                        this.Visible = true;
                    }
                }
            }
        }