Esempio n. 1
0
        private static TimeOperations VerifyTimeVariable(int time_variable, int time_comparison)
        {
            TimeOperations Result = new TimeOperations(time_variable, 0);

            if (time_comparison == 0)
            {
                return(Result);
            }
            if (time_comparison < 0)
            {
                time_comparison *= -1;
            }

            if (time_variable >= time_comparison)
            {
                Result.TimeDifference = time_variable / time_comparison;
                Result.ResultingTime  = time_variable - (time_comparison * Result.TimeDifference);
            }
            else if (time_variable < 0)
            {
                Result.TimeDifference = (time_variable / time_comparison) - 1;
                Result.ResultingTime  = time_variable + (time_comparison * -Result.TimeDifference);
            }

            return(Result);
        }
Esempio n. 2
0
        public ActionResult RedactorTimeTable(string day, string number, string group, string teatcher, string auditory, string subject)
        {
            TimeOperations lo = new TimeOperations();

            lo.AddLesson(new MLesson(day, int.Parse(number), group, teatcher, auditory, subject));
            ViewBag.Message = "Succsesfully added";
            return(View());
        }
        public void GetLessonsTest()
        {
            var groupOperations = new TimeOperations();

            groupOperations.GetLessons();
            groupOperations.AddLesson(new Models.MLesson());

            groupOperations.GetLessonByID(0);
        }
Esempio n. 4
0
        private static GameTime VerifyTime(GameTime GT)
        {
            TimeOperations to_milliseconds = VerifyTimeVariable(GT.Milliseconds, 1000);

            GT.Milliseconds = to_milliseconds.ResultingTime;
            GT.Seconds     += to_milliseconds.TimeDifference;

            TimeOperations to_seconds = VerifyTimeVariable(GT.Seconds, 60);

            GT.Seconds  = to_seconds.ResultingTime;
            GT.Minutes += to_seconds.TimeDifference;

            return(GT);
        }
Esempio n. 5
0
        public ActionResult TeacherTimetable(string teacher)
        {
            TimeOperations lo     = new TimeOperations();
            var            list   = lo.GetLessons();
            string         result = "";

            foreach (MLesson l in list)
            {
                if (l.Teacher.Equals(teacher))
                {
                    result += "<br>" + " Day of week:  " + l.Day + " Group:  " + l.Group + " Number of lesson:  " + l.Para + " Code of auditory:  " + l.Auditory + " Name of subject:  " + l.Subject + " Teacher:  " + l.Teacher;
                }
            }

            ViewBag.Message = result;
            return(View());
        }
Esempio n. 6
0
        public static void Start()
        {
            Write("Введите время в формате HH:MM ");

            sbyte hours   = 0;
            sbyte minutes = 0;

            SetTimeData(ref hours, ref minutes, ReadLine());

            Time time = new Time(hours, minutes);

            string op = "Введите номер команды \n 1. Найти угол между часовой и минутной стрелкой \n " +
                        "2. Найти все пары углов между часовой, минутной и секундной стрелкой (+ вводятся секунды) \n " +
                        "3. Показать текущее время \n";

            while (true)
            {
                WriteLine(op);
                switch (Int32.Parse(ReadLine()))
                {
                case 1:
                    WriteLine(TimeOperations.GetDegreesHoursMinutes(in time));
                    WriteLine();
                    break;

                case 2:
                    WriteLine(TimeOperations.GetDegreesHoursMinutesSeconds(in time));
                    WriteLine();
                    break;

                case 3:
                    WriteLine(TimeOperations.GetCurrentTime());
                    WriteLine();
                    break;
                }
            }
        }
        private void ShowDigits(string input)
        {
            var displayedNumber = screen.Content.ToString().Count();

            if (screen.Content.ToString() == "0")
            {
                screen.Content = "";
            }

            if (input == "=" &&
                listOfInput.Any())
            {
                var screenContent = screen.Content.ToString().Replace("X", "*").Replace("mod", "#");

                if (screen.Content.ToString().Contains("sqrt"))
                {
                    screenContent = screenContent.Replace("sqrt", "sqrt(") + ")";
                }

                if (input == "=")
                {
                    if (CurrentMenu == OperationsUnit.Standard)
                    {
                        screen.Content = CalculateOperations.GetResult(screenContent);
                    }

                    else if (CurrentMenu == OperationsUnit.Decimal)
                    {
                        var inputAsint = Convert.ToInt32(screen.Content);
                        screen.Content = BinaryOperation.GetResult(inputAsint, ConvertionMethod);
                    }

                    else if (CurrentMenu == OperationsUnit.Percentage)
                    {
                        screen.Content = PercentOperation.GetResult(screenContent, SelectPercent);
                    }
                    else if (CurrentMenu == OperationsUnit.Weight)
                    {
                        screen.Content = WeightOperations.GetResult(screenContent, FromWeightUnit, ToWeightUnit);
                    }
                    else if (CurrentMenu == OperationsUnit.Temperature)
                    {
                        screen.Content = TemperatureOperations.GetResult(screenContent, TemperatureUnit);
                    }
                    else if (CurrentMenu == OperationsUnit.Length)
                    {
                        screen.Content = LengthOperations.GetResult(screenContent, FromLengthUnit, ToLUnit);
                    }
                    else if (CurrentMenu == OperationsUnit.File)
                    {
                        screen.Content = FileOperations.GetResult(screenContent, FromFileUnit, ToFileUnit);
                    }
                    else if (CurrentMenu == OperationsUnit.Time)
                    {
                        screen.Content = TimeOperations.GetResult(screenContent, FromTimeUnit, ToTimeUnit);
                    }
                }

                listOfInput.Clear();
            }

            else if (displayedNumber >= 13)
            {
                MessageBox.Show("Maximum Input exceed", "Input limit", MessageBoxButton.OK, MessageBoxImage.Stop);
            }

            else
            {
                listOfInput.Add(input);
                screen.Content += input.ToString();
            }
        }