Exemplo n.º 1
0
        void restoreRecoveryPoint(TblRecoveryPoint rec_RestorePoint)
        {
            var RecoveryPointLines = from rp in rec_RestorePoint.TblRecoveryPointLine select rp;

            foreach (TblRecoveryPointLine RecoveryPointLine in RecoveryPointLines)
            {
                if (RecoveryPointLine.Recoveryisfile == true) //File restore
                {
                    restorefile(RecoveryPointLine);
                }
                else //Directory restore
                {
                    DirectoryInfo rdi = new DirectoryInfo(RecoveryPointLine.Restorepath);
                    if (!rdi.Exists)
                    {
                        rdi.Create();
                        restorefile(RecoveryPointLine);
                    }
                    else
                    {
                        string movetodir = rdi.Parent.FullName + @"\" + rdi.Name + String.Format("{0:_Backup_yyyyMMddHHmmss}", DateTime.Now);
                        rdi.MoveTo(movetodir);
                        rdi = new DirectoryInfo(RecoveryPointLine.Restorepath);
                        rdi.Create();
                        restorefile(RecoveryPointLine);
                        rdi = new DirectoryInfo(movetodir);
                        rdi.Delete(true);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private TblRecoveryPoint setupRecoveryPoint()
        {
            TblRecoveryPoint rec_RceoveryPoint = new TblRecoveryPoint
            {
                Name   = m_Rid.ToString() + " " + m_RegnskabsNavn,
                Rptime = DateTime.Now
            };

            m_dbRecovery.TblRecoveryPoint.InsertOnSubmit(rec_RceoveryPoint);

            TblRecoveryPointLine rec_RecoveryPointLine = new TblRecoveryPointLine
            {
                Recoverypath   = m_PlaceringPath,
                Recoveryisfile = false
            };

            rec_RceoveryPoint.TblRecoveryPointLine.Add(rec_RecoveryPointLine);

            rec_RecoveryPointLine = new TblRecoveryPointLine
            {
                Recoverypath   = m_FraPBSPath,
                Recoveryisfile = false
            };
            rec_RceoveryPoint.TblRecoveryPointLine.Add(rec_RecoveryPointLine);

            rec_RecoveryPointLine = new TblRecoveryPointLine
            {
                Recoverypath   = m_TilPBSPath,
                Recoveryisfile = false
            };
            rec_RceoveryPoint.TblRecoveryPointLine.Add(rec_RecoveryPointLine);

            rec_RecoveryPointLine = new TblRecoveryPointLine
            {
                Recoverypath   = m_DataBasePath,
                Recoveryisfile = true
            };
            rec_RceoveryPoint.TblRecoveryPointLine.Add(rec_RecoveryPointLine);
            m_dbRecovery.SubmitChanges();
            return(rec_RceoveryPoint);
        }
Exemplo n.º 3
0
        private void createRecoveryPoint(TblRecoveryPoint rec_RceoveryPoint)
        {
            rec_RceoveryPoint.Rptime = DateTime.Now;
            var qry_Recoverypointlines = from l in rec_RceoveryPoint.TblRecoveryPointLine select l;

            foreach (TblRecoveryPointLine rpl in qry_Recoverypointlines)
            {
                if (rpl.Recoveryisfile == true)
                {
                    backupfile(rpl, rpl.Recoverypath);
                }
                else
                {
                    DirectoryInfo di = new DirectoryInfo(rpl.Recoverypath);
                    foreach (var w in di.GetFiles())
                    {
                        backupfile(rpl, w.FullName);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void createRecoveryPoint()
        {
            Program.dbData3060          = null;
            Program.karMedlemmer        = null;
            Program.memMedlemDictionary = null;
            Program.memAktivRegnskab    = null;
            Program.memPbsnetdir        = null;
            Program.karDkkonti          = null;
            Program.karFakturaer_s      = null;
            Program.karFakturastr_s     = null;
            Program.karFakturavarer_s   = null;
            Program.karKortnr           = null;
            Program.karRegnskab         = null;
            Program.karStatus           = null;
            Program.karKladde           = null;

            // unlock lock summasummarum kontoplan
            Program.filestream_to_lock_summasummarum_kontoplan.Close();
            Program.filestream_to_lock_summasummarum_kontoplan = null;

            // open recoverypoint database
            string dbRecovery3060path = m_EksportmappePath + @"dbRecovery3060.sdf";

            m_dbRecovery = new DbRecovery3060(m_EksportmappePath + @"dbRecovery3060.sdf");
            if (!File.Exists(dbRecovery3060path))
            {
                m_dbRecovery.CreateDatabase();
            }

            // create recoverypoint
            TblRecoveryPoint rec_RceoveryPoint = setupRecoveryPoint();

            createRecoveryPoint(rec_RceoveryPoint);

            // lock lock summasummarum kontoplan
            Program.filestream_to_lock_summasummarum_kontoplan = new FileStream(Program.path_to_lock_summasummarum_kontoplan, FileMode.Open, FileAccess.Read, FileShare.None);
        }
Exemplo n.º 5
0
        private TblRecoveryPoint setupRestorePoint()
        {
            TblRecoveryPoint rec_RestorePoint = (from r in m_dbRecovery.TblRecoveryPoint where r.Name == "4 PULS 3060 - 2010" select r).First();
            var RestorePointLines             = from l in rec_RestorePoint.TblRecoveryPointLine select l;

            foreach (TblRecoveryPointLine RecoveryPointLine in RestorePointLines)
            {
                switch (RecoveryPointLine.Recoverypath)
                {
                case @"C:\Documents and Settings\mha\Application Data\SummaSummarum\4":
                    RecoveryPointLine.Restorepath = @"C:\Documents and Settings\mha\Dokumenter\SummaSummarum\4";
                    break;

                case @"C:\Documents and Settings\mha\Dokumenter\Medlem3060\Databaser\SQLCompact\dbData3060.sdf":
                    RecoveryPointLine.Restorepath = @"C:\Documents and Settings\mha\Dokumenter\dbData3060XYZ.sdf";
                    break;

                default:
                    RecoveryPointLine.Restorepath = RecoveryPointLine.Recoverypath;
                    break;
                }
            }
            return(rec_RestorePoint);
        }
Exemplo n.º 6
0
 partial void DeleteTblRecoveryPoint(TblRecoveryPoint instance);
Exemplo n.º 7
0
 partial void UpdateTblRecoveryPoint(TblRecoveryPoint instance);
Exemplo n.º 8
0
 partial void InsertTblRecoveryPoint(TblRecoveryPoint instance);