private void Lista_Loaded(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); var listunia = (from Wizyty in register.Wizyty select new { Wizyty.data, Wizyty.godzina }).ToArray(); lista.ItemsSource = listunia; }
private void Button_Click_1(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 reg = new RegisterAndLoginEntities2(); //Sprawdzenie czy login i haslo poprawne if (login.Text != string.Empty) { var user = reg.Konto.FirstOrDefault(a => a.login.Equals(login.Text) && a.password.Equals (password.Password.ToString())); if (user != null) { var userinio = (from Konto in reg.Konto where (Konto.login == login.Text && Konto.password == password.Password.ToString()) select new { Konto.Imie, Konto.Nazwisko }).ToArray(); Window2 window = new Window2(); Zalgowany.id = user.id; string zalogowany = "Zalogowany: " + userinio[0].Imie + " " + userinio[0].Nazwisko; window.zalogowany.Content = zalogowany; window.Show(); this.Close(); } else { MessageBox.Show("Podany login lub hasło są nieprawidłowe"); } } }
private void Kalendarz_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Calendar cld = sender as Calendar; if (cld.SelectedDate.HasValue) { RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); DateTime fww = Convert.ToDateTime(cld.ToString()); var daty = from Wizyty in register.Wizyty where Wizyty.data == fww select Wizyty.godzina; List <string> lista = new List <string>(); lista = daty.ToList(); Thickness margin = stakus.Margin; for (int k = 0; k < daty.Count(); k++) { Button btn = new Button(); btn.Content = lista[k]; btn.Name = "b" + k; btn.Height = 30; btn.Width = 100; btn.Background = Brushes.Blue; btn.Click += button_Click; stakus.Children.Add(btn); } // combo.Visibility = Visibility.Visible; } }
private void Kalendarz_Loaded(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); kalendarz.SelectionMode = CalendarSelectionMode.MultipleRange; var daty = from Wizyty in register.Wizyty select Wizyty.data; var wynik = daty.Distinct(); List <string> lista = new List <string>(); foreach (DateTime dat in wynik) { lista.Add(dat.ToShortDateString()); } int j = 0; for (int i = 1; i < 32; i++) { if (lista[j] == (i + ".07.2019")) { if (j + 1 < lista.Count) { j++; } } else { kalendarz.BlackoutDates.Add(new CalendarDateRange(new DateTime(2019, 7, i))); } } }
private void ComboBox_Loaded(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); var osoba = from Konto in register.Konto select new { Konto.Imie, Konto.Nazwisko }; //Loading firstname, lastname to combox listaa.ItemsSource = osoba.ToList(); }
private void Button_Click(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 reg = new RegisterAndLoginEntities2(); var Wizyty = new Wizyty { data = Convert.ToDateTime(data.Text), godzina = godzina.Text }; reg.Wizyty.Add(Wizyty); reg.SaveChanges(); }
private void Button_Click(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); var lista = (from Wizyty in register.Wizyty select Wizyty.id).ToArray(); int id = lista[index]; var Szczegoly = new Szczegoly { Lekarz = lekarz.Text, Szczegoly1 = szczeoly.Text, idWizyty = id }; register.Szczegoly.Add(Szczegoly); register.SaveChanges(); }
private void Czab1_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox combox = (ComboBox)sender; ComboBoxItem cmb = (ComboBoxItem)combox.SelectedItem; //Geting state of combobox string wiad = cmb.Content.ToString(); string nazwaElipsy = combox.Name.Substring(1, combox.Name.Length - 1); //Setting name elipse to color teeth Ellipse ellipse = FindName(nazwaElipsy) as Ellipse; SolidColorBrush colorBrush = new SolidColorBrush(); RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); // Changing color teeh if (wiad == "Chory") { ellipse.Opacity = 0.5; colorBrush.Color = Colors.Red; ellipse.Fill = colorBrush; } else if (wiad == "Wyeczony") { ellipse.Opacity = 0.5; colorBrush.Color = Colors.LightGreen; ellipse.Fill = colorBrush; } else if (wiad == "Brak") { ellipse.Opacity = 0.5; colorBrush.Color = Colors.Black; ellipse.Fill = colorBrush; } else if (wiad == "Zdrowy") { ellipse.Opacity = 0; colorBrush.Color = Colors.Transparent; ellipse.Fill = colorBrush; } //After setting value change state to hidden combox.Visibility = Visibility.Hidden; }
private void Button_Click(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 reg = new RegisterAndLoginEntities2(); var konto = new Konto { Imie = imie.Text, Nazwisko = nazwisko.Text, Email = Email.Text, login = nazwaUzyt.Text, password = password1.Password.ToString() }; var user = reg.Konto.FirstOrDefault(a => a.login.Equals(nazwaUzyt.Text)); var user1 = reg.Konto.FirstOrDefault(a => a.Email.Equals(Email.Text)); if (user == null && user1 == null && error == false) { reg.Konto.Add(konto); reg.SaveChanges(); MessageBox.Show("Udalo sie kurwa"); MainWindow main = new MainWindow(); main.Show(); this.Close(); } if (user != null) { Llogin.Visibility = Visibility.Visible; Blogin.Background = Brushes.Red; Llogin.Content = "Podana nazwa użytkownika występuje już w systemie"; error = true; } if (user1 != null) { LEmail.Visibility = Visibility.Visible; Bemail.Background = Brushes.Red; LEmail.Content = "Podana mail już istnieje"; error = true; } }
private void Button_Click(object sender, RoutedEventArgs e) { //Connecting databese RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); // Geting state from View var Zeby = new Zeby { zab1 = Czab1.Text, zab2 = Czab2.Text, zab3 = Czab3.Text, zab4 = Czab4.Text, zab5 = Czab5.Text, zab6 = Czab6.Text, zab7 = Czab7.Text, zab8 = Czab8.Text, zab9 = Czab9.Text, zab10 = Czab10.Text, zab11 = Czab11.Text, zab12 = Czab12.Text, zab13 = Czab13.Text, zab14 = Czab14.Text, zab15 = Czab15.Text, zab16 = Czab16.Text, zab17 = Czab17.Text, zab18 = Czab18.Text, zab19 = Czab19.Text, zab20 = Czab20.Text, zab21 = Czab21.Text, zab22 = Czab22.Text, zab23 = Czab23.Text, zab24 = Czab24.Text, zab25 = Czab25.Text, zab26 = Czab26.Text, zab27 = Czab27.Text, zab28 = Czab28.Text, zab29 = Czab29.Text, zab30 = Czab30.Text, zab31 = Czab31.Text, zab32 = Czab32.Text, userId = id }; //Checking exist id in table Zeby var querry = register.Zeby.Where(x => x.userId == id).FirstOrDefault(); // Update if (querry != null) { querry.zab1 = Czab1.Text; querry.zab2 = Czab2.Text; querry.zab3 = Czab3.Text; querry.zab4 = Czab4.Text; querry.zab5 = Czab5.Text; querry.zab6 = Czab6.Text; querry.zab7 = Czab7.Text; querry.zab8 = Czab8.Text; querry.zab9 = Czab9.Text; querry.zab10 = Czab10.Text; querry.zab11 = Czab11.Text; querry.zab12 = Czab12.Text; querry.zab13 = Czab13.Text; querry.zab14 = Czab14.Text; querry.zab15 = Czab15.Text; querry.zab16 = Czab16.Text; querry.zab17 = Czab17.Text; querry.zab18 = Czab18.Text; querry.zab19 = Czab19.Text; querry.zab20 = Czab20.Text; querry.zab21 = Czab21.Text; querry.zab22 = Czab22.Text; querry.zab23 = Czab23.Text; querry.zab24 = Czab24.Text; querry.zab25 = Czab25.Text; querry.zab26 = Czab26.Text; querry.zab27 = Czab26.Text; querry.zab28 = Czab28.Text; querry.zab29 = Czab29.Text; querry.zab30 = Czab30.Text; querry.zab31 = Czab31.Text; querry.zab32 = Czab32.Text; register.Entry(querry).State = System.Data.Entity.EntityState.Modified; register.SaveChanges(); } // Save else { register.Zeby.Add(Zeby); register.SaveChanges(); } }
private void Listaa_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox combobox = (ComboBox)sender; string nazwa = combobox.SelectedValue.ToString(); string imie = nazwa.Substring(8, nazwa.IndexOf(",")); int index = imie.IndexOf(","); imie = imie.Substring(0, index); string nazwisko = nazwa.Substring(nazwa.IndexOf("Nazwisko =") - 1); int index2 = nazwisko.IndexOf("="); nazwisko = nazwisko.Remove(0, 11); nazwisko = nazwisko.Remove(nazwisko.Length - 2, 2); imie = imie.Remove(0, 1); nazwisko = nazwisko.Remove(0, 1); RegisterAndLoginEntities2 register = new RegisterAndLoginEntities2(); var querry = (from Konto in register.Konto where Konto.Imie == imie && Konto.Nazwisko == nazwisko select Konto.id).FirstOrDefault(); if (querry != 0) { id = querry; } else { id = 0; } var querry2 = (from Zeby in register.Zeby where Zeby.userId == id select Zeby.id).FirstOrDefault(); if (querry2 != 0) { var abc = (from Zeby in register.Zeby where Zeby.userId == id select new { Zeby.zab1, Zeby.zab2, Zeby.zab3, Zeby.zab4, Zeby.zab5, Zeby.zab6, Zeby.zab7, Zeby.zab8, Zeby.zab9, Zeby.zab10, Zeby.zab11, Zeby.zab12, Zeby.zab13, Zeby.zab14, Zeby.zab15, Zeby.zab16, Zeby.zab17, Zeby.zab18, Zeby.zab19, Zeby.zab20, Zeby.zab21, Zeby.zab22, Zeby.zab23, Zeby.zab24, Zeby.zab25, Zeby.zab26, Zeby.zab27, Zeby.zab28, Zeby.zab29, Zeby.zab30, Zeby.zab31, Zeby.zab32, }).ToArray(); String[] list = new string[32]; int[] Stan = new int[32]; list[0] = abc[0].zab1; list[1] = abc[0].zab2; list[2] = abc[0].zab3; list[3] = abc[0].zab4; list[4] = abc[0].zab5; list[5] = abc[0].zab6; list[6] = abc[0].zab7; list[7] = abc[0].zab8; list[8] = abc[0].zab9; list[9] = abc[0].zab10; list[10] = abc[0].zab11; list[11] = abc[0].zab12; list[12] = abc[0].zab13; list[13] = abc[0].zab14; list[14] = abc[0].zab15; list[15] = abc[0].zab16; list[16] = abc[0].zab17; list[17] = abc[0].zab18; list[18] = abc[0].zab19; list[19] = abc[0].zab20; list[20] = abc[0].zab21; list[21] = abc[0].zab22; list[22] = abc[0].zab23; list[23] = abc[0].zab24; list[24] = abc[0].zab25; list[25] = abc[0].zab26; list[26] = abc[0].zab27; list[27] = abc[0].zab28; list[28] = abc[0].zab29; list[29] = abc[0].zab30; list[30] = abc[0].zab31; list[31] = abc[0].zab32; for (int i = 0; i < list.Length; i++) { if (list[i] == "Zdrowy") { Stan[i] = 0; } else if (list[i] == "Chory") { Stan[i] = 1; } else if (list[i] == "Brak") { Stan[i] = 2; } else if (list[i] == "Wyeczony") { Stan[i] = 3; } else { Stan[i] = 0; } } string c = "Czab"; ComboBox com; int k = 0; for (int i = 0; i < 32; i++) { k = i + 1; c = "Czab" + k; com = FindName(c) as ComboBox; com.SelectedIndex = Stan[i]; } } else { string c = "Czab"; ComboBox com = FindName(c) as ComboBox; int k = 0; for (int i = 0; i < 32; i++) { k = i + 1; c = "Czab" + k; com = FindName(c) as ComboBox; com.SelectedIndex = 0; } } }
private void Canvasik_Copy_Loaded(object sender, RoutedEventArgs e) { RegisterAndLoginEntities2 reg = new RegisterAndLoginEntities2(); var querry = reg.Zeby.Where(x => x.userId == Zalgowany.id).FirstOrDefault(); if (querry != null) { var abc = (from Zeby in reg.Zeby where Zeby.userId == Zalgowany.id select new { Zeby.zab1, Zeby.zab2, Zeby.zab3, Zeby.zab4, Zeby.zab5, Zeby.zab6, Zeby.zab7, Zeby.zab8, Zeby.zab9, Zeby.zab10, Zeby.zab11, Zeby.zab12, Zeby.zab13, Zeby.zab14, Zeby.zab15, Zeby.zab16, Zeby.zab17, Zeby.zab18, Zeby.zab19, Zeby.zab20, Zeby.zab21, Zeby.zab22, Zeby.zab23, Zeby.zab24, Zeby.zab25, Zeby.zab26, Zeby.zab27, Zeby.zab28, Zeby.zab29, Zeby.zab30, Zeby.zab31, Zeby.zab32, }).ToArray(); String[] list = new string[32]; int[] Stan = new int[32]; MessageBox.Show("" + Zalgowany.id); list[0] = abc[0].zab1; list[1] = abc[0].zab2; list[2] = abc[0].zab3; list[3] = abc[0].zab4; list[4] = abc[0].zab5; list[5] = abc[0].zab6; list[6] = abc[0].zab7; list[7] = abc[0].zab8; list[8] = abc[0].zab9; list[9] = abc[0].zab10; list[10] = abc[0].zab11; list[11] = abc[0].zab12; list[12] = abc[0].zab13; list[13] = abc[0].zab14; list[14] = abc[0].zab15; list[15] = abc[0].zab16; list[16] = abc[0].zab17; list[17] = abc[0].zab18; list[18] = abc[0].zab19; list[19] = abc[0].zab20; list[20] = abc[0].zab21; list[21] = abc[0].zab22; list[22] = abc[0].zab23; list[23] = abc[0].zab24; list[24] = abc[0].zab25; list[25] = abc[0].zab26; list[26] = abc[0].zab27; list[27] = abc[0].zab28; list[28] = abc[0].zab29; list[29] = abc[0].zab30; list[30] = abc[0].zab31; list[31] = abc[0].zab32; for (int i = 0; i < list.Length; i++) { if (list[i] == "Zdrowy") { Stan[i] = 0; } else if (list[i] == "Chory") { Stan[i] = 1; } else if (list[i] == "Brak") { Stan[i] = 2; } else if (list[i] == "Wyeczony") { Stan[i] = 3; } else { Stan[i] = 0; } } string c = "Czab"; ComboBox com; int k = 0; for (int i = 0; i < 32; i++) { k = i + 1; c = "Czab" + k; com = FindName(c) as ComboBox; com.SelectedIndex = Stan[i]; } } }