using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components; using System.Diagnostics; using System.Globalization; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using Microsoft.JSInterop; using System.IO; using System.Net; using System.Net.Sockets; using System.Text; using System.Net.Http; using System.Data.SqlClient; using System.Data; using static pro_todo.Pages.Users; namespace pro_todo.Pages{ public class proje_gorevlerim{ [Inject] IJSRuntime JSRuntime { get; set; } public string proje_gorevlendirme_id {get;set;} public string proje_gorev_id {get;set;} public string proje_gorev_sorumlusu {get;set;} public string proje_bolum {get;set;} public string proje_durum {get;set;} } public class Genel1Page:ComponentBase{ [Inject] IJSRuntime JSRuntime { get; set; } static string BaglantiKodu="workstation id=protodo.mssql.somee.com;packet size=4096;user id=Ruveyda044_SQLLogin_1;pwd=xyzm27u3xo;data source=protodo.mssql.somee.com;persist security info=False;initial catalog=protodo"; static SqlConnection Baglanti = new SqlConnection(BaglantiKodu); static string KomutKodu = "select *from kullanicilar"; static SqlDataAdapter KullanicilarDataAdapter= new SqlDataAdapter (KomutKodu, Baglanti); SqlCommandBuilder KullanicilarKomut = new SqlCommandBuilder(KullanicilarDataAdapter); DataSet KullanicilarDataSet = new DataSet(); public List gorevler=new List(); public List gorevlerliste=new List(); public string inputgorevadi{get;set;} public string inputgorevid{get;set;} public List projeler=new List(); public List kullanici= new List(); public string MyOption { get; set; } public void Option(ChangeEventArgs e) { MyOption = e.Value as string ; } public List KullaniciGetir(){ try { KullanicilarDataAdapter.Fill(KullanicilarDataSet, "kullanici"); for (int i = 0; i < KullanicilarDataSet.Tables[0].Rows.Count; i++) { kullanicilar pm = new kullanicilar(); pm.kullaniciId = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_id"].ToString(); pm.kullaniciAdi = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_adi"].ToString(); pm.kullaniciSoyadi = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_soyadi"].ToString(); pm.kullaniciEmail = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_email"].ToString(); pm.kullaniciSifre = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_sifre"].ToString(); pm.kullaniciRolId = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_rol_id"].ToString(); pm.kullaniciBolumId = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_bolum_id"].ToString(); pm.kullaniciKayitTarih = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_kayit_tarihi"].ToString(); string onaystr = KullanicilarDataSet.Tables[0].Rows[i]["kullanici_onay"].ToString(); if (onaystr=="0") pm.kullaniciOnay=false; else pm.kullaniciOnay=true; kullanici.Add(pm); } } catch (Exception ex) { Console.WriteLine(ex); } return kullanici; } public List ProjeGetir(){ string BaglantiKodu="workstation id=protodo.mssql.somee.com;packet size=4096;user id=Ruveyda044_SQLLogin_1;pwd=xyzm27u3xo;data source=protodo.mssql.somee.com;persist security info=False;initial catalog=protodo"; SqlConnection Baglanti = new SqlConnection(BaglantiKodu); string KomutKodu = "select *from proje"; SqlDataAdapter ProjelerDataAdapter= new SqlDataAdapter (KomutKodu, Baglanti); SqlCommandBuilder ProjelerKomut = new SqlCommandBuilder(ProjelerDataAdapter); DataSet ProjelerDataSet = new DataSet(); try { ProjelerDataAdapter.Fill(ProjelerDataSet, "proje"); for (int i = 0; i < ProjelerDataSet.Tables[0].Rows.Count; i++) { proje pm = new proje(); pm.proje_id = ProjelerDataSet.Tables[0].Rows[i]["proje_id"].ToString(); pm.proje_adi = ProjelerDataSet.Tables[0].Rows[i]["proje_adi"].ToString(); pm.proje_bitis_tarihi = ProjelerDataSet.Tables[0].Rows[i]["proje_bitiş_tarihi"].ToString(); pm.proje_bolum_id = ProjelerDataSet.Tables[0].Rows[i]["bolum_id"].ToString(); pm.proje_baskani = ProjelerDataSet.Tables[0].Rows[i]["proje_baskani"].ToString(); projeler.Add(pm); } } catch (Exception ex) { Console.WriteLine(ex); } return projeler; } public List GorevGetir(){ string BaglantiKodu="workstation id=protodo.mssql.somee.com;packet size=4096;user id=Ruveyda044_SQLLogin_1;pwd=xyzm27u3xo;data source=protodo.mssql.somee.com;persist security info=False;initial catalog=protodo"; SqlConnection Baglanti = new SqlConnection(BaglantiKodu); string KomutKodu = "select *from proje_gorevleri"; SqlDataAdapter GorevlerDataAdapter= new SqlDataAdapter (KomutKodu, Baglanti); SqlCommandBuilder GorevlerKomut = new SqlCommandBuilder(GorevlerDataAdapter); DataSet GorevlerDataSet = new DataSet(); try { GorevlerDataAdapter.Fill(GorevlerDataSet, "proje_gorevleri"); for (int i = 0; i < GorevlerDataSet.Tables[0].Rows.Count; i++) { proje_gorev pm = new proje_gorev(); pm.proje_gorev_id = GorevlerDataSet.Tables[0].Rows[i]["proje_gorev_id"].ToString(); pm.proje_id = GorevlerDataSet.Tables[0].Rows[i]["proje_id"].ToString(); pm.proje_gorevi = GorevlerDataSet.Tables[0].Rows[i]["proje_gorevi"].ToString(); pm.proje_bolum = GorevlerDataSet.Tables[0].Rows[i]["proje_bolum"].ToString(); gorevler.Add(pm); } } catch (Exception ex) { Console.WriteLine(ex); } return gorevler; } public List GorevListeGetir(){ string BaglantiKodu="workstation id=protodo.mssql.somee.com;packet size=4096;user id=Ruveyda044_SQLLogin_1;pwd=xyzm27u3xo;data source=protodo.mssql.somee.com;persist security info=False;initial catalog=protodo"; SqlConnection Baglanti = new SqlConnection(BaglantiKodu); string KomutKodu = "select *from proje_gorevlendirme"; SqlDataAdapter GorevlerDataAdapter= new SqlDataAdapter (KomutKodu, Baglanti); SqlCommandBuilder GorevlerKomut = new SqlCommandBuilder(GorevlerDataAdapter); DataSet GorevlerDataSet = new DataSet(); try { GorevlerDataAdapter.Fill(GorevlerDataSet, "proje_gorevlendirme"); for (int i = 0; i < GorevlerDataSet.Tables[0].Rows.Count; i++) { proje_gorevlerim pm = new proje_gorevlerim(); pm.proje_gorevlendirme_id = GorevlerDataSet.Tables[0].Rows[i]["proje_gorevlendirme_id"].ToString(); pm.proje_gorev_id = GorevlerDataSet.Tables[0].Rows[i]["proje_gorev_id"].ToString(); pm.proje_gorev_sorumlusu = GorevlerDataSet.Tables[0].Rows[i]["proje_gorev_sorumlusu"].ToString(); pm.proje_bolum = GorevlerDataSet.Tables[0].Rows[i]["proje_bolum"].ToString(); pm.proje_durum = GorevlerDataSet.Tables[0].Rows[i]["proje_durum"].ToString(); gorevlerliste.Add(pm); } } catch (Exception ex) { Console.WriteLine(ex); } return gorevlerliste; } protected override async Task OnInitializedAsync() { if(MyUser.kullanici_email != "NULL" && MyUser.kullanici_sifre != "NULL" && MyUser.kullanici_rol == "3" && MyUser.kullanici_bolum != "NULL" && MyUser.kullanici_id != "NULL") { gorevlerliste.Clear(); projeler.Clear(); gorevler.Clear(); kullanici.Clear(); gorevlerliste=GorevListeGetir(); projeler=ProjeGetir(); gorevler=GorevGetir(); kullanici=KullaniciGetir(); } else { JSRuntime.InvokeVoidAsync("logingit"); } } public async void Yapildi(string todoID, object checkedValue) { SqlCommand komut=Baglanti.CreateCommand(); foreach(proje_gorevlerim item in gorevlerliste){ if(item.proje_gorevlendirme_id == todoID){ if(item.proje_durum=="1") { item.proje_durum = "0"; komut.CommandText="update proje_gorevlendirme set proje_durum=0 where proje_gorevlendirme_id="+todoID+""; } else { item.proje_durum = "1"; komut.CommandText="update proje_gorevlendirme set proje_durum=1 where proje_gorevlendirme_id="+todoID+""; } break; } } Baglanti.Open(); komut.ExecuteNonQuery(); Baglanti.Close(); } } }