Пример #1
0
        public void FillClientsFromDNObject(DataNotationObject dnObject)
        {
            if (dnObject == null)
            {
                RaiseCriticalError("The clients object not found");
            }

            dnObject?.ForEach(collection => {
                if (collection.HasProperties("day", "month", "time", "interval", "phone"))
                {
                    RaiseCriticalError("Invalid params of 'clients' object");
                }

                var dayProperty      = collection.GetProperty("day").GetIntValue();
                var monthProperty    = collection.GetProperty("month").GetIntValue();
                var timeProperty     = collection.GetProperty("time").GetStringValue();
                var intervalProperty = collection.GetProperty("interval").GetIntValue();
                var phoneProperty    = collection.GetProperty("phone").GetStringValue();

                var time     = Helpers.ExtractTimeFromString(timeProperty);
                var dateTime = new DateTime(
                    DateTime.Now.Year,
                    monthProperty, dayProperty,
                    time.Hours, time.Minutes, time.Seconds);

                var client = new Client(dateTime, intervalProperty, phoneProperty);

                clientManagement.AddClient(client);
            });
        }
Пример #2
0
        public void PrintClientsObject(DataNotationObject dnObject)
        {
            Console.WriteLine($"Object: {dnObject.name}");

            dnObject?.ForEach(collection => {
                Console.WriteLine("\t{0}", collection.GetProperty("day").GetStringValue());
                Console.WriteLine("\t{0}", collection.GetProperty("time").GetStringValue());
                Console.WriteLine("\t{0}", collection.GetProperty("interval").GetStringValue());
                Console.WriteLine("\t{0}", collection.GetProperty("phone").GetStringValue());
            });
        }