///<summary> ///Metoda zapisująca dane w tabeli Badanie. ///</summary> ///<remarks> ///Metoda zapisuję dane po sprawdzeniu czy wszystkie pola są wypełnione </remarks> ///<param name="sender">obiekt wywołujący zdarzenie </param> ///<param name="e"> parametr przysyłający dane do zainicjalizowania zdarzeń w metodzie </param> private void Umow_Click(object sender, RoutedEventArgs e) { if (PacjentComboBox2.Text == "") { MessageBox.Show("Wybierz pacjenta"); PacjentComboBox2.Focus(); } else if (BadanieComboBox2.Text == "") { MessageBox.Show("Wybierz badanie"); BadanieComboBox2.Focus(); } else if (DatePicker2.Text == "") { MessageBox.Show("Wprowadź datę"); DatePicker2.Focus(); } else { SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["masterDB"].ConnectionString; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Insert into Badanie (Pacjent, Badanie, Data) values (@Pacjent, @Badanie, @Data)"; cmd.Connection = con; cmd.Parameters.AddWithValue("@Pacjent", PacjentComboBox2.Text); cmd.Parameters.AddWithValue("@Badanie", BadanieComboBox2.Text); cmd.Parameters.AddWithValue("@Data", DatePicker2.SelectedDate); cmd.Connection = con; con.Open(); int a = cmd.ExecuteNonQuery(); if (a == 1) { MessageBox.Show("Dane dodane prawidłowo"); } con.Close(); } }
public SendPushPage() { InitializeComponent(); DatePicker2.MinimumDate = DatePicker.Date; Frame.SetAppThemeColor(PancakeView.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.Transparent); switch (Device.RuntimePlatform) { case Device.iOS: int statusBarHeight = DependencyService.Get <IStatusBar>().GetHeight(); //if (DeviceDisplay.MainDisplayInfo.Width < 700) // mainStack.Padding = new Thickness(0, statusBarHeight * 2, 0, 0); //else mainStack.Padding = new Thickness(0, statusBarHeight, 0, 0); break; case Device.Android: double or = Math.Round(((double)App.ScreenWidth / (double)App.ScreenHeight), 2); if (Math.Abs(or - 0.5) < 0.02) { //ScrollViewContainer.Margin = new Thickness(0, 0, 0, -150); } break; default: break; } getGroups(); NavigationPage.SetHasNavigationBar(this, false); var profile = new TapGestureRecognizer(); profile.Tapped += async(s, e) => { if (Navigation.NavigationStack.FirstOrDefault(x => x is ProfilePage) == null) { await Navigation.PushAsync(new ProfilePage()); } }; IconViewProfile.GestureRecognizers.Add(profile); UkName.Text = Settings.MobileSettings.main_name; var backClick = new TapGestureRecognizer(); backClick.Tapped += async(s, e) => { try { _ = await Navigation.PopAsync(); } catch { } }; var techSend = new TapGestureRecognizer(); techSend.Tapped += async(s, e) => { if (Settings.Person != null && !string.IsNullOrWhiteSpace(Settings.Person.Phone)) { await Navigation.PushModalAsync(new AppPage()); } else { await PopupNavigation.Instance.PushAsync(new EnterPhoneDialog()); } }; LabelTech.GestureRecognizers.Add(techSend); Color hexColor = (Color)Application.Current.Resources["MainColor"]; //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White); // var takeOS = new TapGestureRecognizer(); // // takeOS.Tapped += async (s, e) => // { // var action = await DisplayActionSheet(AppResources.OsTake, AppResources.Cancel, null, // "Android", "iOS", AppResources.All); // if (action != null && !action.Equals(AppResources.Cancel)) // { // _os = action; // LabelKindOs.Text = action; // } // }; // StackLayoutOs.GestureRecognizers.Add(takeOS); var takeDate = new TapGestureRecognizer(); takeDate.Tapped += async(s, e) => { Device.BeginInvokeOnMainThread(() => DatePicker.Focus()); }; StackLayoutDate.GestureRecognizers.Add(takeDate); var takeDuty = new TapGestureRecognizer(); takeDuty.Tapped += async(s, e) => ButtonDuty_OnClicked(FrameDuty, null); FrameDuty.GestureRecognizers.Add(takeDuty); var takeRyon = new TapGestureRecognizer(); takeRyon.Tapped += async(s, e) => ButtonRyon_OnClicked(FrameRyon, null); FrameRyon.GestureRecognizers.Add(takeRyon); var takeIdent = new TapGestureRecognizer(); takeIdent.Tapped += async(s, e) => ButtonIdent_OnClicked(FrameIdent, null); FrameIdent.GestureRecognizers.Add(takeIdent); var takeHouse = new TapGestureRecognizer(); takeHouse.Tapped += async(s, e) => ButtonHouse_OnClicked(FrameHouse, null); FrameHouse.GestureRecognizers.Add(takeHouse); var takeDate2 = new TapGestureRecognizer(); takeDate2.Tapped += async(s, e) => { Device.BeginInvokeOnMainThread(() => DatePicker2.Focus()); }; StackLayoutDate2.GestureRecognizers.Add(takeDate2); var kind = new TapGestureRecognizer(); kind.Tapped += async(s, e) => { var action = await DisplayActionSheet(AppResources.Takes, AppResources.Cancel, null, AppResources.ToRayon, AppResources.ByHome, AppResources.ByLS, AppResources.ByDuty); if (action != null && !action.Equals(AppResources.Cancel)) { LabelKind.Text = action; SetKind(action); } }; StackLayoutKind.GestureRecognizers.Add(kind); BackStackLayout.GestureRecognizers.Add(backClick); }