Example #1
14
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            string message = String.Empty;
            StudentServiceClient studentService = new StudentServiceClient();
            if (studentService.DismissStudent(studentSelected.StudentId, ref message)) {
                LogServiceClient logService = new LogServiceClient();
                studentSelected.Dismissed = true;
                string json = JsonConvert.SerializeObject(studentSelected);
                Log log = new Log
                {
                    CLUD = "D",
                    LogDate = DateTime.Now,
                    TableName = "Students",
                    UserId = GlobalClass.user.UserId,
                    UserName = GlobalClass.user.UserName,
                    PassedData = json
                };
                logService.AddLogs(log);

            }

            MessageBox.Show(this, "Student Dismissed");
        }
Example #2
0
 private void  LoadCurrentPair(object obj)
 {
     if (_proxy.State == System.ServiceModel.CommunicationState.Faulted)
         _proxy = new StudentServiceClient();
     _currentPair = _proxy.GetCurrentPair(DateTime.Now, _teacher).ToList<StudingTheSubject>();
     if (_currentPair.Count != 0)
     {
         this.Invoke((Action)delegate
         {
             if (_currentPair.Count != 0)
             {
                 tb_currPairDate.Text = "Зараз";
                 tb_currGroups.Text = String.Empty;
                 foreach (var pair in _currentPair)
                     tb_currGroups.Text += "  " + _proxy.GetGroupById(pair.GroupId).Name;
                 tb_currSubject.Text = _proxy.GetSubjectById(_currentPair[0].SubjectId).Name;
                 tb_currRoom.Text = _currentPair[0].Classroom.ToString();
             }
         });
     }
     else
     {
         this.Invoke((Action)delegate
         {
             tb_currPairDate.Text = String.Empty;
             tb_currGroups.Text = String.Empty;
             tb_currSubject.Text = String.Empty;
             tb_currRoom.Text = String.Empty;
         });
     }
 }
Example #3
0
 public WorkForm(Teacher teacher, FormLogin parentForm, StudentServiceClient proxy)
 {
     InitializeComponent();
     _teacher = teacher;
     _parrentForm = parentForm;
     _proxy = proxy;
 } 
Example #4
0
        private void Bind()
        {
            StudentServiceClient client = new StudentServiceClient();
            IEnumerable <NetTcpServer.StudentInfo> x = client.GetStudentInfo(Int32.Parse(textBox1.Text));

            dataGridView1.Invoke((Action)(() => { dataGridView1.DataSource = x; }));
        }
Example #5
0
        private void GenerateStudentID()
        {
            StudentServiceClient studentService = new StudentServiceClient();

            szStudentID       = studentService.GenerateStudentId();
            txtStudentId.Text = szStudentID;
        }
 public CreationTimeTableForm(StudentServiceClient proxy, Form parentForm, Teacher techer)
 {
     InitializeComponent();
     _proxy = proxy;
     _parentForm = parentForm;
     _teacher = techer;
 }
 public CreationTimeTableForm(StudentServiceClient proxy, Form parentForm, Teacher techer)
 {
     InitializeComponent();
     _proxy      = proxy;
     _parentForm = parentForm;
     _teacher    = techer;
 }
