added function to get creation date, and added validations.
This commit is contained in:
parent
20ac080884
commit
0c093f7184
1 changed files with 27 additions and 5 deletions
|
@ -26,7 +26,7 @@ namespace Saviour_Backup_System
|
|||
}
|
||||
|
||||
public static string getDriveName(string id) {
|
||||
string name = "";
|
||||
string name = "NONE";
|
||||
conn.Open();
|
||||
cmd.CommandText = "SELECT Name FROM Drive WHERE ID = ?;";
|
||||
cmd.Parameters.Add(new SqlCeParameter("Drive_ID", SqlDbType.NText));
|
||||
|
@ -40,19 +40,41 @@ namespace Saviour_Backup_System
|
|||
}
|
||||
|
||||
public static string getBackupDirectory(string id) {
|
||||
string directory = "";
|
||||
string directory = "NONE";
|
||||
conn.Open();
|
||||
cmd.CommandText = "SELECT Backup_Location FROM Recordset WHERE Drive_ID = ?";
|
||||
cmd.Parameters.Add(new SqlCeParameter("Drive_ID", SqlDbType.NText));
|
||||
cmd.Parameters["Drive_ID"].Value = id;
|
||||
try {
|
||||
SqlCeDataReader reader = cmd.ExecuteReader();
|
||||
while (reader.Read()) { directory = reader.GetString(0); }
|
||||
conn.Close();
|
||||
reader.Close();
|
||||
} catch { }
|
||||
conn.Close();
|
||||
cmd.Parameters.Clear();
|
||||
return directory;
|
||||
}
|
||||
|
||||
public static Int64 getBackupCreationDate(string id)
|
||||
{
|
||||
Int64 date = 0;
|
||||
conn.Open();
|
||||
cmd.CommandText = "SELECT Creation_Date FROM Recordset WHERE Drive_ID = ?";
|
||||
cmd.Parameters.Add(new SqlCeParameter("Creation Date", SqlDbType.BigInt));
|
||||
cmd.Parameters["Creation Date"].Value = id;
|
||||
try
|
||||
{
|
||||
SqlCeDataReader reader = cmd.ExecuteReader();
|
||||
while (reader.Read()) { date = reader.GetInt64(0); }
|
||||
reader.Close();
|
||||
}
|
||||
catch { }
|
||||
conn.Close();
|
||||
cmd.Parameters.Clear();
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
public static string[] getAutomaticBackups()
|
||||
{
|
||||
conn.Open();
|
||||
|
|
Reference in a new issue