Ejemplo n.º 1
0
        private void btnGetSchool_Click(object sender, EventArgs e)
        {
            GiaoDucClient client = new GiaoDucClient();

            client.ClientCredentials.UserName.UserName = this.username;
            client.ClientCredentials.UserName.Password = this.password;
            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

            BindingList <SchoolProfile> sPList = new BindingList <SchoolProfile>();

            try
            {
                arrSchool = client.GetSchoolProfile();
                client.Close();
                for (int i = 0; i < arrSchool.Length; i++)
                {
                    sPList.Add(arrSchool[i]);
                }

                labelNumberSchool.Text = "Tổng số trường: " + arrSchool.Length;
                schoolProfileBindingSource.DataSource = sPList;
            }
            catch (Exception es)
            {
                MessageBox.Show(es.ToString(), "Lỗi kết nối đến máy chủ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btnGetDataStudent_Click(object sender, EventArgs e)
        {
            //listStudent.Clear();
            //dataGridViewStudent.Rows.Clear();
            //dataGridViewStudent.Refresh();

            GiaoDucClient client = new GiaoDucClient();

            client.ClientCredentials.UserName.UserName = this.username;
            client.ClientCredentials.UserName.Password = this.password;
            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;


            BindingList <PupilProfile> listStudentBiding = new BindingList <PupilProfile>();

            try
            {
                Item           itemSelect = comboBoxSchoolStudent.SelectedItem as Item;
                PupilProfile[] arrStudent = client.GetPupilProfile(itemSelect.value, 2017, 2000, 1);
                client.Close();

                labelSumStudent.Text = "Tổng số học sinh: " + arrStudent.Length;
                for (int i = 0; i < arrStudent.Length; i++)
                {
                    Console.WriteLine("\n" + arrStudent[i].PupilCode);
                    listStudent.Add(arrStudent[i]);
                }


                listStudent.Sort(new NameComparer());
                //listStudentBiding = listStudent;
                //labelNumberSchool.Text = "Tổng số trường: " + arrSchool.Length;
                pupilProfileBindingSource.DataSource = listStudent;
                MessageBox.Show("Dkm thành công !!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            catch (NullReferenceException)
            {
                MessageBox.Show("Chọn trường trong danh sách ", "Lỗi con mẹ nó rồi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception es)
            {
                MessageBox.Show(es.ToString(), "Lỗi kết nối đến máy chủ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void btnGetDataEmployee_Click(object sender, EventArgs e)
        {
            GiaoDucClient client = new GiaoDucClient();

            client.ClientCredentials.UserName.UserName = this.username;
            client.ClientCredentials.UserName.Password = this.password;
            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

            BindingList <Employee> eList = new BindingList <Employee>();

            try
            {
                //lấy truongID từ combobox
                Item item = (Item)comboBoxSchoolEmployee.SelectedItem;
                //Debug.Print(item.value.ToString());
                arrEmployee = client.GetEmployee(item.value);


                client.Close();
                for (int i = 0; i < arrEmployee.Length; i++)
                {
                    eList.Add(arrEmployee[i]);
                }
                //eList.ToList<Employee>().Sort(new Nam);
                labelNumberSchool.Text           = "Tổng số trường: " + arrSchool.Length;
                employeeBindingSource.DataSource = eList;
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Chọn trường trong danh sách ", "Lỗi con mẹ nó rồi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception es)
            {
                MessageBox.Show(es.ToString(), "Lỗi kết nối đến máy chủ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }