public static PackageMasterInfo GetPackageInfo(int intPkgId = 0) { int result = 0; SqlCeDataReader dr; PackageMasterInfo pkg = null; List<PackageFileLog> packglist = new List<PackageFileLog>(); StringBuilder strSql = new StringBuilder(); //strSql.Append("Select * from tblPackageDetails Where Complete = 'False'"); // Added By JK and AJ 18/07/2012 // Added Order By clause to make sure the earliest package is picked. strSql.AppendFormat("SELECT * from tblPackageMaster Where Downloaded = 'False' order by KioskPackageId"); try { Open(strConnectionString); SqlCeCommand command = new SqlCeCommand(strSql.ToString()); dr = ExecuteReader(command); while (dr.Read()) { pkg = new PackageMasterInfo(); pkg.KioskPackageId = Convert.ToInt32(dr["KioskPackageId"]); pkg.PackageId = Convert.ToInt32(dr["PackageId"]); pkg.ReleaseVersion = Convert.ToString(dr["ReleaseVersion"]); pkg.Deployed = Convert.ToBoolean(dr["Deployed"]); break; } } catch (SqlCeException ex) { if (log.IsErrorEnabled) log.Error("SqlCeException caught in DBLogger.Get Package Details.." + ex.Message); Close(); //System.Environment.Exit(1); // exit } return pkg; }
public static int LogPackageStatus(PackageMasterInfo obj) { int result = 0; StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("Update tblPackageMaster Set Deployed='true',ExecutionDatetime='" + FormatDateTime(obj.ExecutionDateTime) + "' , IssuedDatetime='" + FormatDateTime(DateTime.Now) + "' ,QueueId='" + obj.QueueId.ToString() + "' Where PackageId in ({0})", obj.PackageId.ToString()); if (log.IsInfoEnabled) log.Info("strSql:" + strSql); try { Open(strConnectionString); SqlCeCommand command = new SqlCeCommand(strSql.ToString()); result = ExecuteNonQuery(command); if (log.IsInfoEnabled) log.Info("Inside DBLogger.LogPackageStatus .ExecuteNonQuery result is:" + result.ToString()); } catch (SqlCeException ex) { if (log.IsErrorEnabled) log.Error("SqlCeException caught in DBLogger.LogPackageStatus.." + ex.Message); Close(); //System.Environment.Exit(1); // exit } catch (Exception ex) { if (log.IsErrorEnabled) log.Error("Generic exception caught in DBLogger.LogPackageStatus.." + ex.Message); } return result; }
public static int LogPackageStatus(PackageMasterInfo pkgInfo) { if (log.IsInfoEnabled) log.Info("Logger LogPackageStatus started.."); int result = DBLogger.LogPackageStatus(pkgInfo); if (log.IsInfoEnabled) log.Info("Logger LogPackageStatus ended.."); return result; }