public static void AdminFlow()
        {
            Courselist cl1 = new Courselist();
            //cl1.DisplayAllCourses();
            Connected cons2 = new Connected();

            cons2.ReadData();
            Admin ad1 = new Admin();

            ad1.DisplayAllTrainers();
            Program pr3 = new Program();


            //add do while loop for multiple enrollments
            Console.WriteLine("DO YOU WANT TO ENROLL");
            Console.WriteLine("1. Trainer \n2. Course \n3.UpdateCourse");
            int choice = Convert.ToInt32(Console.ReadLine());

            if (choice == 1)
            {
                pr3.RegisterTrainer();
            }
            else if (choice == 2)
            {
                Console.WriteLine("ENTER COURSE DETAILS");
                Course1   c1    = new Course1();
                Connected cons1 = new Connected();
                long      i     = cons1.Count() + 1;

                Console.WriteLine("Enter CourseName :");
                string s = Console.ReadLine();

                Console.WriteLine("Enter CourseDetail :");
                string s1 = Console.ReadLine();

                Console.WriteLine("Enter Duration :");
                string s2 = Console.ReadLine();

                Console.WriteLine("Enter Fees :");
                string  s3    = Console.ReadLine();
                Course1 cours = new Course1(i, s, s1, s2, s3);

                //Courselist.lstCourses.Add(cours);
                cons1.CreateData(cours);
            }
            else if (choice == 3)
            {
                Program p = new Program();
                p.UpdateFees();
            }

            Console.WriteLine("REGISTERED SUCCESSFULLY.");
            Console.Read();
        }
        public static void Main(string[] args)
        {
            Course1 cour = new Course1(Admin.CourseID++, "Java", "CoreJava", "120 hours", "600");

            Courselist.lstCourses.Add(cour);

            Trainer train = new Trainer(Admin.TrainerId++, "Netra", "*****@*****.**", "9789456971", "India", "Netra", "PasswordNetra1");

            Trainerlist.lstTrainer.Add(train);

            Program program = new Program();

            program.UserLogin();
        }
예제 #3
0
        public Boolean CreateData(Course1 c)
        {
            Boolean successFlag = false;

            con             = ConnectionEstablish();
            cmd             = new SqlCommand();
            cmd.Connection  = con;
            cmd.CommandText = "Insert into dbo.Course1 values (@courseId ,@courseName,@courseDetail,@duration,@fees)";
            cmd.Parameters.AddWithValue("@courseId", c.CourseId);
            cmd.Parameters.AddWithValue("@courseName", c.CourseName);
            cmd.Parameters.AddWithValue("@courseDetail", c.CourseDetail);
            cmd.Parameters.AddWithValue("@duration", c.Duration);
            cmd.Parameters.AddWithValue("@fees", c.Fees);
            con.Open();
            int count = cmd.ExecuteNonQuery();

            if (count > 0)
            {
                successFlag = true;
            }
            return(successFlag);
        }