Exemplo n.º 1
0
        private void FormBackupDatabase_Load(object sender, EventArgs e)
        {
            Inventori.Module.ModuleControlSettings.SaveLog(ListOfAction.Open, string.Empty, ListOfTable.Database, lbl_UserName.Text);
            oScript.ConnectDatabaseWithRefresh(pServer, pDatabase, pUserName, pPassword);

            if (lbl_Auto.Text == true.ToString())
            {
                this.Size            = new Size(this.Size.Width, 145);
                this.Text            = "Otomatisasi Backup Database";
                panel1.Visible       = false;
                pb_Loading.Location  = new Point(pb_Loading.Location.X, 7);
                lbl_Loading.Location = new Point(lbl_Loading.Location.X, 30);
                this.Refresh();

                System.Threading.Thread.Sleep(5000);
                btn_Backup_Click(null, null);
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void btn_BackupFile_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = "";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                txt_BackupFile.Text = openFileDialog1.FileName;
            }

            if (!string.IsNullOrEmpty(txt_BackupFile.Text.Trim()))
            {
                clsZip.UnzipIT(txt_BackupFile.Text, txt_BackupDir.Text);

                oScript.ConnectDatabaseWithRefresh(pServer, pDatabase, pUserName, pPassword);
                DataSet DS = new DataSet();
                DS.ReadXml(txt_BackupDir.Text + "SQLScripts.xml");

                if (DS.Tables.Count > 0)
                {
                    DataTable dt = DS.Tables[0];
                    dt.DefaultView.RowFilter = "ObjectType='table'";
                    Get_Objects(ref dt, ref grid_Tables, "TableName");
                }
            }
        }