private void Button_Click(object sender, RoutedEventArgs e) { Page2Find adding = new Page2Find { frame = this.frame }; //Передача в presenter чтобы не был пустым frame.Content = adding; }
private void SavingButton(object sender, RoutedEventArgs e) { MainWindow.studInfo[index].Name = txname.Text; MainWindow.studInfo[index].Surname = txsurname.Text; MainWindow.studInfo[index].Dadname = txdadname.Text; MainWindow.studInfo[index].Group = txgroup.Text; MainWindow.studInfo[index].Mphone = Convert.ToInt32(txmob.Text); MainWindow.studInfo[index].Hphone = Convert.ToInt32(txhom.Text); MainWindow.studInfo[index].Adress = txadress.Text; int uniqueID = MainWindow.studInfo[index].Id; string name = txname.Text; string surname = txsurname.Text; string dadname = txdadname.Text; int group = Convert.ToInt32(txgroup.Text); int mphone = Convert.ToInt32(txmob.Text); int hphone = Convert.ToInt32(txhom.Text); string adress = txadress.Text; string connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=phones;Integrated Security=True"; string sqlExpression = "UPDATE studTables SET Name='" + name + "', Surname='" + surname + "', Dadname='" + dadname + "', [Group]=" + group + ", Mphone=" + mphone + ", Hphone=" + hphone + ", Adress='" + adress + "'WHERE Id=" + uniqueID; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(sqlExpression, connection); int number = command.ExecuteNonQuery(); MessageBox.Show("Обновлено объектов: " + number); } Page2Find adding = new Page2Find { frame = this.frame }; //Передача в presenter чтобы не был пустым frame.Content = adding; MessageBox.Show(Convert.ToString(index)); // MainWindow.studInfo[FileInfoView.SelectedIndex].Surname //MainWindow.studInfo[FileInfoView.SelectedIndex].Dadname // Convert.ToString(MainWindow.studInfo[FileInfoView.SelectedIndex].Group) // Convert.ToString(MainWindow.studInfo[FileInfoView.SelectedIndex].Mphone) // Convert.ToString(MainWindow.studInfo[FileInfoView.SelectedIndex].Hphone) // MainWindow.studInfo[FileInfoView.SelectedIndex].Adress }