public static Nullable <int> GetLastVersionDownloaded(UpdateType ut) { MySqlParameter[] param = new MySqlParameter[1]; param[0] = new MySqlParameter("_updDescription", ut.ToString()); DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting); System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDadupdateSelLastVerDownloaded", param); Nullable <int> result = null; if (db.HasError) { throw db.ErrorException; } if (reader.Read()) { result = DbAccessLayer.MySqlDataHelper.GetNullableInt(reader, "updVersion"); } reader.Close(); return(result); }
public static string GetLastVersion(UpdateType ut) { MySqlParameter[] param = new MySqlParameter[1]; param[0] = new MySqlParameter("_updDescription", ut.ToString()); DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting); System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDad_updateSelLastVersion", param); string result = string.Empty; if (db.HasError) { throw db.ErrorException; } if (reader.Read()) { result = DbAccessLayer.MySqlDataHelper.GetString(reader, "updVersionName"); } reader.Close(); return(result); }
public static string GetFTPUse() { DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting); System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDad_settingsSelFtpUse"); string url = string.Empty; if (db.HasError) { return(string.Empty); } if (reader.Read()) { url = DbAccessLayer.MySqlDataHelper.GetString(reader, "settingValue"); } return(url); }
public static string[] GetNewFileDownloadedContent(UpdateType ut, int curVersion) { MySqlParameter[] param = new MySqlParameter[2]; byte[] content = null; string[] result = new string[3]; param[0] = new MySqlParameter("_updDescription", ut.ToString()); param[1] = new MySqlParameter("_curVersion", curVersion); DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting); System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDad_updateSelFileContent", param); if (db.HasError) { throw db.ErrorException; } string url = string.Empty; if (reader.Read()) { content = DbAccessLayer.MySqlDataHelper.GetBytes(reader, "updContent"); result[1] = DbAccessLayer.MySqlDataHelper.GetGuid(reader, "updId").ToString(); result[0] = DbAccessLayer.MySqlDataHelper.GetString(reader, "updFileName"); result[2] = DbAccessLayer.MySqlDataHelper.GetString(reader, "updVersionName"); } reader.Close(); if (content != null && content.Length > 0) { if (ut == UpdateType.d) { if (Directory.Exists(Common.DefaultValues.updateTemplate)) { Directory.Delete(Common.DefaultValues.updateTemplate, true); } Directory.CreateDirectory(Common.DefaultValues.updateTemplate); string filePath = Common.DefaultValues.updateTemplate + "\\" + result[0]; Lawyer.Coding.FileManager.GetFileFromZipBinaryFormat(content, System.IO.Path.ChangeExtension(filePath, ".zip"), true); result[0] = System.IO.Path.ChangeExtension(filePath, ".txt"); return(result); } if (ut == UpdateType.s) { if (Directory.Exists(Common.DefaultValues.updateTemplate)) { Directory.Delete(Common.DefaultValues.updateTemplate, true); } Directory.CreateDirectory(Common.DefaultValues.updateTemplate); string filePath = Common.DefaultValues.updateTemplate + "\\" + result[0]; Lawyer.Coding.FileManager.GetFileFromZipBinaryFormat(content, System.IO.Path.ChangeExtension(filePath, ".zip"), true); result[0] = System.IO.Path.ChangeExtension(filePath, ".txt"); return(result); } } return(null); }