Initial import
This commit is contained in:
parent
0c865416ca
commit
04804b89a9
279 changed files with 12945 additions and 0 deletions
84
yavscModel/Admin/DataAccess.cs
Normal file
84
yavscModel/Admin/DataAccess.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace yavscModel.Admin
|
||||
{
|
||||
public class DataAccess {
|
||||
private string host = "localhost";
|
||||
|
||||
[StringLength(2056)]
|
||||
public string Host {
|
||||
get {
|
||||
return host;
|
||||
}
|
||||
set {
|
||||
host = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int port = 5432;
|
||||
|
||||
public int Port {
|
||||
get {
|
||||
return port;
|
||||
}
|
||||
set {
|
||||
port = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string dbname = "yavsc";
|
||||
|
||||
public string Dbname {
|
||||
get {
|
||||
return dbname;
|
||||
}
|
||||
set {
|
||||
dbname = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string dbuser = "postgres";
|
||||
|
||||
public string Dbuser {
|
||||
get {
|
||||
return dbuser;
|
||||
}
|
||||
set {
|
||||
dbuser = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string dbpassword ;
|
||||
private string backupPrefix= "backup/global.backup";
|
||||
|
||||
public string BackupPrefix {
|
||||
get {
|
||||
return backupPrefix;
|
||||
}
|
||||
set {
|
||||
backupPrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Required(ErrorMessage ="Please, specify a password")]
|
||||
public string Password {
|
||||
get { return dbpassword; }
|
||||
set { dbpassword = value; }
|
||||
}
|
||||
|
||||
public string [] GetBackupDirs()
|
||||
{
|
||||
List<string> res = new List<string> ();
|
||||
string bkpdir = new FileInfo (backupPrefix).DirectoryName;
|
||||
DirectoryInfo bkpdiri = new DirectoryInfo(bkpdir);
|
||||
foreach (DirectoryInfo di in bkpdiri.EnumerateDirectories())
|
||||
res.Add (Path.Combine(bkpdir,di.Name));
|
||||
return res.ToArray ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
17
yavscModel/Admin/RestoreQuery.cs
Normal file
17
yavscModel/Admin/RestoreQuery.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace yavscModel.Admin
|
||||
{
|
||||
public class RestoreQuery: DataAccess
|
||||
{
|
||||
[Required]
|
||||
[StringLength(2056)]
|
||||
public string FileName { get; set ; }
|
||||
|
||||
public RestoreQuery ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue