コード例 #1
0
        private void SetFieldsUpdateFormContact()
        {
            var gettingContact = _crudStudent.GetContact(_currentRowContactIndex);

            TypeContactComboBox.Text =
                DictionaryForRefreshDataTables.GetContactTypeEnumToString(gettingContact.contactType);
            stringMaskedTextBox.Text = gettingContact.contactValue;
        }
コード例 #2
0
 private void RefreshDataTableContacts(Student student, DataTable dataContacts)
 {
     dataContacts.Rows.Clear();
     foreach (var element in student.contactsList)
     {
         dataContacts.Rows.Add(DictionaryForRefreshDataTables.GetContactTypeEnumToString(element.contactType),
                               element.contactValue);
     }
 }
コード例 #3
0
        private void SetFieldsUpdateFormAdress()
        {
            var gettingAdress = _crudStudent.GetAdress(_currentRowAdressIndex);

            TypeAdressComboBox.Text     = DictionaryForRefreshDataTables.GetAdressTypeEnumToString(gettingAdress.adressType);
            StreetTextBox.Text          = gettingAdress.street;
            CityTextBox.Text            = gettingAdress.city;
            PostIndexMaskedTextBox.Text = gettingAdress.postindex;
        }
コード例 #4
0
        private void RefreshDataTableAdress(Student student, DataTable dataTableAdress)
        {
            dataTableAdress.Rows.Clear();

            foreach (var element in student.addressList)
            {
                dataTableAdress.Rows.Add(DictionaryForRefreshDataTables.GetAdressTypeEnumToString(element.adressType),
                                         element.city, element.postindex, element.street);
            }
        }
コード例 #5
0
        private void AddRowsDataTableContact(List <Contact> contact, DataTable dataTable)
        {
            dataTable.Rows.Clear();

            foreach (var element in contact)
            {
                dataTable.Rows.Add(DictionaryForRefreshDataTables.GetContactTypeEnumToString(element.contactType),
                                   element.contactValue);
            }
        }
コード例 #6
0
        private void AddRowsDataTableAdress(List <Adress> adressList, DataTable dataTable)
        {
            dataTable.Rows.Clear();

            foreach (var element in adressList)
            {
                dataTable.Rows.Add(DictionaryForRefreshDataTables.GetAdressTypeEnumToString(element.adressType),
                                   element.city, element.postindex, element.street);
            }
        }
コード例 #7
0
        /// <summary>
        /// Вспомогательные функции для работы с формой
        /// </summary>

        #region SuportingFunctions
        private void CreateAndAddRowContact()
        {
            var contactType = DictionaryForRefreshDataTables.GetContactTypeByValueContactTypeCombobox(_contactType);
            var newContact  = new Contact {
                contactType = contactType, contactValue = _stringContact
            };

            _crudStudent.CreateNewContact(newContact);

            AddRowsDataTableContact(_crudStudent.GetContactList(), _dataTableContact);
        }
コード例 #8
0
        private void CreateAndAddRowAdress()
        {
            AdressType adressType = DictionaryForRefreshDataTables.GetAdressTypeByValueAdressTypeComboBox(_typeAdress);
            Adress     newAdress  = new Adress()
            {
                adressType = adressType,
                city       = _cityProperty,
                postindex  = _porsIndexProperty,
                street     = _streetProperty
            };

            _crudStudent.CreateNewAdress(newAdress);

            AddRowsDataTableAdress(_crudStudent.GetAdressList(), _dataTableAdress);
        }
コード例 #9
0
        private void UpdateFromDataTableContact()
        {
            var contactType =
                DictionaryForRefreshDataTables.GetContactTypeByValueContactTypeCombobox(TypeContactComboBox.Text);
            var contact = stringMaskedTextBox.Text;

            var newContact = new Contact()
            {
                contactType = contactType, contactValue = contact
            };
            var thisDeleteContact = _crudStudent.GetContact(_currentRowContactIndex);

            _crudStudent.DeleteCurrentContact(thisDeleteContact);
            _crudStudent.UpdateCurrentContact(thisDeleteContact, newContact, _currentRowContactIndex);

            AddRowsDataTableContact(_crudStudent.GetContactList(), _dataTableContact);
        }
コード例 #10
0
        private void UpdateFromDataTableAdress()
        {
            var adressType = DictionaryForRefreshDataTables.GetAdressTypeByValueAdressTypeComboBox(TypeAdressComboBox.Text);
            var city       = CityTextBox.Text;
            var street     = StreetTextBox.Text;
            var postIndex  = PostIndexMaskedTextBox.Text;

            var newAdress = new Adress()
            {
                adressType = adressType,
                city       = city,
                postindex  = postIndex,
                street     = street
            };
            var thisDeleteAdress = _crudStudent.GetAdress(_currentRowAdressIndex);

            _crudStudent.UpdateCurrentAdress(thisDeleteAdress, newAdress, _currentRowAdressIndex);

            AddRowsDataTableAdress(_crudStudent.GetAdressList(), _dataTableAdress);
        }