Example #1
0
        public void AddStudent(String StudentName, String StudentAdress, String StudentMail, String StudentPhone, String StudentUsername, String Password, String CourseId)
        {
            User user = new User();

            user.FullName    = StudentName;
            user.Adress      = StudentAdress;
            user.UserID      = Guid.NewGuid();
            user.StudentID   = Guid.NewGuid();
            user.Password    = Password;
            user.Mail        = StudentMail;
            user.Username    = StudentUsername;
            user.PhoneNumber = StudentPhone;
            Student stu = new Student();

            stu.StudentId = (Guid)user.StudentID;
            stu.GPA       = 0;
            Transcript trans = new Transcript();

            trans.cid      = Int32.Parse(CourseId);
            trans.GPA      = 0;
            trans.Semester = "2018 Fall";
            stu.Transcript.Add(trans);
            user.Student = stu;
            var result = UserMethods.AddUser(user);

            if (result == true)
            {
                ViewBag.Added = true;
            }
            Response.Redirect("/Teacher/RegisterStudent");
        }
Example #2
0
        public string AddUser(string identifier, string companyID)
        {
            UserMethods um = new UserMethods();

            try
            {
                int companyIDInt = Int32.Parse(companyID);
                return(um.AddUser(identifier, companyIDInt));
            }
            catch (Exception e)
            {
                return("bad");
            }
        }
Example #3
0
        public bool AddUser(string firstName, string lastName, string passwordHash, string emailAddress)
        {
            bool result = false; //see comment in method

            try
            {
                _methods.AddUser(firstName, lastName, passwordHash, emailAddress);
                result = true;
            }
            catch (Exception ex)//see comment in method
            {
                throw ex;
            }
            return(result);
        }
Example #4
0
        public void AddEmployee(String EmployeeName, String Salary, String EmployeeAdress,
                                String Mail, String Phone, String Username, String Password, String CompanyId)
        {
            User user = new User();

            user.FullName    = EmployeeName;
            user.Adress      = EmployeeAdress;
            user.UserID      = Guid.NewGuid();
            user.StudentID   = Guid.NewGuid();
            user.Password    = Password;
            user.Mail        = Mail;
            user.Username    = Username;
            user.PhoneNumber = Phone;
            Employee employee = new Employee();

            employee.Salary     = Int32.Parse(Salary);
            employee.CompanyId  = Guid.Parse(CompanyId);
            employee.EmployeeId = Guid.NewGuid();
            user.EmployeeID     = employee.EmployeeId;
            Insurence insurence = new Insurence();

            insurence.InsuranceType = "Full";
            insurence.Status        = "Active";
            insurence.StartDate     = DateTime.Today;
            insurence.InsuranceID   = Guid.NewGuid();
            employee.Insurence.Add(insurence);
            user.Employee = employee;

            var result = UserMethods.AddUser(user);

            if (result == true)
            {
                ViewBag.Added = true;
            }
            Response.Redirect("/Teacher/RegisterStudent");
        }
