Example #1
0
 /// <summary>
 /// Returns all record from dupe data base.
 /// </summary>
 /// <param name="commandText">The command text.</param>
 /// <returns><c>null</c> if record not found, else <see cref="DataBaseDupe"/></returns>
 public static List<DataBaseDupe> SelectFromDupeAll(string commandText)
 {
     Log.Debug("SelectFromDupeAll: '{0}'", commandText);
     DataTable dataTable = GetDataTable(commandText);
     DataRowCollection dataRowCollection = dataTable.Rows;
     if (dataRowCollection.Count > 0)
     {
         List<DataBaseDupe> list = new List<DataBaseDupe>();
         foreach (DataRow dataRow in dataRowCollection)
         {
             object[] itemArray = dataRow.ItemArray;
             DataBaseDupe dataBaseDupe = new DataBaseDupe
             {
                 Id = Misc.String2Number(itemArray[0].ToString()),
                 UserName = itemArray[1].ToString(),
                 GroupName = itemArray[2].ToString(),
                 DateTime = itemArray[3].ToString(),
                 PathReal = itemArray[4].ToString(),
                 PathVirtual = itemArray[5].ToString(),
                 ReleaseName = itemArray[6].ToString(),
                 Nuked = Misc.String2Number(itemArray[7].ToString()) > 0 ? true : false,
                 NukedReason = itemArray[8].ToString(),
                 Wiped = Misc.String2Number(itemArray[9].ToString()) > 0 ? true : false,
                 WipedReason = itemArray[10].ToString(),
             };
             list.Add(dataBaseDupe);
         }
         return list;
     }
     return null;
 }
Example #2
0
 public string FormatDupe(string line,
     DataBaseDupe dataBaseDupe)
 {
     string formatDupe = MinimumLength(line) || dataBaseDupe == null
                             ? line
                             : String.Format(new MyFormat(), line
                                             , dataBaseDupe.Id // {0}
                                             , dataBaseDupe.UserName // {1}
                                             , dataBaseDupe.GroupName // {2}
                                             , dataBaseDupe.DateTime // {3}
                                             , dataBaseDupe.PathReal // {4}
                                             , dataBaseDupe.PathVirtual // {5}
                                             , dataBaseDupe.ReleaseName // {6}
                                             , dataBaseDupe.Nuked // {7}
                                             , dataBaseDupe.NukedReason // {8}
                                             , dataBaseDupe.Wiped // {9}
                                             , dataBaseDupe.WipedReason // {10}
                                             , Constants.CodeNewLine //{11}
                                             , Constants.CodeIrcColor // {12}
                                             , Constants.CodeIrcBold // {13}
                                             , Constants.CodeIrcUnderline); // {14}
     Log.Debug("FormatDupe: " + formatDupe);
     return formatDupe;
 }