Пример #1
0
 public static void SetActiveButton(InventoryModuleObject instance, string value)
 {
     foreach (var prop in instance.GetType().GetProperties().Where(prop => prop.Name.Contains("Active")))
     {
         prop.SetValue(instance, false, null);
     }
     foreach (var prop in instance.GetType().GetProperties().Where(prop => prop.Name.Equals((value + "Active"))))
     {
         prop.SetValue(instance, true, null);
     }
 }
Пример #2
0
 public InventoryModuleObject GetInventoryNotifiers(int id)
 {
     try
     {
         InventoryModuleObject result = new InventoryModuleObject();
         using (DbConnection = new MsSqlPersistence(DbConnectionSettings))
         {
             if (DbConnection.IsConnected())
             {
                 using (DbCommand)
                 {
                     DbCommand.CommandText = @"
                         SELECT
                         COUNT(DISTINCT notes.id) AS NotesCount
                         FROM inventory_notes as notes
                         where notes.parentid = @ID AND notes.delete_date IS NULL
                         ";
                     DbCommand.Parameters.Add("@ID", System.Data.SqlDbType.Int).Value = id;
                     var table = DbConnection.ExecuteQuery(DbCommand);
                     if (table.Rows.Count == 1)
                     {
                         DataRow row = table.Rows[0];
                         result.NotesCount = row["NotesCount"].ToString();
                     }
                 }
             }
             else
             {
                 throw new Exception("Unable to Connect");
             }
         }
         return result;
     }
     catch
     {
         throw;
     }
 }