void Program_Preparer() { try { Person person = JsonConvert.DeserializeObject <Person>(Settings.GeneralSettings); string dersids = $"select ders_id from derskayit where student_id = '{person.Id}'"; Dictionary <string, List <string> > ders_ids = HelperFunctionss.Sqlreaderexecuter(dersids); foreach (string id in ders_ids["ders_id"]) { string ders = $"select DersGünü,DersAdi,hoca_id,cast(date2 as time(0))[time] from Dersler where Ders_ID = '{id}'"; Dictionary <string, List <string> > dersler = HelperFunctionss.Sqlreaderexecuter(ders); string hocaisim = $"select isim from Hocalar where Hoca_id = '{dersler["hoca_id"][0]}'"; hocaisim = HelperFunctionss.SqlExecuter(hocaisim, 1); Label label = new Label { Text = dersler["DersAdi"][0] + "\n" + hocaisim, }; label.FontSize = Device.GetNamedSize(NamedSize.Micro, label); string lname = dersler["time"][0].Replace(":", ""); lname = "l" + lname; int row = Grid.GetRow(Grid.FindByName <Label>(lname)); int col = Grid.GetColumn(Grid.FindByName <Label>(dersler["DersGünü"][0])); Grid.Children.Add(label, col, row); } } catch (Exception exp) { DisplayAlert("", exp.ToString(), "ok"); } }
void Brans_SelectedIndexChanged(object sender, System.EventArgs e) { string comm = $@"SELECT isim from Hocalar WHERE Brans = '{Brans.SelectedItem.ToString()}'"; Dictionary <string, List <string> > names = HelperFunctionss.Sqlreaderexecuter(comm); HelperFunctionss.Pickeradjuster(Hocalar, names, "isim"); }
void Button7_Clicked(object sender, EventArgs e) { Button_invisible(); if (Brans.SelectedIndex != -1 && Hocalar.SelectedIndex != -1 && Gun.SelectedIndex != -1) { try { string hocaid = $"select Hoca_id from Hocalar where isim = '{Hocalar.SelectedItem.ToString()}'"; hocaid = HelperFunctionss.SqlExecuter(hocaid, 1); string comm = $@"SELECT cast(date2 as time(0))[date2] from Dersler WHERE DersAdi = '{Brans.SelectedItem.ToString()}' and hoca_id = '{hocaid}' and DersGünü = '{Gun.SelectedItem.ToString()}' and enrolled != quota"; Dictionary <string, List <string> > table = HelperFunctionss.Sqlreaderexecuter(comm); Person person1 = JsonConvert.DeserializeObject <Person>(Settings.GeneralSettings); comm = $@"SELECT cast(Dersler.date2 as time(0))[date2] FROM Dersler INNER JOIN derskayit ON Dersler.Ders_ID = derskayit.ders_id where derskayit.student_id = '{person1.Id}' and DersGünü = '{Gun.SelectedItem.ToString()}';"; Dictionary <string, List <string> > kayitlitimes = HelperFunctionss.Sqlreaderexecuter(comm); DersGunu.Text = Gun.SelectedItem.ToString(); foreach (string row in table["date2"]) { string bname = "b" + row.Replace(":", ""); string lname = "l" + row.Replace(":", ""); string rname = "r" + row.Replace(":", ""); if (!(kayitlitimes["date2"].Contains(row))) { try { Grid.IsVisible = true; Grid.FindByName <Button>(bname).IsVisible = true; Grid.FindByName <Label>(lname).IsVisible = true; Grid.FindByName <RowDefinition>(rname).Height = GridLength.Star; } catch { } } } if (Grid.IsVisible == false) { DisplayAlert("Uyarı", "Kayıt olabileceğiniz Ders bulunmamaktır lütfen Ders Programınızı Kontrol Ediniz", "Tamam"); } } catch (Exception exx) { DisplayAlert("alert", exx.ToString(), "ok"); } } else { DisplayAlert("Uyarı", "Lutfen butun seçenekleri eksiksiz seçiniz", "OK"); } }
void Brans_SelectedIndexChanged(object sender, EventArgs e) { string comm = $@"SELECT isim from Hocalar WHERE Brans = '{Brans.SelectedItem.ToString()}'"; Dictionary <string, List <string> > names = HelperFunctionss.Sqlreaderexecuter(comm); HelperFunctionss.Pickeradjuster(Hocalar, names, "isim"); Gun.SelectedIndex = -1; Gun.Items.Clear(); Gun.IsEnabled = false; Grid.IsVisible = false; }
void Button1_Clicked(object sender, System.EventArgs e) { if (username.Text == "arphazon") { Application.Current.MainPage = new Admin(); Settings.GeneralSettings = username.Text; return; } string comm = $@"if exists(SELECT sifre from Kisiler WHERE kullaniciadi = '{username.Text}') SELECT sifre from Kisiler WHERE kullaniciadi = '{username.Text}' else select null"; if (App5.HelperFunctionss.SqlExecuter(comm, 1) == "null") { DisplayAlert("Alert", "Yanlis Kullanici Adi", "OK"); username.Text = ""; pass.Text = ""; } else { if (App5.HelperFunctionss.SqlExecuter(comm, 1) != pass.Text) { DisplayAlert("Alert", "Yanlis Sifre", "OK"); } else { comm = $@"SELECT isim,soyisim,Sınıf,unvan,Personid from Kisiler WHERE kullaniciadi = '{username.Text}'"; Dictionary <string, List <string> > datas = HelperFunctionss.Sqlreaderexecuter(comm); try { Person person1 = new Person { Username = username.Text, Name = datas["isim"][0], Surname = datas["soyisim"][0], Sinif = datas["Sınıf"][0], Unvan = datas["unvan"][0], Id = datas["Personid"][0] }; Settings.GeneralSettings = JsonConvert.SerializeObject(person1); Application.Current.MainPage = new LoggedIn(); } catch (Exception exp) { DisplayAlert("Exception", exp.Message, "OK"); } } } }
void Hocalar_SelectedIndexChanged(object sender, EventArgs e) { if (Hocalar.SelectedIndex != -1) { string hocaid = $"select Hoca_id from Hocalar where isim = '{Hocalar.SelectedItem.ToString()}'"; hocaid = HelperFunctionss.SqlExecuter(hocaid, 1); string comm = $@"SELECT DersGünü from Dersler WHERE DersAdi = '{Brans.SelectedItem.ToString()}' and hoca_id = '{hocaid}' and enrolled != quota"; Dictionary <string, List <string> > names = HelperFunctionss.Sqlreaderexecuter(comm); HelperFunctionss.Pickeradjuster(Gun, names, "DersGünü"); Grid.IsVisible = false; } }
void Button8_Clicked(object sender, System.EventArgs e) { try { Button btn = (Button)sender; string[] hours = new string[] { "10:50:00", "11:10:00", "13:00:00", "13:30:00", "14:00:00", "14:30:00", "17:00:00", "17:30:00" }; foreach (string bhour in hours) { string bname = "b" + bhour.Replace(":", ""); if (btn == Grid.FindByName <Button>(bname)) { string hocaid = $"select Hoca_id from Hocalar where isim = '{Hocalar.SelectedItem.ToString()}'"; hocaid = HelperFunctionss.SqlExecuter(hocaid, 1); string comm = $@"select Ders_ID from Dersler where DersAdi = '{Brans.SelectedItem.ToString()}' and hoca_id = '{hocaid}' and DersGünü = '{Gun.SelectedItem.ToString()}' and cast(date2 as time(0)) = '{bhour}'"; string dersid = HelperFunctionss.SqlExecuter(comm, 1); Person person1 = JsonConvert.DeserializeObject <Person>(Settings.GeneralSettings); if (dersid != "null") { comm = $@"insert into derskayit(student_id,ders_id) values('{person1.Id}','{dersid}') update Dersler set enrolled = enrolled + 1 where Ders_ID = '{dersid}'"; string ret = HelperFunctionss.SqlExecuter(comm, 0); if (ret == "null") { DisplayAlert("alert", "Zaten bu derse kayıt olmuşsunuz!", "ok"); return; } else { DisplayAlert("alert", "Ders Kaydı Başarılı!", "ok"); } } btn.IsVisible = false; break; } } } catch (Exception exaa) { DisplayAlert("", exaa.Message + exaa.ToString(), ""); } }
void Ders_Olustur(object sender, System.EventArgs e) { if (Sinif.SelectedIndex != -1 && Hocalar.SelectedIndex != -1 && Brans.SelectedIndex != -1 && Tarih.Date.ToString() != "" && Saat.SelectedIndex != -1) { string Gun = Hangi_gun(); string tarih = Tarih.Date.ToString("yyyy - MM - dd "); string hocaid = $"select Hoca_id from Hocalar where isim = '{Hocalar.SelectedItem.ToString()}'"; hocaid = HelperFunctionss.SqlExecuter(hocaid, 2); string yenidersekle = $"insert into Dersler (Sınıf,DersGünü,DersAdi,date2,hoca_id,quota,enrolled)" + $"values('{Sinif.SelectedItem.ToString()}','{Gun}','{Brans.SelectedItem.ToString()}','{tarih + Saat.SelectedItem.ToString()}','{hocaid}','1','0')"; if (HelperFunctionss.SqlExecuter(yenidersekle, 0) == "null") { DisplayAlert("Hata!", "Lütfen ders programını kontrol ediniz", "Tamam"); } } else { DisplayAlert("Uyarı", "Lütfen bütün seçenekleri seçtiğinizden emin olun.", "Tamam"); } }