Example #8
0
 public static bool login(string id)
 {
     try
     {
         proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
         if (proxy.Login(id))
         {
             proxy.CloseAsync();
             return(true);
         }
         else
         {
             proxy.CloseAsync();
             return(false);
         }
     }
     catch (CommunicationException)
     {
         proxy.Abort();
         return(false);
     }
     catch (TimeoutException)
     {
         proxy.Abort();
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public AdministrationForm(StudentServiceClient proxy, Form parentForm, Teacher teacher)
 {
     InitializeComponent();
     _proxy = proxy;
     _parentForm = parentForm;
     _teacher = teacher;
 }
Example #10
0
 public AttendanceForm(StudentServiceClient proxy, WorkForm parrentForm, List <StudingTheSubject> currentPair)
 {
     InitializeComponent();
     _proxy       = proxy;
     _parrentForm = parrentForm;
     _currentPair = currentPair;
 }
Example #11
0
 public ConfigurationForm(StudentServiceClient proxy, Form parentForm, Teacher teacher)
 {
     InitializeComponent();
     _proxy      = proxy;
     _parentForm = parentForm;
     _teacher    = teacher;
 }
Example #12
0
        static async Task Main(string[] args)
        {
            using (StudentServiceClient proxy = new StudentServiceClient())
            {
                proxy.AddStudent(new Student
                {
                    Address = new Address
                    {
                        City   = "Rivne",
                        Street = "Soborna"
                    },
                    Age  = 21,
                    Name = "Viktor"
                });

                //Student[] result = proxy.GetStudents();
                Student[] result = await proxy.GetStudentsAsync();

                foreach (var item in result)
                {
                    Console.WriteLine(item.Name + " " + item.Address.City);
                }

                Console.WriteLine("Main works....");
                Console.ReadLine();
            }
        }
Example #13
0
 private void  LoadCurrentPair(object obj)
 {
     if (_proxy.State == System.ServiceModel.CommunicationState.Faulted)
     {
         _proxy = new StudentServiceClient();
     }
     _currentPair = _proxy.GetCurrentPair(DateTime.Now, _teacher).ToList <StudingTheSubject>();
     if (_currentPair.Count != 0)
     {
         this.Invoke((Action) delegate
         {
             if (_currentPair.Count != 0)
             {
                 tb_currPairDate.Text = "Зараз";
                 tb_currGroups.Text   = String.Empty;
                 foreach (var pair in _currentPair)
                 {
                     tb_currGroups.Text += "  " + _proxy.GetGroupById(pair.GroupId).Name;
                 }
                 tb_currSubject.Text = _proxy.GetSubjectById(_currentPair[0].SubjectId).Name;
                 tb_currRoom.Text    = _currentPair[0].Classroom.ToString();
             }
         });
     }
     else
     {
         this.Invoke((Action) delegate
         {
             tb_currPairDate.Text = String.Empty;
             tb_currGroups.Text   = String.Empty;
             tb_currSubject.Text  = String.Empty;
             tb_currRoom.Text     = String.Empty;
         });
     }
 }
Example #14
0
 public WorkForm(Teacher teacher, FormLogin parentForm, StudentServiceClient proxy)
 {
     InitializeComponent();
     _teacher     = teacher;
     _parrentForm = parentForm;
     _proxy       = proxy;
 }
 public AttendanceForm(StudentServiceClient proxy, WorkForm parrentForm, List<StudingTheSubject> currentPair)
 {
     InitializeComponent();
     _proxy = proxy;
     _parrentForm = parrentForm;
     _currentPair = currentPair;
 }
Example #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            StudentServiceClient client = new StudentServiceClient();

            IEnumerable <StudentInfo> x = client.GetStudentInfo(Int32.Parse(textBox1.Text));

            dataGridView1.DataSource = x;
        }
        /// <summary>
        /// Creates a new connection to the service or uses an existing one
        /// </summary>
        /// <returns>A working connection to the service</returns>
        public static StudentServiceClient GetClient()
        {
            if(clientInstance == null)
            {
                clientInstance = new StudentServiceClient();
            }

            return clientInstance;
        }
        /// <summary>
        /// Creates a new connection to the service or uses an existing one
        /// </summary>
        /// <returns>A working connection to the service</returns>
        public static StudentServiceClient GetClient()
        {
            if (clientInstance == null)
            {
                clientInstance = new StudentServiceClient();
            }

            return(clientInstance);
        }
Example #19
0
        static void Main(string[] args)
        {
            StudentServiceClient client = new StudentServiceClient();

            var name = client.GetName();

            Console.WriteLine("Name of the student is " + name);

            //https://msdn.microsoft.com/en-us/library/ff648360.aspx
        }
Example #20
0
        public static List <Qualification> GetQualifications(string studentId)
        {
            try
            {
                proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
                if (proxy != null)
                {
                    if (proxy.State != CommunicationState.Faulted)
                    {
                        List <Qualification> qualifications = new List <Qualification>();
                        var qList = proxy.GetQualificationList(studentId);
                        for (int i = 0; i < qList.Count; i++)
                        {
                            Qualification qual = new Qualification();
                            qual.QualCode              = qList[i].QualCode;
                            qual.QualName              = qList[i].QualName;
                            qual.CoreUnits             = qList[i].CoreUnits;
                            qual.TafeQualCode          = qList[i].TafeQualCode;
                            qual.NationaQualCode       = qList[i].NationalQualCode;
                            qual.TotalUnits            = qList[i].TotalUnits;
                            qual.ElectedUnits          = qList[i].ElectedUnits;
                            qual.ReqListedElectedUnits = qList[i].ReqListedElectedUnits;

                            qualifications.Add(qual);
                        }
                        proxy.CloseAsync();
                        return(qualifications);
                    }
                    else
                    {
                        proxy.Abort();
                        return(null);
                    }
                }
                else
                {
                    proxy.Abort();
                    return(null);
                }
            }
            catch (CommunicationException)
            {
                proxy.Abort();
                return(null);
            }
            catch (TimeoutException)
            {
                proxy.Abort();
                return(null);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #21
0
        static void Main(string[] args)
        {
            IStudentService service  = new StudentServiceClient();
            var             students = service.GetAllStudentsAsync();

            foreach (var student in students)
            {
                Console.WriteLine($"Id: {student.Id}, Name: {student.Name}");
            }
            Console.ReadLine();
        }
Example #22
0
 static void Main(string[] args)
 {
     using (var client = new StudentServiceClient())
     {
         var students = client.GetAllStudents();
         foreach (var s in students)
         {
             Console.WriteLine($"{s.Id}\t{s.Name}");
         }
     }
 }
Example #23
0
        public List <Qualification> GetQualificationList(string studentId)
        {
            proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
            var qs = proxy.GetQualificationListAsync(studentId).Result;
            List <Qualification> qualifications = new List <Qualification>();

            foreach (var q in qs)
            {
                qualifications.Add(q);
            }
            return(qualifications);
        }
Example #24
0
        static void Main(string[] args)
        {
            StudentServiceClient      client = new StudentServiceClient();
            IEnumerable <StudentInfo> x      = client.GetStudentInfo(Int32.Parse("10010"));

            foreach (StudentInfo s in x)
            {
                Console.WriteLine(s.FirstName + s.LastName);
            }

            Console.ReadKey();
        }
Example #25
0
 public static List <Competency> GetCompetencies(string studentId, string qualCode)
 {
     try
     {
         proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
         if (proxy != null)
         {
             if (proxy.State != CommunicationState.Faulted)
             {
                 proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
                 List <Competency> competencies = new List <Competency>();
                 var cList = proxy.GetCompetencyList(studentId, qualCode);
                 for (int i = 0; i < cList.Count; i++)
                 {
                     Competency comp = new Competency();
                     comp.TafeCompCode    = cList[i].TafeCode;
                     comp.NationaCompCode = cList[i].NationalCode;
                     comp.CompetencyName  = cList[i].CompetencyName;
                     comp.SubjectCode     = cList[i].SubjectCode;
                     comp.CompTypeCode    = cList[i].TrainingPakckageUsage;
                     comp.Results         = cList[i].Results;
                     competencies.Add(comp);
                 }
                 proxy.CloseAsync();
                 return(competencies);
             }
             else
             {
                 proxy.Abort();
                 return(null);
             }
         }
         else
         {
             proxy.Abort();
             return(null);
         }
     }
     catch (CommunicationException)
     {
         proxy.Abort();
         return(null);
     }
     catch (TimeoutException)
     {
         proxy.Abort();
         return(null);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #26
0
        public List <Competency> GetNotPassedCompetencyList(string studentId, string qualId)
        {
            proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
            var cs = proxy.GetNotPassedCompetenciesAsync(studentId, qualId).Result;
            List <Competency> competencies = new List <Competency>();

            foreach (var c in cs)
            {
                competencies.Add(c);
            }
            return(competencies);
        }
Example #27
0
        public List <Student> GetStudentList()
        {
            proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
            var            ss       = proxy.GetStudentsAsync().Result;
            List <Student> students = new List <Student>();

            foreach (var s in ss)
            {
                students.Add(s);
            }
            return(students);
        }
Example #28
0
 public static User getStudentById(string id)
 {
     try
     {
         proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
         if (proxy != null)
         {
             if (proxy.State != CommunicationState.Faulted)
             {
                 proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
                 User user = new User();
                 var  s    = proxy.GetStudentById(id);
                 if (s != null)
                 {
                     user.Username = String.Format(s.GivenName + "  " + s.LastName);
                     user.Id       = s.StudentID;
                     proxy.CloseAsync();
                     return(user);
                 }
                 else
                 {
                     proxy.CloseAsync();
                     return(null);
                 }
             }
             else
             {
                 proxy.Abort();
                 return(null);
             }
         }
         else
         {
             proxy.Abort();
             return(null);
         }
     }
     catch (CommunicationException)
     {
         proxy.Abort();
         return(null);
     }
     catch (TimeoutException)
     {
         proxy.Abort();
         return(null);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #29
0
        static void Main(string[] args)
        {
            client = new StudentServiceClient();
            var students = client.GetStudent();

            Console.WriteLine("------- Students ------- ");
            foreach (var item in students)
            {
                Console.WriteLine("{0}, {1}", item.Name, item.Age);
            }

            Console.ReadKey();
        }
Example #30
0
 public LoginWindow()
 {
     try
     {
         ClientManager.CloseClient();
         client = ClientManager.GetClient();
         InitializeComponent();
     }
     catch (Exception ex)
     {
         MessageBox.Show(Application.Current.Resources["defaultErrorMessage"].ToString(),
                         "Грешка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Example #31
0
        private bool chkStudentID()
        {
            Student student = new Student();
            string msg = string.Empty;
            StudentServiceClient studentService = new StudentServiceClient();

            student = studentService.GetStudent(txtIDNumber.Text, ref msg);
            if (student.StudentId != null)
            {
                return true;
            }
            else
                return false;
        }
 public LoginWindow()
 {
     try
     {
         ClientManager.CloseClient();
         client = ClientManager.GetClient();
         InitializeComponent();
     }
     catch (Exception ex)
     {
         MessageBox.Show(Application.Current.Resources["defaultErrorMessage"].ToString(), 
             "Грешка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Example #33
0
 public static double CalQualProgress(string studentId, string qualCode)
 {
     try
     {
         proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
         if (proxy != null)
         {
             if (proxy.State != CommunicationState.Faulted)
             {
                 proxy = new StudentServiceClient(StudentServiceClient.EndpointConfiguration.BasicHttpsBinding_IStudentService);
                 double progress = 0.00d;
                 progress = proxy.CalQualProgress(studentId, qualCode);
                 if (progress >= 1)
                 {
                     proxy.CloseAsync();
                     return(1.00d);
                 }
                 else
                 {
                     proxy.CloseAsync();
                     return(progress);
                 }
             }
             else
             {
                 proxy.Abort();
                 return(0);
             }
         }
         else
         {
             proxy.Abort();
             return(0);
         }
     }
     catch (CommunicationException)
     {
         proxy.Abort();
         return(0);
     }
     catch (TimeoutException)
     {
         proxy.Abort();
         return(0);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #34
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (studentSelected != null)
            {
                StudentServiceClient studentService = new StudentServiceClient();
                string message = String.Empty;

                if (!studentService.DismissStudent(studentSelected.StudentId, ref message))
                {
                    message = "Dismissal of Student Failed";
                }
                else
                {
                    MessageBox.Show("Dismissed succesfully!");
                }
            }
        }
Example #35
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (studentSelected != null)
            {
                StudentServiceClient studentService = new StudentServiceClient();
                string message = String.Empty;

                if (!studentService.DismissStudent(studentSelected.StudentId, ref message))
                {
                    message = "Dismissal of Student Failed";
                }
                else
                {
                    MessageBox.Show("Dismissed succesfully!");
                }
            }
        }
Example #36
0
        public void LoadStudents()
        {
            StudentServiceClient studentService = new StudentServiceClient();
            string message = String.Empty;
            try
            {
                var students = studentService.GetAllStudents();
                studentList = new List<StudentServiceRef.Student>(students);
                gvStudent.DataSource = students;
                gvStudent.Refresh();

                if (gvStudent.RowCount != 0)
                    gvStudent.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading Student List";
                MessageBox.Show(ex.ToString());
            }
        }
Example #37
0
        private void txtStudentId_Leave(object sender, EventArgs e)
        {
            Student student = new Student();
            string  msg     = string.Empty;
            StudentServiceClient studentService = new StudentServiceClient();

            if (txtStudentId.Text == string.Empty)
            {
                txtStudentId.Text = szStudentID;
            }


            student = studentService.GetStudent(txtStudentId.Text, ref msg);
            if (student.StudentId != null)
            {
                MessageBox.Show("Student ID already exist!");
                txtStudentId.Text = szStudentID;
                txtStudentId.Focus();
                return;
            }
        }
Example #38
0
        public void LoadStudents()
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            RegisteredStudents= new List<string>(registrationService.GetEnrolledStudents(GlobalClass.currentsy));
            StudentServiceClient studentService = new StudentServiceClient();
            string message = String.Empty;
            try
            {
                var students = studentService.GetAllStudents();
                studentList = new List<StudentServiceRef.Student>(students);
                gvStudent.DataSource = students;
                gvStudent.Refresh();

                if (gvStudent.RowCount != 0)
                    gvStudent.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading Student List";
                MessageBox.Show(ex.ToString());
            }
        }
Example #39
0
        public void LoadStudents()
        {
            StudentServiceClient studentService = new StudentServiceClient();
            string message = String.Empty;

            try
            {
                var students = studentService.GetAllStudents();
                studentList          = new List <Student>(students);
                gvStudent.DataSource = students;
                gvStudent.Refresh();

                if (gvStudent.RowCount != 0)
                {
                    gvStudent.Rows[0].IsSelected = true;
                }
            }
            catch (Exception ex)
            {
                message = "Error Loading Student List";
                MessageBox.Show(ex.ToString());
            }
        }
Example #40
0
 public ActionResult GetStudent()
 {
     StudentServiceClient client = new StudentServiceClient();
     Student student = client.GetStudent(Convert.ToString(17));
     return View();
 }
 public RegistrationForm(StudentServiceClient proxy)
 {
     InitializeComponent();
     _proxy = proxy;
 }
 private void GenerateStudentID()
 {
     StudentServiceClient studentService = new StudentServiceClient();
     szStudentID = studentService.GenerateStudentId();
     txtStudentId.Text = szStudentID;
 }
Example #43
0
 public FormLogin()
 {
     InitializeComponent();
     _proxy = new StudentServiceClient();
 }
 public StudentStatisticsForm(StudentServiceClient proxy, Student student)
 {
     InitializeComponent();
     _proxy = proxy;
     _student = student;
 }
 public RegistrationForm(StudentServiceClient proxy)
 {
     InitializeComponent();
     _proxy = proxy;
 }
        private void txtStudentId_Leave(object sender, EventArgs e)
        {
            Student student = new Student();
            string msg = string.Empty;
            StudentServiceClient studentService = new StudentServiceClient();

            if (txtStudentId.Text == string.Empty) txtStudentId.Text = szStudentID;


            student = studentService.GetStudent(txtStudentId.Text, ref msg);
            if (student.StudentId != null)
            {
                MessageBox.Show("Student ID already exist!");
                txtStudentId.Text = szStudentID;
                txtStudentId.Focus();
                return;
            }
        }
Example #47
0
 public StudentExamManage()
 {
     client = new StudentServiceClient();
 }
Example #48
0
        private void Save()
        {
            string szGender = string.Empty;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);
            var convertDecimal = Convert.ToDecimal(txtFail.Text);
            StudentServiceClient studentService = new StudentServiceClient();
            int schoId= studentService.GetScholarshipDiscountId("none");
            Student student = new Student();

            student.StudentId = txtStudentId.Text;
            student.FirstName = txtFirstName.Text;
            student.MiddleName = txtMiddleName.Text;
            student.LastName = txtLastName.Text;
            student.Average = double.Parse(txtPrevGPA.Text);
            student.Image = bImage;
            student.SchoolLastAttended = txtSchoolLastAttended.Text;
            student.GradeLevel = cmbGradeLevel.SelectedValue.ToString();
            student.DOB = dtDOB.Value;
            student.MadrasahEnrolled = chkMadrasah.Checked;
            student.Card = chkReportCard.Checked;
            student.GoodMoral = chkGoodMoral.Checked;
            student.Gender = szGender;
            student.BirthCertificate = chkBirthCertificate.Checked;
            student.POBAddress = txtPOB_Street.Text;
            student.POBBarangay = txtPOB_Brgy.Text;
            student.POBProvince = txtPOB_Province.Text;
            student.POBTownCity = txtPOB_Town.Text;
            student.HomeAddress = txtHA_Street.Text;
            student.HomeProvince = txtHA_Province.Text;
            student.HomeBarangay = txtHA_Brgy.Text;
            student.HomeTownCity = txtHA_Town.Text;
            student.FathersName = txtFather_FullName.Text;
            student.FathersOccupation = txtFather_Occupation.Text;
            student.FathersAverageYearlyIncome = double.Parse(txtFather_Income.Text);
            student.FathersEducation = txtFather_EducAttainment.Text;
            student.MothersMaidenName = txtMother_FullName.Text;
            student.MothersEducation = txtMother_EducAttainment.Text;
            student.MothersOccupation = txtMother_Occupation.Text;
            student.MothersAverageYearlyIncome = double.Parse(txtMother_Income.Text);
            student.GuardiansName = txtGuardian_FullName.Text;
            student.GuardiansOccupation = txtGuardian_Occupation.Text;
            student.GuardiansAverageYearlyIncome = double.Parse(txtGuardian_Income.Text);
            student.ScholarshipDiscountId = schoId;
            student.UnitsFailedLastYear = convertDecimal;
            student.DateAdmitted = System.DateTime.Now;
            student.Religion = cbReligion.Text;

            if (Op.Equals("edit"))
            {
                ret = studentService.UpdateStudent(ref student, ref message);
                Log("U", "Students", student);

            }
            else
            {
                ret = studentService.CreateStudent(ref student, ref message);
                Log("C", "Students", student);

            }
            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }
Example #49
0
        public void starttahthingy()
        {
            IStudentService x = new StudentServiceClient();

            int funcController = 0;

            while (funcController != 6)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("\n Welcome to the student registry. \n Press a number to access the function \n");
                Console.WriteLine(" 1. Add student");
                Console.WriteLine(" 2. Find student");
                Console.WriteLine(" 3. Remove student");
                Console.WriteLine(" 4. Edit student");
                Console.WriteLine(" 5. Get all student");
                Console.WriteLine(" 6. Exit \n");

                Console.ResetColor();

                try
                {
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Write("Input : ");
                    funcController = int.Parse(Console.ReadLine());
                }
                catch (Exception)
                {
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\n Value must be a number and not empty \n");
                    Console.ResetColor();
                }

                switch (funcController)
                {
                case 1:
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;

                    Console.Write("\n Enter id of new student : ");
                    int newStudentIdName = int.Parse(Console.ReadLine());

                    Console.Write("\n Enter last name of new student : ");
                    String newStudentLastName = Console.ReadLine();

                    Console.Write("\n Enter first name of new student : ");
                    String newStudentFirstName = Console.ReadLine();

                    Console.Write("\n Enter Adress of new student : ");
                    String newStudentAdress = Console.ReadLine();

                    Console.Write("\n Enter City of new student : ");
                    String newStudentCity = Console.ReadLine();

                    x.AddStudent(newStudentIdName, newStudentLastName, newStudentFirstName, newStudentAdress,
                                 newStudentCity);

                    Console.WriteLine($"\n {newStudentIdName} has been added to the registry \n");
                    Console.ReadKey();
                    Console.ResetColor();
                    break;

                case 2:
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Write("\n Enter name of student to find : ");
                    String findStudentName = Console.ReadLine();
                    Console.WriteLine($"\n {x.FindStudent(findStudentName)} \n");

                    Console.ReadKey();
                    Console.ResetColor();
                    break;

                case 3:
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Write("\n Enter name of student to remove : ");
                    String removeStudentName = Console.ReadLine();
                    x.RemoveStudent(removeStudentName);
                    Console.WriteLine($"\n {removeStudentName} has been removed from the registry \n");

                    Console.ReadKey();
                    Console.ResetColor();

                    break;

                case 4:
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Write("\n Enter name of the student you want to edit : ");
                    String editStudentValue1 = Console.ReadLine();
                    Console.Write("\n Enter new name of the student : ");
                    String editStudentValue2 = Console.ReadLine();
                    x.EditStudent(editStudentValue1, editStudentValue2);

                    Console.WriteLine($"\n {editStudentValue1} has been changed to {editStudentValue2} \n");
                    Console.ReadKey();
                    Console.ResetColor();
                    break;

                case 5:
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.WriteLine("\n All the students in the registry ");

                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Green;
                    foreach (var obj in x.GetAllStudents())
                    {
                        Console.WriteLine(
                            $" Id : {obj._personID} \n Last name : {obj._lastName} \n First name :  {obj._firstName} \n Adress : {obj._address} \n City : {obj._city} \n ");
                    }

                    Console.ReadKey();
                    Console.ResetColor();
                    break;
                }
            }
        }
        private void Save()
        {
            string szGender = string.Empty;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);

            StudentServiceClient studentService = new StudentServiceClient();

            Student student = new Student()
            {
                StudentId = txtStudentId.Text,
                FirstName = txtFirstName.Text,
                MiddleName = txtMiddleName.Text,
                LastName = txtLastName.Text,
                Image = bImage,
                SchoolLastAttended = txtSchoolLastAttended.Text,
                GradeLevel = cmbGradeLevel.Text,
                DOB = dtDOB.Value,
                MadrasahEnrolled = chkMadrasah.Checked,
                Card = chkReportCard.Checked,
                GoodMoral = chkGoodMoral.Checked,
                BirthCertificate = chkBirthCertificate.Checked,
                POBAddress = txtPOB_Street.Text,
                POBBarangay = txtPOB_Brgy.Text,
                POBProvince = txtPOB_Province.Text,
                POBTownCity = txtPOB_Town.Text,
                HomeAddress = txtHA_Street.Text,
                HomeProvince = txtHA_Province.Text,
                HomeBarangay = txtHA_Brgy.Text,
                HomeTownCity = txtHA_Town.Text,
                FathersName = txtFather_FullName.Text,
                FathersOccupation = txtFather_Occupation.Text,
                FathersAverageYearlyIncome = double.Parse(txtFather_Income.Text),
                FathersEducation = txtFather_EducAttainment.Text,
                MothersMaidenName = txtMother_FullName.Text,
                MothersEducation = txtMother_EducAttainment.Text,
                MothersOccupation = txtMother_Occupation.Text,
                MothersAverageYearlyIncome = double.Parse(txtMother_Income.Text),
                GuardiansName = txtGuardian_FullName.Text,
                GuardiansOccupation = txtGuardian_Occupation.Text,
                GuardiansAverageYearlyIncome = double.Parse(txtGuardian_Income.Text)
            };



            if (Op.Equals("edit"))
                ret = studentService.UpdateStudent(ref student, ref message);
            else
                ret = studentService.CreateStudent(ref student, ref message);

            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }