Commit 28d38eaa authored by Rüveyda Yılmaz's avatar Rüveyda Yılmaz
Browse files

Initial commit

parents
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 System.Net.Mail;
using static pro_todo.Pages.Users;
namespace pro_todo.Pages{
public class BaskanPageBaseAtama: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<proje_gorev> gorevler=new List<proje_gorev>();
public string inputgorevadi{get;set;}
public string inputgorevid{get;set;}
public List<proje> projeler=new List<proje>();
public List<kullanicilar> kullanici= new List<kullanicilar>();
public string MyOption { get; set; }
public void Option(ChangeEventArgs e)
{
MyOption = e.Value as string ;
}
public void GorevAta(){
SqlCommand komut=Baglanti.CreateCommand();
komut.CommandText="insert into proje_gorevlendirme(proje_gorev_id,proje_gorev_sorumlusu,proje_bolum) values("+inputgorevid+","+MyOption+","+MyUser.kullanici_bolum+")";
Baglanti.Open();
komut.ExecuteNonQuery();
Baglanti.Close();
string email="";
string gorev="";
foreach(var user in kullanici)
{
if(user.kullaniciId==MyOption)
{
email=user.kullaniciEmail;
}
}
foreach(var gorevs in gorevler)
{
if(gorevs.proje_gorev_id==inputgorevid)
{
gorev=gorevs.proje_gorevi;
}
}
MailGonder(email,gorev);
}
public async Task GorevUpdate()
{
SqlCommand komut=Baglanti.CreateCommand();
komut.CommandText="update proje_gorevleri set proje_gorevi='"+inputgorevadi+"' where proje_gorev_id="+inputgorevid+"";
Baglanti.Open();
komut.ExecuteNonQuery();
Baglanti.Close();
inputgorevadi="";
await OnInitializedAsync();
}
public List<kullanicilar> 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<proje> 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<proje_gorev> 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;
}
protected override async Task OnInitializedAsync()
{
if(MyUser.kullanici_email != "NULL" && MyUser.kullanici_sifre != "NULL" && MyUser.kullanici_rol == "2" && MyUser.kullanici_bolum != "NULL" && MyUser.kullanici_id != "NULL")
{
projeler.Clear();
gorevler.Clear();
kullanici.Clear();
projeler=ProjeGetir();
gorevler=GorevGetir();
kullanici=KullaniciGetir();
}
else
{
JSRuntime.InvokeVoidAsync("logingit");
}
}
public string ResultMessage { get; set; } = "";
private void MailGonder(string email,string gorev)
{
try
{
using (MailMessage mail = new MailMessage()) {
mail.From = new MailAddress("bilgilendirme44@hotmail.com");
mail.To.Add(email);
mail.Subject ="Gorev Bilgilendirme";
mail.Body =gorev;
mail.IsBodyHtml = true;
using (SmtpClient smtp = new SmtpClient("smtp.outlook.com", 587))
{
smtp.Credentials = new System.Net.NetworkCredential("bilgilendirme44@hotmail.com", "ruvi1234");
smtp.EnableSsl =true;
smtp.Send(mail);
ResultMessage = "Mail Gitti";
}
}
}
catch(Exception e)
{
ResultMessage=e.Message;
}
}
}
}
@page "/counter"
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
@page
@model pro_todo.Pages.ErrorModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace pro_todo.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
@page "/fetchdata"
<PageTitle>Weather forecast</PageTitle>
@using pro_todo.Data
@inject WeatherForecastService ForecastService
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from a service.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
}
@page "/GenelPage"
@inherits Genel1Page
@using static pro_todo.Pages.Users
<table class="table" style="background:rgb( 207, 216, 240 );width:55%;margin-left:2%;margin-top:5%">
<thead>
<tr>
<th>Proje ID</th>
<th>Gorev</th>
<th>Durum</th>
</tr>
</thead>
<tbody>
@if(gorevlerliste is null)
{
<p>Yükleniyor..</p>
}
else
{
Boolean kontrol=false;
@foreach(var item in gorevlerliste)
{
@if(item.proje_gorev_sorumlusu == MyUser.kullanici_id){
<tr>
<td>@item.proje_gorevlendirme_id</td>
@foreach (var item1 in gorevler)
{
if(item.proje_gorev_id==item1.proje_gorev_id)
{
<td>@item1.proje_gorevi</td>
}
}
@if(@item.proje_durum == "1")
{
kontrol=true;
}
else
{
kontrol=false;
}
<td><input type="checkbox" @onchange="eventArgs => { Yapildi(item.proje_gorevlendirme_id, eventArgs.Value); }" checked="@kontrol" /></td>
</tr>
}
}
}
</tbody>
</table>
\ No newline at end of file
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<proje_gorev> gorevler=new List<proje_gorev>();
public List<proje_gorevlerim> gorevlerliste=new List<proje_gorevlerim>();
public string inputgorevadi{get;set;}
public string inputgorevid{get;set;}
public List<proje> projeler=new List<proje>();
public List<kullanicilar> kullanici= new List<kullanicilar>();
public string MyOption { get; set; }
public void Option(ChangeEventArgs e)
{
MyOption = e.Value as string ;
}
public List<kullanicilar> 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<proje> 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<proje_gorev> 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<proje_gorevlerim> 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();
}
}
}
\ No newline at end of file
@page "/"
@inherits LoginBase
@Donut
<title>Giriş</title>
<link rel="stylesheet" href="../css/LoginRegister.css">
<div id="dis">
<div id="div1">
<h1 >Kayıt Ol</h1>
<div class="textbox">
@* <p >Kullanıcı Adı</p>*@
<input @bind="kullanici_adi" type="text" name="kullanici-adi" placeholder="Kullanıcı Adı" required>
</div>
<div class="textbox">
@* <p >Kullanıcı Soyadi</p> *@
<input @bind="kullanici_soyadi" type="text" name="kullanici-soyadi" placeholder="Kullanıcı Soyadi" required>
</div>
<div class="textbox">
@* <p >Email</p> *@
<input @bind="kayit_email" type="text" name="kullanici-email" placeholder="E-mail" required>
</div>
<div class="textbox">
@* <p >Şifre</p>*@
<input @bind="kayit_sifre" type="password" id="password" placeholder="Şifre" required maxlength="8">
@*/ @Donut /*@
@*/<div id="eye" @onclick="Eyefunction"></div>/*@
</div>
<button id="button" @onclick="kayitol">Kayıt </button>
</div>
<div id="div2">
<h1 >Giriş Yap</h1>
<div class="textbox2">
@* <p >Email</p>*@
<input class="text" type="text" name="kullanici-email" @bind="giris_email" placeholder="E-mail" required>
</div>
<div class="textbox2">
@* <p >Şifre</p>*@
<input type="password" name="sifre" placeholder="Şifre" @bind="giris_sifre" @bind:event="oninput" required maxlength="8">
</div>
<button id="button" @onclick="girisyap">Giriş</button>
@*/ @Donut1 /*@
</div>
</div>
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;
using System.Data.SqlClient;
using static pro_todo.Pages.Users;
namespace pro_todo.Pages
{
public class LoginBase:ComponentBase
{
[Inject]
IJSRuntime JSRuntime { get; set; }
public string kullanici_adi{get;set;}
public string kullanici_soyadi{get;set;}
public string kayit_email{get;set;}
public string kayit_sifre{get;set;}
public string giris_email{get;set;}
public string giris_sifre{get;set;}
public string kullanici_rol{get;set;}
public string KayitDonut{get;set;}
public string Donut{get;set;}
protected override async Task OnInitializedAsync()
{
MyUser.kullanici_email="NULL";
MyUser.kullanici_sifre="NULL";
MyUser.kullanici_rol="NULL";
MyUser.kullanici_bolum="NULL";
MyUser.kullanici_id="NULL";
}
public void kayitol(){
string veritabani = @"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(veritabani);
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText ="exec kayitol '"+kullanici_adi+"','"+kullanici_soyadi+"','"+kayit_email+"','"+kayit_sifre+"',@sonuc OUTPUT";
SqlParameter sonucop = cmd.Parameters.Add("@sonuc", SqlDbType.Int);
sonucop.Direction = ParameterDirection.Output;
baglanti.Open();
cmd.ExecuteNonQuery();
baglanti.Close();
if(sonucop.Value.ToString() == "1")
{
JSRuntime.InvokeVoidAsync("kullanicizatenvar");
KayitDonut="Bu Kullanici Zaten Var";
}
else if(sonucop.Value.ToString() == "2")
{
JSRuntime.InvokeVoidAsync("kayitbasarili");
KayitDonut="Kayıt Başarılı";
}
}
public void girisyap(){
string veritabani = @"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(veritabani);
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText ="exec giris '"+giris_email+"','"+giris_sifre+"',@sonuc OUTPUT,@rol Output,@bolum Output,@id Output";
SqlParameter sonucop = cmd.Parameters.Add("@sonuc", SqlDbType.Int);
sonucop.Direction = ParameterDirection.Output;
SqlParameter rolop = cmd.Parameters.Add("@rol", SqlDbType.Int);
rolop.Direction = ParameterDirection.Output;
SqlParameter bolumop = cmd.Parameters.Add("@bolum", SqlDbType.Int);
bolumop.Direction = ParameterDirection.Output;
SqlParameter idop = cmd.Parameters.Add("@id", SqlDbType.Int);
idop.Direction = ParameterDirection.Output;
baglanti.Open();
cmd.ExecuteNonQuery();
if(sonucop.Value.ToString()=="3")
{
JSRuntime.InvokeVoidAsync("kayityok");
Donut="Kayıt Yok";
}
else if(sonucop.Value.ToString()=="2")
{
JSRuntime.InvokeVoidAsync("onaybekleyen");
Donut="Bu kullanıcı onay bekliyor";
}
else if(sonucop.Value.ToString()=="1")
{
JSRuntime.InvokeVoidAsync("girisbasarili");
Donut="Giriş Başarılı";
MyUser.kullanici_email=giris_email;
MyUser.kullanici_sifre=giris_sifre;
MyUser.kullanici_rol=rolop.Value.ToString();
MyUser.kullanici_bolum=bolumop.Value.ToString();
MyUser.kullanici_id=idop.Value.ToString();
JSRuntime.InvokeVoidAsync("yonlendir",MyUser.kullanici_rol);
}
baglanti.Close();
//Console.WriteLine(MyUser.kullanici_email+" "+MyUser.kullanici_sifre+" "+MyUser.kullanici_rol+" "+MyUser.kullanici_bolum+" "+MyUser.kullanici_id);
}
}
}
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;
namespace pro_todo.Pages
{
public partial class Users{
public class MyUser{
public static string kullanici_email{ get; set; }="NULL";
public static string kullanici_sifre{ get; set; }="NULL";
public static string kullanici_rol{ get; set; }="NULL";
public static string kullanici_bolum{ get; set; }="NULL";
public static string kullanici_id{ get; set; }="NULL";
}
}
}
\ No newline at end of file
@page "/-"
@namespace pro_todo.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
<component type="typeof(App)" render-mode="ServerPrerendered" />
<script src="~/js/yenile.js"></script>
<script>
function toolbar_sil(par)
{
switch(par){
case 1:
document.getElementById("gelen_toolbar").style.display="none";
break;
default:
document.getElementById("gelen_toolbar").style.display="flex";
}
}
</script>
\ No newline at end of file
@using Microsoft.AspNetCore.Components.Web
@namespace pro_todo.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="pro_todo.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
@RenderBody()
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using pro_todo.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:38267",
"sslPort": 44352
}
},
"profiles": {
"pro_todo": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7165;http://localhost:5207",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@inherits LayoutComponentBase
@using static pro_todo.Pages.Users
<PageTitle>Admin Page</PageTitle>
<div class="page">
<div class="sidebar">
<SolMenu />
</div>
<main>
@if(MyUser.kullanici_id != "NULL")
{
<div class="top-row px-4" id="gelen_toolbar">
</div>
}
<article class="content px-4">
@Body
</article>
</main>
</div>
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
.sidebar {
background: rgb(11, 88, 124);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.top-row a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row a, .top-row .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
@using static pro_todo.Pages.Users
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</div>
<div id="div1" class="@NavMenuCssClass" @onclick="ToggleNavMenu" >
<nav class="flex-column">
@if(MyUser.kullanici_rol == "1"){
<div class="nav-item px-3">
<NavLink class="nav-link" href="page1">
<button id="button1" >
<i id="img2"></i> kullanici Onay</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="page2">
<button id="button2-1">
<i id="img5"></i> Bolum Atama</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="page4">
<button id="button2-2">
<i id="img5"></i> Rol Atama</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="page5">
<button id="button2">
<i id="img3"></i> kullanici Atama</button>
</NavLink>
</div>
}
@if(MyUser.kullanici_rol == "2"){
<div class="nav-item px-3">
<NavLink class="nav-link" href="BaskanPage">
<button id="button2">
<i id="img7"></i> Proje Oluştur</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="BaskanPage1">
<button id="button2">
<i id="img7"></i> Görev Oluştur</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="BaskanPage2">
<button id="button2">
<i id="img2"></i> Görev Atama</button>
</NavLink>
</div>
}
@if(MyUser.kullanici_rol == "3"){
<div class="nav-item px-3">
<NavLink class="nav-link" href="GenelPage">
<button id="button2" >
<i id="img3"></i> Görevlerim</button>
</NavLink>
</div>
}
<div class="nav-item px-3">
<NavLink class="nav-link" href="page3">
<button id="button3" >
<i id="img4"></i> Ayarlar</button>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="">
<button id="button4">
<i id="img6"></i>çıkış</button>
</NavLink>
</div>
</nav>
</div>
@code {
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
}
.navbar-brand {
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
}
body{
background-color: rgb(226, 226, 226);
}
#div1{
position:sticky;
background: rgb(11, 88, 124);
margin-left:-2%;
font-family:'Arial Narrow Bold';
}
#div2{
position: absolute;
height:50px;
width: 1150px;
background-color:white;
margin-left:12.7%;
}
#div3{
position: absolute;
background-color: white;
width: 1115px;
height: 550px;
margin-left: 15%;
margin-top: 5%;
}
#img1{
display: inline-block;
background-image: url('../img/home-4-16.ico');
width: 15px;
height: 15px;
}
#img2{
display: inline-block;
background-image: url('../img/add-user-16.ico');
width: 15px;
height: 15px;
}
#img3{
display: inline-block;
background-image: url('../img/user-16.ico');
width: 15px;
height: 15px;
}
#img4{
display: inline-block;
background-image: url('../img/gear-16.ico');
width: 16px;
height: 16px;
}
#img5{
display: inline-block;
background-image: url('../img/add-list-16.ico');
width: 15px;
height: 15px;
}
#img6{
display: inline-block;
background-image: url('../img/exit-16.ico');
width: 15px;
height: 15px;
}
#img7{
display: inline-block;
background-image: url('../img/add.ico');
width: 16px;
height: 16px;
}
#button{
position:relative;
width: 200px;
height:50px;
color:rgb(4, 0, 15);;
background-color:rgb(11, 88, 124);
color: white;
font-weight: bold;
}
#button1{
position:relative;
width: 200px;
height:60px;
color:white;
background-color: rgb(11, 88, 124);
}
#button2-1{
position:relative;
width: 200px;
height: 60px;
color: white;
background-color: rgb(11, 88, 124);
}
#button2-2{
position:relative;
width: 200px;
height: 60px;
color: white;
background-color: rgb(11, 88, 124);
}
#button2{
position:relative;
width: 200px;
height: 60px;
color: white;
background-color: rgb(11, 88, 124);
}
#button3{
position:relative;
width: 200px;
height: 60px;
color: white;
background-color: rgb(11, 88, 124);
}
#button4{
position:relative;
width: 200px;
height: 60px;
color: white;
background-color: rgb(11, 88, 124);
}
.istatistik-div{
margin-top:-11%;
margin-left: 3%;
position: absolute;
width: 400px;
height: 250px;
font-size: 25px;
color:black;
background-color: rgb(211, 227, 231);
font-family:'Arial Narrow Bold' ;
}
\ No newline at end of file
<div class="alert alert-secondary mt-4">
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
<strong>@Title</strong>
<span class="text-nowrap">
Please take our
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2149017">brief survey</a>
</span>
and tell us what you think.
</div>
@code {
// Demonstrates how a parent component can supply parameters
[Parameter]
public string? Title { get; set; }
}
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using pro_todo
@using pro_todo.Shared
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment