Ejemplo n.º 1
0
        public static void SaveData()
        {
            string workerspath = Environment.CurrentDirectory + "\\Workers.txt";
            string clientspath = Environment.CurrentDirectory + "\\Clients.txt";
            string orderspath  = Environment.CurrentDirectory + "\\Orders.txt";

            IEnumerable <string> workersfile = workers.Select(Worker => Worker.ToFile());
            IEnumerable <string> clientsfile = clients.Select(Client => Client.ToFile());
            IEnumerable <string> ordersfile  = orders.Select(Order => Order.ToFile());

            if (File.Exists(workerspath))
            {
                File.Delete(workerspath);
            }
            if (File.Exists(clientspath))
            {
                File.Delete(clientspath);
            }
            if (File.Exists(orderspath))
            {
                File.Delete(orderspath);
            }

            File.WriteAllLines(workerspath, workersfile, System.Text.Encoding.UTF8);
            File.WriteAllLines(clientspath, clientsfile, System.Text.Encoding.UTF8);
            File.WriteAllLines(orderspath, ordersfile, System.Text.Encoding.UTF8);
        }
Ejemplo n.º 2
0
 private static void RickRollOrders()
 {
     if (orders.Any())
     {
         for (int i = 0; i < orders.Count; i++)
         {
             if (orders[i].IsDone)
             {
                 Worker wrk = workers.Find(Worker => Worker.ToFile() == orders[i].Worker.ToFile());
                 {
                     if (wrk != null)
                     {
                         wrk.IsBusy = false;
                     }
                 }
                 orders.RemoveAt(i);
                 i--;
                 if (!orders.Any())
                 {
                     return;
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public string ToFile()
 {
     return(Client.ToFile() + "|" + Worker.ToFile() + "|" + TimeStart);
 }