예제 #1
0
        private void FindStud_btn_Click(object sender, EventArgs e)
        {
            RemoveList.Items.Clear();

            var snfield = FindStudField.Text;

            using (StudentsServiceAppClient client = new StudentsServiceAppClient())
            {
                foreach (var item in client.StudetsInfoList())
                {
                    if (item.LastName == snfield)
                    {
                        string[] row =
                        {
                            item.Id.ToString(),        item.FirstName, item.Surname, item.LastName, item.Sex,
                            item.Age.ToString(),
                            item.Birthdate.ToString(),
                            string.Join(", ",          item.StudentPhones?.Select(x => x.PhoneNumber.ToString()))
                        };
                        var listView = new ListViewItem(row);
                        RemoveList.Items.Add(listView);
                    }
                }
            }
        }
예제 #2
0
        private void RemoveStud_btn_Click(object sender, EventArgs e)
        {
            try
            {
                int idStud = Convert.ToInt32(RemoveStudByIdField.Text);

                using (StudentsServiceAppClient client = new StudentsServiceAppClient())
                {
                    foreach (var item in client.StudetsInfoList())
                    {
                        if (item.Id == idStud)
                        {
                            client.DeleteStudentById(idStud);
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); }
        }
예제 #3
0
        public void LoadValueFromService()
        {
            listViewAllStud.Items.Clear();
            using (var client = new StudentsServiceAppClient())
            {
                foreach (var item in client.StudetsInfoList())
                {
                    string   phones = string.Join(", ", item.StudentPhones?.Select(x => x.PhoneNumber).ToList());
                    string[] row    =
                    {
                        item.Id.ToString(),        item.FirstName,
                        item.Surname,              item.LastName, item.Sex,item.Age.ToString(),
                        item.Birthdate.ToString(), phones
                    };

                    var listViewItem = new ListViewItem(row);
                    listViewAllStud.Items.Add(listViewItem);
                }
            }
        }
예제 #4
0
        private void findStudentById_btn_Click(object sender, EventArgs e)
        {
            LastNameStudField.Text        = "";
            NameStudField.Text            = "";
            SurnameStudField.Text         = "";
            AgeStudField.Text             = "";
            BirthDateStudField.Text       = "";
            AddressStudField.Text         = "";
            ProgressStudField.Text        = "";
            GroupStudField.Text           = "";
            NumbStudCertificateField.Text = "";
            StPhoneGridView.Rows.Clear();
            EditAdditionalRelGridView.Rows.Clear();
            EditRelInfoGridView.Rows.Clear();
            RelPhonesTable.Items.Clear();

            var id = Convert.ToInt32(InputIDTextBox.Text);

            using (StudentsServiceAppClient client = new StudentsServiceAppClient())
            {
                foreach (var item in client.StudetsInfoList())
                {
                    if (item.Id == id)
                    {
                        ShowIdField.Text              = item.Id.ToString();
                        LastNameStudField.Text        = item.LastName;
                        NameStudField.Text            = item.FirstName;
                        SurnameStudField.Text         = item.Surname;
                        AgeStudField.Text             = item.Age.ToString();
                        BirthDateStudField.Text       = item.Birthdate.ToString();
                        AddressStudField.Text         = item.Adress.Address;
                        ProgressStudField.Text        = item.StudentProgress.Progress.ToString();
                        GroupStudField.Text           = item.Group.Speciality;
                        NumbStudCertificateField.Text = item.NumberRecordBook.ToString();
                        string phonesStud = string.Join(", ", item.StudentPhones?.Select(x => x.PhoneNumber.ToString()));
                        StPhoneGridView.Rows.Add(phonesStud);

                        string name  = string.Join(",", item.ParentsInfo?.Select(x => x.FirstName));
                        string lName = string.Join(",", item.ParentsInfo?.Select(x => x.LastName));
                        string lid   = string.Join(",", item.ParentsInfo?.Select(x => x.Id));
                        string spec  = string.Join(",", item.ParentsInfo?.Select(x => x.WorkPlace));

                        string additionalRelId    = string.Join(",", item.ParentsInfo?.Select(x => x.Relation.Id.ToString()));
                        string additionalRelation = string.Join(",", item.ParentsInfo?.Select(x => x.Relation.Name).ToList());

                        string[] splitString1 = lName.Split(',');
                        string   motherLName  = splitString1[0].Trim();
                        string   fatherLName  = splitString1[1].Trim();

                        string[] splitStringId = lid.Split(',');
                        string   motherId      = splitStringId[0].Trim();
                        string   fatherId      = splitStringId[1].Trim();

                        string[] splitString = name.Split(',');
                        string   motherFName = splitString[0].Trim();
                        string   fatherFName = splitString[1].Trim();

                        string[] splitString3 = spec.Split(',');
                        string   motherSpec   = splitString3[0].Trim();
                        string   fatherSpec   = splitString3[1].Trim();

                        string[] splitString4     = additionalRelId.Split(',');
                        string[] relString        = additionalRelation.Split(',');
                        string   additionalRels   = relString[0].Trim();
                        string   additionalRelsId = splitString4[1].Trim();

                        string[] motherInforow       = { motherLName, motherFName, motherSpec, motherId };
                        string[] fatherInforow       = { fatherLName, fatherFName, fatherSpec, fatherId };
                        string[] additionalRelations = { additionalRels, additionalRelsId };

                        EditRelInfoGridView.Rows.Add(motherInforow);
                        EditRelInfoGridView.Rows.Add(fatherInforow);
                        EditAdditionalRelGridView.Rows.Add(additionalRelations);

                        var RelClient = new StudentsServiceAppClient();
                        foreach (var item2 in RelClient.ParentsInfosInfoList())
                        {
                            string   phonesRelations = string.Join(",", item2.Phones.Select(x => x.PhoneNumber.ToString()));
                            string[] phoneRow        = phonesRelations.Split(',');
                            string   phoneRel        = phoneRow[0].Trim();

                            var Row = new ListViewItem(phoneRel);
                            RelPhonesTable.Items.Add(Row);
                        }
                    }
                }
            }
        }
예제 #5
0
        private void FindStudentByLastName_Click(object sender, EventArgs e)
        {
            listViewStud.Items.Clear();
            secondRow.Items.Clear();
            motherInfoList.Items.Clear();
            fatherInfo.Items.Clear();
            additionalRel.Items.Clear();
            relationsPhones.Items.Clear();

            var id = Convert.ToInt32(IDStudTextBox.Text);

            using (StudentsServiceAppClient client = new StudentsServiceAppClient())
            {
                foreach (var item in client.StudetsInfoList())
                {
                    if (item.Id == id)
                    {
                        string[] row =
                        {
                            item.Id.ToString(),        item.FirstName, item.Surname, item.LastName, item.Sex,
                            item.Age.ToString(),
                            item.Birthdate.ToString(),
                            string.Join(", ",          item.StudentPhones?.Select(x => x.PhoneNumber.ToString()))
                        };

                        string[] row2 =
                        {
                            item.NumberRecordBook.ToString(), item.Adress.Address, item.StudentProgress.Progress.ToString(), item.Group.Speciality
                        };

                        string name  = string.Join(",", item.ParentsInfo?.Select(x => x.FirstName));
                        string lName = string.Join(",", item.ParentsInfo?.Select(x => x.LastName));
                        string spec  = string.Join(",", item.ParentsInfo?.Select(x => x.WorkPlace));
                        string additionalRelation = string.Join(",", item.ParentsInfo?.Select(x => x.Relation.Name).ToList());

                        string[] splitString = name.Split(',');
                        string   motherFName = splitString[0].Trim();
                        string   fatherFName = splitString[1].Trim();

                        string[] splitString1 = lName.Split(',');
                        string   motherLName  = splitString1[0].Trim();
                        string   fatherLName  = splitString1[1].Trim();

                        string[] splitString3 = spec.Split(',');
                        string   motherSpec   = splitString3[0].Trim();
                        string   fatherSpec   = splitString3[1].Trim();

                        string[] splitString4   = additionalRelation.Split(',');
                        string   additionalRels = splitString4[0].Trim();

                        string[] row3 = { motherFName, motherLName, motherSpec };
                        string[] row4 = { fatherFName, fatherLName, fatherSpec };

                        var listView = new ListViewItem(row);
                        listView.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                        listViewStud.Items.Add(listView);
                        var listView1 = new ListViewItem(row2);
                        listView1.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                        secondRow.Items.Add(listView1);
                        var listView3 = new ListViewItem(row3);
                        listView3.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                        motherInfoList.Items.Add(listView3);
                        var listView4 = new ListViewItem(row4);
                        listView4.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                        fatherInfo.Items.Add(listView4);
                        var listView5 = new ListViewItem(additionalRels);
                        listView5.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                        additionalRel.Items.Add(listView5);

                        var Pclient = new StudentsServiceAppClient();
                        foreach (var item1 in Pclient.ParentsInfosInfoList())
                        {
                            string   phonesPar    = string.Join(",", item1.Phones.Select(x => x.PhoneNumber.ToString()).ToList());
                            string[] splitString6 = phonesPar.Split(',');
                            string   phoneRel     = splitString6[0].Trim();
                            var      listView6    = new ListViewItem(phoneRel);
                            listView6.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
                            relationsPhones.Items.Add(listView6);
                        }
                    }
                }
            }
        }