Esempio n. 1
0
        public NeuralNetworkPageView()
        {
            GregorianCalendar gregorianCalendar = new GregorianCalendar();//КАЛЕНДАРЬ
            DateTime dateTime = DateTime.Now;//ТЕКУЩАЯ ДАТА
            int daysInMonth = gregorianCalendar.GetDayOfMonth(dateTime);//ПОЛУЧАЕМ ЗНАЧЕНИЕ ТЕКУЩЕЙ ДНЯ В МЕСЯЦЕ


            int hours = DateTime.Now.Hour;
            DayOfWeek dayOfWeek = DateTime.Now.DayOfWeek;
            int hoursInWeek = (int)dayOfWeek == 0 ? 6 * hoursInDay : ((byte)(dayOfWeek-1)) * hoursInDay;
            int bypher = (int)Settings.Default["CountGoodHoursInWeek"];
            int porcent = (bypher * 100) / (hoursInWeek + hours);


            int hoursInMonth = (daysInMonth-1) * hoursInDay;
            bypher = (int)Settings.Default["CountGoodHoursInMonth"];
            int porcentMonth = (bypher * 100) / (hoursInMonth + hours);


            InitializeComponent();
            DataContext = new NeuralNetworkViewModel("Твой показатель", porcent, porcentMonth);
            AllResultNumber.Content = hoursInWeek + hours;
            SuccessfullyResultNumber.Content = (int)Settings.Default["CountGoodHoursInWeek"];
            BadResultNumber.Content = hoursInWeek + hours - (int)Settings.Default["CountGoodHoursInWeek"];

            AllResultNumberMonth.Content = hoursInMonth + hours;
            SuccessfullyResultNumberMonth.Content = (int)Settings.Default["CountGoodHoursInMonth"];
            BadResultNumberMonth.Content = hoursInMonth + hours - (int)Settings.Default["CountGoodHoursInMonth"];
            Label[] labelsName = new Label[] { nameOne, nameTwo, nameThree };
            Label[] labelsClock = new Label[] { clockOne, clockTwo, clockThree };
            Top(Path.currentWeek, labelsName, labelsClock); // 3  ЛЕЙБЛА КОТОРЫЕ БУДУТ ЗАПОЛНЕНЫ
            labelsName = new Label[] { name1, name2, name3, name4, name5 };
            labelsClock = new Label[] { clock1, clock2, clock3, clock4, clock5 };
            Top(Path.currentMonth, labelsName, labelsClock); // 5  ЛЕЙБЛОВ КОТОРЫЕ БУДУТ ЗАПОЛНЕНЫ
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> PostNeuralNetwork(NeuralNetworkViewModel neuralNetwork)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var network = new NeuralNetwork
            {
                Generation = neuralNetwork.Generation,
                Network    = string.Join("\n", neuralNetwork.Network)
            };

            _db.NeuralNetworks.Add(network);
            await _db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = network.NeuralNetworkId }, neuralNetwork));
        }