Example #5
0
 public void FillDB()
 {
     String[] ArrayOfNames =
     {
         "Chayndunth, Lord Of The Brown",
         "Gayzzur, The White",
         "Bimroi, The Taker Of Life",
         "Qonnu, The Dead",
         "Churso, The Fast One",
         "Baethe, The Bunny Killer",
         "Chuvoa, The Protective",
         "Ovnanoal, The Protective",
         "Dunneintei, The Grumpy",
         "Peorlirrath, The Bright",
         "Dundeonth, The Squeeler",
         "Sedath, The Redeemer",
         "Zeovae, The Barbarian",
         "Deirma, Champion Of The Brown",
         "Golryr, The Victorious",
         "Cygiorth, Lord Of Ice",
         "Dundit, Destroyer Of Life",
         "Quvurriet, The Strong Minded",
         "Aezzyrun, Champion Of The Skies",
         "Eoludoalth, Protector Of The Forest",
         "Ilrie, The Puny",
         "Ziassut, The Calm",
         "Qeidraylth, Braveheart",
         "Diarleith, Giver Of Life",
         "Eige, The Fierce",
         "Fryzzoal, The Rabbit Slayer",
         "Todruss, The Grumpy",
         "Zeovniassaet, The Strong",
         "Arsonieth, The Hungry",
         "Qayveiral, The Evil One",
         "Ierrath, Eater Of All",
         "Naylass, Lord Of The White",
         "Oldrun, The Jealous One",
         "Xeiphael, The Dark One",
         "Tiolraylth, The Firestarter",
         "Vizyth, Champion Of The Green",
         "Uzzog, The Tall",
         "Nandrunioss, The Eternal",
         "Sunnoidurth, Champion Of The Skies",
         "Moanoarroanth, The Dark",
         "Caghad, The Clean",
         "Rayghianth, The Puny",
         "Tiallienth, The White One",
         "Aevraynth, The Kind",
         "Mayllerth, The Gifted",
         "Sumath, The Taker Of Life",
         "Ova, Lord Of The Black",
         "Qurmuryt, Redeemer Of Men",
         "Xuziedait, The Brave",
         "Pemorriolth, The Creep"
     };
     String[] array_of_addresses =
     {
         "663 East Hilltop Road Webster, NY 14580",
         "690 Highland St. Garden City, NY 11530",
         "36 Central Ave. Pueblo, CO 81001",
         "544 Halifax Ave. Amityville, NY 11701",
         "653 Sunnyslope Road Erlanger, KY 41018",
         "876 Harvey Dr. Fremont, OH 43420",
         "21 Longfellow Ave.Kansas City, MO 64151",
         "7975 Spruce Road Danbury, CT 06810",
         "414 Pulaski St. Hyde Park, MA 02136",
         "8800 Acacia Street Lake Zurich, IL 60047",
         "39 Manor Dr. Evanston, IL 60201",
         "304 Ryan Drive Lansdowne, PA 19050",
         "4 Briarwood Street Palos Verdes Peninsula, CA 90274",
         "8165 Buttonwood St. Mount Holly, NJ 08060",
         "9057 Brewery Lane Staunton, VA 24401",
         "7355 Mayfield Ave. Irwin, PA 15642",
         "9 South Cherry Hill Street East Elmhurst, NY 11369",
         "15 Wild Rose Dr. Florence, SC 29501",
         "7288 Sheffield St. Stow, OH 44224",
         "375 Arcadia St. Cranberry Twp, PA 16066",
         "895 Brickyard Court Reisterstown, MD 21136",
         "626 Tarkiln Hill Lane Buckeye, AZ 85326",
         "9437 Ryan Rd. Elkhart, IN 46514",
         "461 Central Court Brockton, MA 02301",
         "27 Cedar Lane Waltham, MA 02453",
         "55 Bohemia St. Goshen, IN 46526",
         "900 Oakwood Street Algonquin, IL 60102",
         "88 Beacon St. Roselle, IL 60172",
         "754 Cooper Drive Loxahatchee, FL 33470",
         "7754 Cedarwood Ave. Coram, NY 11727",
         "8813 Clark Court Lake Mary, FL 32746",
         "29 Cherry Hill Court Sacramento, CA 95820",
         "375 Tunnel Dr. Livingston, NJ 07039",
         "9015 Buttonwood Court Coram, NY 11727",
         "799 Elizabeth Drive Parlin, NJ 08859",
         "79 Old York Ave. Largo, FL 33771",
         "451 Cedar St. Benton Harbor, MI 49022",
         "9612 Bridle Lane Peachtree City, GA 30269",
         "8 Belmont St. Hopkinsville, KY 42240",
         "7 Arnold Ave. Merrillville, IN 46410",
         "956 SW. Oklahoma St. Howard Beach, NY 11414",
         "35 Miles Avenue Mableton, GA 30126",
         "85 North Overlook Dr. Raeford, NC 28376",
         "727 Orange Drive El Paso, TX 79930",
         "76 Golf Dr. El Paso, TX 79930",
         "9261 Myrtle Lane Eden Prairie, MN 55347",
         "36 Morris Street Murrells Inlet, SC 29576",
         "9069 Plymouth St.Randallstown, MD 21133",
         "28 Taylor Lane Enfield, CT 06082",
         "54 Rocky River St. Goose Creek, SC 29445"
     };
     String[] course_name_arr =
     {
         "Terraforming",
         "Alien Environmental Development",
         "Alien Finance",
         "Alien Anthropology",
         "Alien Martial Arts",
         "Audiology",
         "Planetary Survival",
         "Small Forces Strategy",
         "Alchemy",
         "Alien Biosecurity",
         "Galactic Diplomacy",
         "Foreign Life Science",
         "Alien Sociology",
         "Physical Science",
         "Divining",
         "Alien Social Studies",
         "Elemental Magic",
         "Alien Life Science",
         "Foreign Criminal Justice",
         "Planetary Oceanography",
         "Space Travel",
         "Planetary Chemistry",
         "Nutrition",
         "Alien Medical Physics",
         "Alien Nutrition",
         "Enhanced Therapy",
         "Foreign Social Studies",
         "Planetary Chemistry",
         "Alien P.E.",
         "Foreign Dance",
         "Magic Law",
         "Earth Science",
         "Alien Ethics",
         "Alien Statistics",
         "Charm Casting",
         "Monster Hunting",
         "Curse Creation",
         "Terraforming",
         "Alien Family Psychology",
         "Alien Musical Arts"
     };
     for (var i = 0; i < 50; i++)
     {
         Random rnd  = new Random();
         User   user = new User();
         user.FullName    = ArrayOfNames[rnd.Next(0, 50)];
         user.Adress      = array_of_addresses[rnd.Next(0, 50)];
         user.UserID      = Guid.NewGuid();
         user.StudentID   = Guid.NewGuid();
         user.Password    = "******" + rnd.Next(0, 500);
         user.Mail        = rnd.Next(0, 500) + "@mail.com";
         user.Username    = "******" + rnd.Next(0, 500);
         user.PhoneNumber = "" + rnd.Next(100000000, 999999999);
         Student stu = new Student();
         stu.StudentId = (Guid)user.StudentID;
         stu.GPA       = 0;
         Transcript trans = new Transcript();
         trans.cid      = 1;
         trans.GPA      = 0;
         trans.Semester = "2018 Fall";
         stu.Transcript.Add(trans);
         user.Student = stu;
         UserMethods.AddUser(user);
     }
     for (var i = 0; i < 50; i++)
     {
         Random rnd  = new Random();
         User   user = new User();
         user.FullName    = ArrayOfNames[rnd.Next(0, 50)];
         user.Adress      = array_of_addresses[rnd.Next(0, 50)];
         user.UserID      = Guid.NewGuid();
         user.EmployeeID  = Guid.NewGuid();
         user.Password    = "******" + rnd.Next(500, 1000);
         user.Mail        = rnd.Next(500, 1000) + "@mail.com";
         user.Username    = "******" + rnd.Next(500, 1000);
         user.PhoneNumber = "" + rnd.Next(100000000, 999999999);
         Employee employee = new Employee();
         employee.Salary     = rnd.Next(5000, 10000);
         employee.CompanyId  = Guid.Parse("7895cf05-aced-494b-9889-b42b0bf761ca");
         employee.EmployeeId = (Guid)user.EmployeeID;
         Insurence insurence = new Insurence();
         insurence.InsuranceType = "Full";
         insurence.Status        = "Active";
         insurence.StartDate     = DateTime.Today;
         insurence.InsuranceID   = Guid.NewGuid();
         employee.Insurence.Add(insurence);
         user.Employee = employee;
         UserMethods.AddUser(user);
     }
     for (int i = 0; i < 40; i++)
     {
         Random rnd    = new Random();
         Course course = new Course();
         course.cid        = i + 2;
         course.TeacherId  = Guid.Parse("c6e66151-6b4f-4b43-a7e1-bfdb2bcbe246");
         course.CourseName = course_name_arr[i];
         TeacherMethods.AddCourse(course);
     }
 }
