コード例 #1
0
ファイル: SampleDataConfig.cs プロジェクト: nacss/main
 /// <summary>
 /// Wczytuje używane aktualnie dane.
 /// </summary>
 /// <param name="choose">Tablica tabel, które mają zostać wybrane z bazy danych.</param>
 static void ReadDataFromDataBase(int[] choose)
 {
     DataBase = new IDataBase[choose.Length];
     int i = 0;
     foreach (var choosen in choose)
     {
         switch (choosen)
         {
             case 0:
                 DataBase[i++] = new Collectors();
                 break;
             case 1:
                 DataBase[i++] = new Customers();
                 break;
             case 2:
                 DataBase[i++] = new Areas();
                 break;
             case 3:
                 DataBase[i++] = new Addresses();
                 break;
             case 4:
                 DataBase[i++] = new Counters();
                 break;
             default:
                 DataBase[i++] = new Collectors();
                 break;
         }
     }
 }
コード例 #2
0
ファイル: SampleDataConfig.cs プロジェクト: rafaliusz/main
        /// <summary>
        /// Generuje liczniki losowo dobierając wartości pól. Losuje adres i klienta przypisanego do danego licznika.
        /// </summary>
        static void GenerateCounters()
        {
            Random rnd = new Random();
            Counter counter;
            Counters dataBase = new Counters();

            for (int i = 0; i < numberOfCounters; i++)
            {
                counter = new Counter();

                counter.CounterNo = rnd.Next(1000, 10000);
                while (MainValidation.CounterExists(counter.CounterNo))
                    counter.CounterNo = rnd.Next(1000, 10000);
                counter.CircuitNo = rnd.Next(1000, 10000);
                counter.AddressId = new Guid(ChooseRandomId(1));
                counter.CustomerId = ChooseRandomId(0);

                counter.InsertIntoDB();
            }
        }