Ejemplo n.º 1
0
        private void backupDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveDb = new SaveFileDialog();
            string         path   = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "{374DE290-123F-4565-9164-39C4925E467B}", String.Empty).ToString();
            dbGc           db     = new dbGc();

            try
            {
                saveDb.Filter           = "bak files (*.bak)|*.bak|All files (*.*)|*.*";
                saveDb.InitialDirectory = path;
                saveDb.RestoreDirectory = true;
                saveDb.DefaultExt       = "bak";
                if (saveDb.ShowDialog() == DialogResult.OK)
                {
                    db.backupDb(saveDb.FileName);
                    notification notification = new notification("Database backup completed.", notification.AlertType.success);
                    notification.ShowDialog();
                }
            }
            catch (Exception a)
            {
                notification notification = new notification("Database backup error.", notification.AlertType.error);
                notification.ShowDialog();
                return;
            }
        }
Ejemplo n.º 2
0
        private void Inventory_Main_Load(object sender, EventArgs e)
        {
            footerLastCode.ForeColor = Color.DarkBlue;

            dbGc          db    = new dbGc();
            StringBuilder param = new StringBuilder();

            param.Append("gc_item_code");
            DataTable dt = db.GCSelectFromDb("products", param, null, " ORDER BY id ASC");

            foreach (DataRow row in dt.Rows)
            {
                footerLastCode.Text = "Last item ID : " + row[0].ToString();
            }

            prodPage.btnSave.Click += BtnSave_Click;
        }