Example #6
0
        static void Main(string[] args)
        {
            string ch, userid, userfirstname, userlastname, userpassword, usercoursename, useremail;
            int    userchoice, choice;

            UserMethods usermethods = new UserMethods();


            try
            {
                do
                {
                    Console.WriteLine("\nEnter your Choice:\n\n 1 for Add a New User" +
                                      "\n 2 for View All Users\n 3 for View selected User  \n 4 for Update a User  " +
                                      "\n 5 for Delete a User \n 6 for Exit \n");
                    Console.Write("Your choice: ");

                    ch = Console.ReadLine();

                    while (!Int32.TryParse(ch, out userchoice))
                    {
                        Console.WriteLine("\nInvalid Choice!!!!");


                        Console.WriteLine("\nEnter your Choice:\n\n 1 for Add a New User" +
                                          "\n 2 for View All Users \n 3 for View selected User \n 4 for Update a User  " +
                                          "\n 5 for Delete a User \n 6 for Exit \n");
                        Console.Write("Your choice: ");


                        ch = Console.ReadLine();
                    }

                    choice = Int32.Parse(ch);

                    switch (choice)
                    {
                    case 1:
                        int uid;
                        Console.Write("\nEnter User's Id: ");
                        userid = Console.ReadLine();
                        while (!Int32.TryParse(userid, out uid))
                        {
                            Console.WriteLine("Please enter Valid Integer: ");
                            Console.Write("\nEnter User's Id Again: ");
                            userid = Console.ReadLine();
                        }
                        Console.Write("\nEnter User's FirstName: ");
                        userfirstname = Console.ReadLine();
                        while (!(Regex.IsMatch(userfirstname, @"^[a-zA-Z]{3,50}$")))
                        {
                            Console.WriteLine("FirstName should contain minimum 3 and maximum 50 alphabets ");
                            Console.Write("\nEnter User's FirstName Again: ");
                            userfirstname = Console.ReadLine();
                        }
                        Console.Write("\nEnter User's LastName: ");
                        userlastname = Console.ReadLine();
                        while (!(Regex.IsMatch(userlastname, @"^[a-zA-Z]{3,50}$")))
                        {
                            Console.WriteLine("LastName should contain minimum 3 and maximum 50 alphabets ");
                            userlastname = Console.ReadLine();
                        }
                        Console.Write("\nEnter User's Email: ");
                        useremail = Console.ReadLine();
                        while (!(Regex.IsMatch(useremail, @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")))
                        {
                            Console.WriteLine("Please enter correct email format. For example: '*****@*****.**' or ' [email protected]' or '*****@*****.**' ");
                            Console.Write("\nEnter User's Email Again: ");
                            useremail = Console.ReadLine();
                        }
                        Console.Write("\nEnter User's Password: "******"^(?=.*\d).{6,15}$")))

                        {
                            Console.WriteLine("Password should be between 6-15 character in length with at least one number, one letter ");
                            Console.Write("\nEnter User's Password Again: ");
                            userpassword = Console.ReadLine();
                        }
                        Console.Write("\nEnter User's CourseName: ");
                        usercoursename = Console.ReadLine();
                        while (!(Regex.IsMatch(usercoursename, @"^[a-zA-Z\+\.]{1,50}$")))
                        {
                            Console.WriteLine("CourseName should contain minimum 1 and maximum 50  ");
                            Console.Write("\nEnter User's CourseName Again: ");
                            usercoursename = Console.ReadLine();
                        }
                        Userdata usera = new Userdata();

                        usera.Id         = userid;
                        usera.FirstName  = userfirstname;
                        usera.LastName   = userlastname;
                        usera.Email      = useremail;
                        usera.Password   = userpassword;
                        usera.CourseName = usercoursename;

                        usermethods.AddUser(usera);

                        Console.WriteLine("-------------------------------------------------------------------------------------");
                        Console.BackgroundColor = ConsoleColor.White;
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("\nUser Added Successfully\n");
                        Console.ResetColor();
                        Console.WriteLine("-------------------------------------------------------------------------------------");

                        break;



                    case 2:
                        bool existuserall = usermethods.CheckUser();
                        if (existuserall)
                        {
                            List <Userdata> uservs = usermethods.GetAllUsers();

                            Console.WriteLine("-------------------------------------------------------------------------------------");
                            Console.BackgroundColor = ConsoleColor.White;
                            Console.ForegroundColor = ConsoleColor.Blue;
                            Console.WriteLine("\nUser Details:");


                            foreach (Userdata userdatagetall in uservs)
                            {
                                Console.WriteLine("---------------");
                                Console.WriteLine("Id        : " + userdatagetall.Id);
                                Console.WriteLine("FirstName : " + userdatagetall.FirstName);
                                Console.WriteLine("LastName  : " + userdatagetall.LastName);
                                Console.WriteLine("Email     : " + userdatagetall.Email);
                                Console.WriteLine("Password  : "******"CourseName: " + userdatagetall.CourseName + "\n");
                                Console.WriteLine("---------------");
                            }
                        }
                        else
                        {
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                            Console.BackgroundColor = ConsoleColor.White;
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("\nNo records found. Please Add users\n");
                            Console.ResetColor();
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                        }
                        Console.ResetColor();
                        Console.WriteLine("-------------------------------------------------------------------------------------");
                        break;

                    case 3:
                        bool existuser = usermethods.CheckUser();
                        if (existuser)
                        {
                            Console.Write("\nEnter Id to select the user: "******"\nPlease enter Valid Integer");
                                Console.Write("\nEnter Id to sleect the user Again: ");
                                userid = Console.ReadLine();
                            }
                            bool compareuser = usermethods.CompareUser(userid);

                            if (compareuser)
                            {
                                Userdata userdataget = usermethods.GetUser(userid);
                                if (userdataget != null)
                                {
                                    Console.WriteLine("-------------------------------------------------------------------------------------");
                                    Console.BackgroundColor = ConsoleColor.White;
                                    Console.ForegroundColor = ConsoleColor.Blue;
                                    Console.WriteLine("\nUser Details:");
                                    Console.WriteLine("---------------");
                                    Console.WriteLine("Id        : " + userdataget.Id);
                                    Console.WriteLine("FirstName : " + userdataget.FirstName);
                                    Console.WriteLine("LastName  : " + userdataget.LastName);
                                    Console.WriteLine("Email     : " + userdataget.Email);
                                    Console.WriteLine("Password  : "******"CourseName: " + userdataget.CourseName + "\n");
                                    Console.WriteLine("-------------------------------------------------------------------------------------");
                                    Console.ResetColor();
                                    Console.WriteLine("-------------------------------------------------------------------------------------");
                                }
                            }
                            else
                            {
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                Console.BackgroundColor = ConsoleColor.White;
                                Console.ForegroundColor = ConsoleColor.DarkYellow;
                                Console.WriteLine("\nThe user with id " + userid + " doesnot exist\n");
                                Console.ResetColor();
                            }
                        }
                        else
                        {
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                            Console.BackgroundColor = ConsoleColor.White;
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("\nNo records found. Please Add users\n");
                            Console.ResetColor();
                        }
                        Console.WriteLine("-------------------------------------------------------------------------------------");

                        break;


                    case 4:
                        bool existuseru = usermethods.CheckUser();
                        if (existuseru)
                        {
                            Console.WriteLine("\nEnter Id to update the userdata: ");
                            userid = Console.ReadLine();
                            int usersid;
                            while (!Int32.TryParse(userid, out usersid))
                            {
                                Console.WriteLine("Please enter Valid Integer");
                                Console.WriteLine("\nEnter Id to update the userdata Again: ");
                                userid = Console.ReadLine();
                            }

                            Userdata useru       = new Userdata();
                            bool     compareuser = usermethods.CompareUser(userid);
                            if (compareuser)
                            {
                                Console.Write("\nEnter User's New FirstName: ");
                                userfirstname = Console.ReadLine();
                                while (!(Regex.IsMatch(userfirstname, @"^[a-zA-Z]{3,50}$")))
                                {
                                    Console.WriteLine("FirstName should contain minimum 3 and maximum 50 alphabets ");
                                    Console.Write("\nEnter User's New FirstName Again: ");
                                    userfirstname = Console.ReadLine();
                                }
                                Console.Write("\nEnter User's New LastName: ");
                                userlastname = Console.ReadLine();
                                while (!(Regex.IsMatch(userlastname, @"^[a-zA-Z]{3,50}$")))
                                {
                                    Console.WriteLine("LastName should contain minimum 3 and maximum 50 alphabets ");
                                    Console.Write("\nEnter User's New LastName Again: ");
                                    userlastname = Console.ReadLine();
                                }
                                Console.Write("\nEnter User's New Email: ");
                                useremail = Console.ReadLine();
                                while (!(Regex.IsMatch(useremail, @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")))
                                {
                                    Console.WriteLine("Please enter correct email format. For example: '*****@*****.**' or ' [email protected]' or '*****@*****.**' ");
                                    Console.Write("\nEnter User's New Email Again: ");
                                    useremail = Console.ReadLine();
                                }
                                Console.Write("\nEnter User's New Password: "******"^(?=.*\d).{6,15}$")))
                                {
                                    Console.WriteLine("Password should be between 6-15 character in length with at least one number, one letter ");
                                    Console.Write("\nEnter User's New Password Again: ");
                                    userpassword = Console.ReadLine();
                                }
                                Console.Write("\nEnter User's New CourseName: ");
                                usercoursename = Console.ReadLine();
                                while (!(Regex.IsMatch(usercoursename, @"^[a-zA-Z\+\.]{1,50}$")))
                                {
                                    Console.WriteLine("CourseName should contain minimum 1 and maximum 50  ");
                                    Console.Write("\nEnter User's New CourseName Again: ");
                                    usercoursename = Console.ReadLine();
                                }

                                useru.Id         = userid;
                                useru.FirstName  = userfirstname;
                                useru.LastName   = userlastname;
                                useru.Email      = useremail;
                                useru.Password   = userpassword;
                                useru.CourseName = usercoursename;
                                usermethods.UpdateUser(useru);
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                Console.BackgroundColor = ConsoleColor.White;
                                Console.ForegroundColor = ConsoleColor.Blue;
                                Console.WriteLine("\nUser data is Updated Successfully\n");
                                Console.ResetColor();
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                break;
                            }

                            else
                            {
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                Console.BackgroundColor = ConsoleColor.White;
                                Console.ForegroundColor = ConsoleColor.DarkYellow;
                                Console.WriteLine("\nThe user with id " + userid + " doesnot exist\n");
                                Console.ResetColor();
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                break;
                            }
                        }


                        else
                        {
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                            Console.BackgroundColor = ConsoleColor.White;
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("\nNo records found. Please Add users\n");
                            Console.ResetColor();

                            Console.WriteLine("-------------------------------------------------------------------------------------");
                        }

                        break;

                    case 5:
                        bool existuserd = usermethods.CheckUser();

                        if (existuserd)
                        {
                            Console.Write("\nEnter Id to delete the userdata: ");
                            userid = Console.ReadLine();
                            int udid;
                            while (!Int32.TryParse(userid, out udid))
                            {
                                Console.WriteLine("\nPlease enter Valid Integer");
                                Console.Write("\nEnter Id to delete the userdata Again: ");
                                userid = Console.ReadLine();
                            }
                            Userdata userd       = new Userdata();
                            bool     compareuser = usermethods.CompareUser(userid);
                            Console.WriteLine("-------------------------------------------------------------------------------------");

                            if (compareuser)
                            {
                                usermethods.DeleteUser(userid);
                                Console.BackgroundColor = ConsoleColor.White;
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("\nUser Deleted Successfully\n");
                                Console.ResetColor();
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                break;
                            }

                            else
                            {
                                Console.BackgroundColor = ConsoleColor.White;
                                Console.ForegroundColor = ConsoleColor.DarkYellow;
                                Console.WriteLine("\nThe user with id " + userid + " doesnot exist\n");
                                Console.ResetColor();
                                Console.WriteLine("-------------------------------------------------------------------------------------");
                                break;
                            }
                        }

                        else
                        {
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                            Console.BackgroundColor = ConsoleColor.White;
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("\nNo records found. Please Add users\n");
                            Console.ResetColor();
                            Console.WriteLine("-------------------------------------------------------------------------------------");
                        }
                        break;



                    case 6:
                        Environment.Exit(-1);
                        break;


                    default:
                        Console.WriteLine("-------------------------------------------------------------------------------------");
                        Console.BackgroundColor = ConsoleColor.White;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("\nInvalid Number \n");
                        Console.ResetColor();
                        Console.WriteLine("-------------------------------------------------------------------------------------");

                        break;
                    }
                } while (choice != 6);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine("-------------------------------------------------------------------------------------");
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Exception message: " + e);
                Console.ResetColor();
                Console.WriteLine("-------------------------------------------------------------------------------------");
            }
        }