private void MouseDown_Save(object sender, MouseButtonEventArgs e) { //string sqlBase = @"UPDATE institutions SET title = ""{0}"", kind = {1}, address = ""{2}"", phone = ""{3}"" WHERE title = ""{4}"";"; string sqlBase = @"CALL update_inst(""{0}"", {1}, ""{2}"", ""{3}"", ""{4}"");"; string subSql = String.Format(@"SELECT ID FROM types WHERE kind = ""{0}""", comboBox.SelectedItem); Connection conn; conn = Connection.GetConnection(""); DataSet d1 = new DataSet(); d1 = conn.SelecteQuery(subSql); int kind = Convert.ToInt32(d1.Tables[0].Rows[0][0]); if (textBox_Title.Text.Length != 0 && textBox_Address.Text.Length != 0 && textBox_Phone.Text.Length != 0) { string newTitle = textBox_Title.Text; string newAddress = textBox_Address.Text; string newPhone = textBox_Phone.Text; string sqlMain = String.Format(sqlBase, newTitle, kind, newAddress, newPhone, pastTitle); if (conn.NonQuery(sqlMain) == 0) { MessageBox.Show("Error"); } Page_AdminPanel p = new Page_AdminPanel(); NavigationService.Navigate(p); } }
private void Image_MouseDown_1(object sender, MouseButtonEventArgs e) { string enteredPasswrod = passwordBox.Password; if (enteredPasswrod == password) { Page_AdminPanel p = new Page_AdminPanel(); NavigationService.Navigate(p); } else { passwordBox.Password = ""; } }
private void MouseDown_Delete(object sender, MouseButtonEventArgs e) { //string sql = String.Format(@"DELETE FROM institutions WHERE title = ""{0}""", pastTitle); string sql = String.Format(@"CALL delete_inst(""{0}"");", pastTitle); Connection conn; conn = Connection.GetConnection(""); conn.NonQuery(sql); Page_AdminPanel p = new Page_AdminPanel(); NavigationService.Navigate(p); }
private void MouseDown_Save(object sender, MouseButtonEventArgs e) { //string sqlBase = @"UPDATE medicine SET price = {0} WHERE title = ""{1}"""; string sqlBase = @"CALL update_cost({0}, ""{1}"");"; Connection conn; conn = Connection.GetConnection(""); string newCost = textBox_NewCost.Text; newCost = newCost.Replace(",", "."); string sql = String.Format(sqlBase, newCost, med); Page_AdminPanel p = new Page_AdminPanel(); NavigationService.Navigate(p); }
private void MouseDown_AdminPanel(object sender, MouseButtonEventArgs e) { Page_AdminPanel p = new Page_AdminPanel(); NavigationService.Navigate(p); }