/// <summary> /// 操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "close") { spd.jumpAdminUrl1(this.Page, 1);//跳转三级密码 BackUpSystem.SQLBack(this, Server.MapPath(ConfigurationManager.AppSettings["DBpath"].ToString() + @"\" + e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('还原成功!');", true); //绑定 SqlConnection.ClearAllPools(); } if (e.CommandName == "open") { spd.jumpAdminUrl1(this.Page, 1);//跳转三级密码 OpenFile(ConfigurationManager.AppSettings["DBpath"].ToString() + @"\" + e.CommandArgument.ToString()); } if (e.CommandName == "que") { spd.jumpAdminUrl1(this.Page, 1);//跳转三级密码 BackUpSystem.DelBackUp(this, Server.MapPath(ConfigurationManager.AppSettings["DBpath"].ToString() + @"\" + e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('删除成功!');window.location.href='DataBaseManager.aspx'", true); } }
void CheckConfig() { if (Common.Conf.LastStartedBuild < 57) { Common.Conf.LastStartedBuild = Common.DevelopersBuild; Common.Conf.Save(); BkpMsg msg = new BkpMsg(); BackUpSystem.DoBackup("Before_V57", msg); string[] dirs = Directory.GetDirectories(Common.Db.GetFoladerPath("")); foreach (string tmp in dirs) { UpdateSpectrs(tmp); } msg.Close(); } }
/// <summary> /// 绑定数据备份列表 /// </summary> private void BindData() { List <BackModel> list1 = BackUpSystem.BackList(Server.MapPath(ConfigurationManager.AppSettings["DBpath"].ToString())); DataTable ta = new DataTable(); ta.Columns.Add("id", typeof(int)); ta.Columns.Add("name", typeof(string)); ta.Columns.Add("time", typeof(string)); ta.Columns["id"].AutoIncrement = true; for (int i = 0; i < list1.Count; i++) { DataRow row = ta.NewRow(); row["name"] = list1[i].fileName; row["time"] = list1[i].CreationTime; ta.Rows.Add(row); } DataView dv = ta.DefaultView; dv.Sort = "time desc"; //AspNetPager1.RecordCount = dv.Count; System.Text.StringBuilder sb = new System.Text.StringBuilder(); PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = 0; /*AspNetPager1.CurrentPageIndex - 1*/ pds.PageSize = 0; /*AspNetPager1.PageSize*/ //this.Repeater1.DataSource = pds; //this.Repeater1.DataBind(); //if (BackUpSystem.BackList(Server.MapPath(ConfigurationManager.AppSettings["DBpath"].ToString())).Count == 0) //{ // this.tr1.Visible = true; //} //else // this.tr1.Visible = false; }
void ShowMainWindow() { Enabled = false; BkpMsg bmsg = new BkpMsg(); try { Common.Log("Check bkp."); if (chbBackupSkip.Checked) { Common.Log("Skipped by user...."); } else { BackUpSystem.DoBackupIfNeed(bmsg); } } catch (Exception ex) { Common.Log(ex); } finally { Enabled = true; bmsg.Close(); } Common.Log("Loged as '" + Common.UserRole + "'"); //MainForm mf = null; try { MF = new MainForm(); /*Process p = Process.GetCurrentProcess(); * do * { * Thread.Sleep(50); * } while (p.MainWindowHandle == null);*/ Common.SetupLogInfo(); } catch (Exception ex) { Common.Log(ex); } try { //Control.CheckForIllegalCrossThreadCalls = false; Visible = false; /*Process p = Process.GetCurrentProcess(); * do * { * Thread.Sleep(50); * } while (p.MainWindowHandle == null); * MF.ShowDialog();*/ MF.ShowDialog(); //Control.CheckForIllegalCrossThreadCalls = true; } catch (Exception ex) { Common.Log(ex); try { MF.Close(); } catch { } } try { Close(); } catch (Exception ex) { Common.Log(ex); } Common.Stop(); }
public RestoreDialog() { InitializeComponent(); lbSavedConfig.Items.AddRange(BackUpSystem.GetRecordList()); }
private static void Main() { var bm = new BackUpSystem(); bm.Notify(bm.BackUpDataBase(), bm.MoveFileToGDriveFolder()); }