Example #1
0
        private DLR.ConditionalExpression CreateConditionalExpression(GenScope scope, int index)
        {
            var branch = Branches.ElementAt(index);

            var condition = DLR.Expression.Convert(branch.Condition.GenerateExpressionTree(scope), typeof(bool));
            var block     = branch.Block.GenerateExpressionTree(scope);

            index++;

            if (index == Branches.Count)
            {
                if (ElseBranch is null)
                {
                    return(DLR.Expression.Condition(condition, block, DLR.Expression.Default(block.Type)));
                }
                else
                {
                    return(DLR.Expression.Condition(condition, block, ElseBranch.GenerateExpressionTree(scope), block.Type));
                }
            }
            else
            {
                return(DLR.Expression.Condition(
                           condition,
                           block,
                           CreateConditionalExpression(scope, index)));
            }
        }
        public void RegisterStudent()
        {
            Console.WriteLine("Registering of a new student");
            Console.Write("Type his/her name : ");
            string name = Console.ReadLine();

            Console.Write("Type his/her adress : ");
            string adress = Console.ReadLine();

            Console.Write("Type his/her phone number : ");
            string phoneNumber = Console.ReadLine();

            Console.Write("Type his/her email : ");
            string email = Console.ReadLine();

            Console.Write("Type his/her password : "******"Type the name of his/her branch : ");
            string branchName = Console.ReadLine();

            Console.Write("Type the number of payments : ");
            int nbrPayment = Convert.ToInt32(Console.ReadLine());

            int     index   = Branches.IndexOfKey(branchName);
            Branche branche = Branches.ElementAt(index).Value;

            Student student = new Student(name, adress, phoneNumber, email, password, branche, nbrPayment, 0, 0, 0, AllCourses[index], AllCourses[index].Count);

            AllStudents.Add(student);
        }