private void btnUpDateContact_Click(object sender, RoutedEventArgs e) { ServiceDocEleksDBClient service = new ServiceDocEleksDBClient(); Contact row = (Contact)dataGridViewContacts.SelectedItem; Contact contact = new Contact(); contact.FirstN = txtFirsN.Text; contact.LastN = txtLastN.Text; contact.MiddleN = txtMiddleN.Text; contact.PhoneNum = txtPhoneNum.Text; contact.Adress = txtAdress.Text; contact.UserId = GetUserId; contact.ContactId = row.ContactId; if (service.UpdateContact(contact) == 1) { this.dataGridViewContacts.Items.Refresh(); MessageBox.Show("Запис успішно змінено!"); } }
//Подія оновлення запису в БД private void btnUpdate_Click_1(object sender, EventArgs e) { ServiceDocEleksDBClient service = new ServiceDocEleksDBClient(); Contact contact = new Contact(); contact.FirstN = txtFirstName.Text; contact.LastN = txtLastName.Text; contact.MiddleN = txtMiddleName.Text; contact.PhoneNum = txtPhoneNum.Text; contact.Adress = txtAdress.Text; contact.UserId = GetUserId; contact.ContactId = (short)dataGridViewContacts.SelectedRows[0].Cells[5].Value; if (service.UpdateContact(contact) == 1) { MessageBox.Show("Запис успішно змінено!"); RefreshGrid(); DisplayContacts(); } }
private void btnUpDateContact_Click(object sender, RoutedEventArgs e) { ServiceDocEleksDBClient service = new ServiceDocEleksDBClient(); Contact row = (Contact)dataGridViewContacts.SelectedItem; Contact contact = new Contact(); contact.FirstN = txtFirsN.Text; contact.LastN = txtLastN.Text; contact.MiddleN = txtMiddleN.Text; contact.PhoneNum = txtPhoneNum.Text; contact.Adress = txtAdress.Text; contact.UserId = GetUserId; contact.ContactId = row.ContactId; if (service.UpdateContact(contact) == 1) { this.dataGridViewContacts.Items.Refresh(); MessageBox.Show("Запис успішно змінено!"); } }
//Подія оновлення запису в БД private void btnUpdate_Click_1(object sender, EventArgs e) { ServiceDocEleksDBClient service = new ServiceDocEleksDBClient(); Contact contact = new Contact(); contact.FirstN = txtFirstName.Text; contact.LastN = txtLastName.Text; contact.MiddleN = txtMiddleName.Text; contact.PhoneNum = txtPhoneNum.Text; contact.Adress = txtAdress.Text; contact.UserId = GetUserId; contact.ContactId = (short) dataGridViewContacts.SelectedRows[0].Cells[5].Value; if (service.UpdateContact(contact) == 1) { MessageBox.Show("Запис успішно змінено!"); RefreshGrid(); DisplayContacts(); } }