Commit 12bda7d1 authored by Mihrali ŞEKER's avatar Mihrali ŞEKER
Browse files

Initial commit

parents
Admin hesabı
email=mihrali@gmail.com
sifre=02021982
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
namespace Todo.Data;
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
namespace Todo.Data;
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
@page "/Admin"
@inherits LoginBase
@inject IJSRuntime JSRuntime
@if (user is null && rol is null)
{
<p><em>Loading... !</em></p>
}
else
{
int trid=0;
<table class="table" style="width:auto;position:relative;float:left;border:3px solid black;background:lightblue">
<thead>
<tr>
<th>Isim</th>
<th>Soyisim</th>
<th>Email</th>
<th>Sifre</th>
<th>Kayıt Tarihi</th>
<th>Rol Id</th>
<th>Bolum Id</th>
<th>Aktiflik</th>
</tr>
</thead>
<tbody>
@foreach(var rol1 in rol)
{
@foreach(var item in user)
{
@if(rol1.rol_id==item.rol_id){
string tridstr=""+trid+"";
trid=trid+1;
<tr id="@tridstr">
<td>@item.isim</td>
<td>@item.soyisim</td>
<td>@item.email</td>
<td>@item.sifre</td>
<td>@item.kayit_tarihi</td>
<td>
<select @onchange="e => { Roloption(e,item.user_id,tridstr);}">
@if (rol is null)
{
<p><em>Loading...</em></p>
}
else
{
@foreach (var rols in rol)
{
if(@item.rol_id == @rols.rol_id){
<option Selected Value=@rols.rol_id>@rols.rol</option>
}
<option value=@rols.rol_id>@rols.rol</option>
}
}
</select>
</td>
<td ><select @onchange="e => { Bolumoption(e,item.user_id);}">
@if (bolum is null)
{
<p><em>Loading...</em></p>
}
else
{
@foreach (var bolums in bolum)
{
if(@item.bolum_id == @bolums.bolum_id){
<option Selected>@bolums.bolum_adi</option>
}
<option value=@bolums.bolum_id>@bolums.bolum_adi</option>
}
}
</select></td>
<td ><input type="checkbox" @onchange="eventArgs => { IsDoneSet(item.user_id, eventArgs.Value); }" checked="@item.kisi_aktiflik"/></td>
</tr>
}
}
}
</tbody>
</table>
}
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 Todo.Pages.LoginCheck;
namespace Todo.Pages
{
public class Users
{
public int user_id { get; set; }
public string isim { get; set; }
public string soyisim { get; set; }
public string email { get; set; }
public string sifre { get; set; }
public string kayit_tarihi { get; set; }
public int rol_id { get; set; }
public int bolum_id { get; set; }
public bool kisi_aktiflik { get; set; }
}
public class Rols
{
public int rol_id {get;set;}
public string rol {get;set;}
public static string rol_id_tut {get;set;}
}
public class Bolums
{
public int bolum_id {get;set;}
public string bolum_adi {get;set;}
}
public class LoginBase:ComponentBase
{
[Inject]
IJSRuntime JSRuntime { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public List<Users> user= new List<Users>();
public List<Rols> rol= new List<Rols>();
public List<Bolums> bolum= new List<Bolums>();
public void IsDoneSet(int userID, object checkedValue)
{
bool newIsDone=(bool)checkedValue?true:false;
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
Console.WriteLine(newIsDone);
SqlCommand komut=baglanti.CreateCommand();
foreach(Users todoobj in user){
if(todoobj.user_id == userID){
if(todoobj.kisi_aktiflik==true)
{
todoobj.kisi_aktiflik=newIsDone;
komut.CommandText = "update users set kisi_aktiflik=0 where user_id="+userID+"";
}
else
{
todoobj.kisi_aktiflik=newIsDone;
komut.CommandText = "update users set kisi_aktiflik=1 where user_id="+userID+"";
}
Console.WriteLine(komut.CommandText);
baglanti.Open();
komut.ExecuteNonQuery();
baglanti.Close();
break;
}
}
}
protected override async Task OnInitializedAsync()
{
if(Loginclass.m1=="NULL" && Loginclass.m2=="NULL")
{
NavigationManager.NavigateTo("/");
}
else
{
if(Loginclass.rol_id_tut=="0"){
rol=Rolgetir();
bolum=Bolumgetir();
user=KisiGetir();
}
}
}
public List<Rols> Rolgetir(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Rol";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "rol");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Rols pm = new Rols();
pm.rol_id = Int32.Parse(dsps.Tables[0].Rows[i]["rol_id"].ToString());
pm.rol = dsps.Tables[0].Rows[i]["rol"].ToString();
rol.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return rol;
}
public void Roloption(ChangeEventArgs e,int userID,string tridstr){
string rol_id2=e.Value.ToString();
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
SqlCommand komut=baglanti.CreateCommand();
komut.CommandText="update users set rol_id="+rol_id2+" where user_id="+userID+"";
baglanti.Open();
komut.ExecuteNonQuery();
baglanti.Close();
Console.WriteLine(tridstr);
/*JSRuntime.InvokeVoidAsync("JSAdmin",tridstr,rol_id2);*/
}
public void Bolumoption(ChangeEventArgs e,int userID){
string bolum_id2=e.Value.ToString();
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
SqlCommand komut=baglanti.CreateCommand();
komut.CommandText="update users set bolum_id="+bolum_id2+" where user_id="+userID+"";
baglanti.Open();
komut.ExecuteNonQuery();
baglanti.Close();
}
public List<Bolums> Bolumgetir(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Bolum";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "bolum");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Bolums pm = new Bolums();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.bolum_adi = dsps.Tables[0].Rows[i]["bolum_adi"].ToString();
bolum.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return bolum;
}
public List<Users> KisiGetir(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from users";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "user");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Users pm = new Users();
pm.user_id = Int32.Parse(dsps.Tables[0].Rows[i]["user_id"].ToString());
pm.isim = dsps.Tables[0].Rows[i]["isim"].ToString();
pm.soyisim = dsps.Tables[0].Rows[i]["soyisim"].ToString();
pm.email = dsps.Tables[0].Rows[i]["email"].ToString();
pm.sifre = dsps.Tables[0].Rows[i]["sifre"].ToString();
pm.kayit_tarihi = dsps.Tables[0].Rows[i]["kayit_tarihi"].ToString();
pm.rol_id = Int32.Parse(dsps.Tables[0].Rows[i]["rol_id"].ToString());
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
string aktiflik= dsps.Tables[0].Rows[i]["kisi_aktiflik"].ToString();
if(aktiflik=="0")
pm.kisi_aktiflik=false;
else
pm.kisi_aktiflik=true;
user.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return user;
}
}
}
@page "/bolum"
@inherits BolumBase
<div id="page-div">
@if (bolumler is null)
{
<p><em>Loading... !</em></p>
}
else
{
<table class="table" style="width:35%;margin-left:15%;border:3px solid black">
<thead>
<tr>
<th>Bolum ID</th>
<th>Bolum Adı</th>
</tr>
</thead>
<tbody style="overflow: scroll">
@foreach(var blm2 in bolumler)
{
<tr>
<td>@blm2.bolum_id</td>
<td>@blm2.bolum_adi</td>
</tr>
}
</tbody>
</table>
}
<input type="button" id="blmekle" onclick="eklegoster()" value="Bolum Ekle">
<input type="button" id="blmguncelle" onclick="guncellegoster()" value="Bolum Guncelle">
<div id="eklebolumdiv">
<input type="text" placeholder="Yeni Bölüm girin" @bind:event="oninput" @bind="YeniBolum">
<button @onclick="bolumekle">Ekle</button>
</div>
<div id="guncellebolumdiv">
<input type="text" placeholder="Güncellenicek Bölüm Id girin" @bind:event="oninput" @bind="Bolumguncid">
<input type="text" placeholder="Bölüm Giriniz" @bind:event="oninput" @bind="Bolumyeni">
<button @onclick="bolumguncelle">Güncelle</button>
</div>
</div>
\ 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 Todo.Pages.LoginCheck;
namespace Todo.Pages
{
public class Bolumler
{
public int bolum_id{get;set;}
public string bolum_adi {get;set;}
}
public class BolumBase:ComponentBase
{
[Inject]
public NavigationManager NavigationManager { get; set; }
public List<Bolumler> bolumler=new List<Bolumler>();
public string YeniBolum{get;set;}
public string Bolumsilid{get;set;}
public string Bolumguncid{get;set;}
public string Bolumyeni{get;set;}
protected override async Task OnInitializedAsync()
{
if(Loginclass.m1=="NULL" && Loginclass.m2=="NULL")
{
NavigationManager.NavigateTo("/");
}
else
{
if(Loginclass.rol_id_tut=="0"){
bolumler=Bolumgoster();
}
}
}
public List<Bolumler> Bolumgoster(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from bolum";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "bolumler");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Bolumler pm = new Bolumler();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.bolum_adi = dsps.Tables[0].Rows[i]["bolum_adi"].ToString();
bolumler.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return bolumler;
}
public void bolumekle(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
baglanti.Open();
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText = "insert into bolum values('"+YeniBolum+"')";
Console.WriteLine(cmd.CommandText);
cmd.ExecuteNonQuery();
baglanti.Close();
}
public void bolumguncelle(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
baglanti.Open();
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText = "update bolum set bolum_adi='"+Bolumyeni+"' where bolum_id="+Int32.Parse(Bolumguncid)+"";
Console.WriteLine(cmd.CommandText);
cmd.ExecuteNonQuery();
baglanti.Close();
}
}
}
\ No newline at end of file
@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 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 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 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 "/gorevekleata"
@inherits GorevEkleAtaBase
@using static Todo.Pages.LoginCheck
<div id="genel_div">
@if (proje is null)
{
<p><em>Loading... !</em></p>
}
else
{
<button id="btn3" @onclick="Gorevekleacil">Görev Ekleme</button>
<button id="btn2" @onclick="Gorevatamaacil">Görev Atama</button>
<div id="gorevdiv">
<select id="selectt" @onchange="e => { ProjeID(e);}">
<option Selected Value="-1">Proje Seçiniz</option>
@foreach(var prj in proje)
{
<option value=@prj.proje_id>@prj.proje_adi</option>
}
</select>
<textarea placeholder="Görevi Yaz" @bind:event="oninput" @bind="Gorev"></textarea>
<button @onclick="gorevekle" >Görev Ekle</button>
</div>
<div id="kutu-div">
<div id="kisisec-div">
<p>Kişi Seç</p>
<select @ref=RefMulSelect @onchange="ChangedMulSelect" multiple="@(true)" >
@foreach(var usrr in user2)
{
@if(usrr.bolum_id.ToString() == Loginclass.bolum_id_tut && usrr.email != Loginclass.m1){
<option value=@usrr.user_id>@usrr.isim @usrr.soyisim</option>
}
}
</select>
</div>
<div id="goreviddiv">
<input placeholder="Görev ID giriniz" @bind="GorevID">
<button @onclick="gorevata">Görev Ata</button>
</div>
</div>
<table class="table" style="position:relative;float:right;width:50%;border:3px solid black;margin-top:2%">
<thead>
<tr>
<th>Görev ID</th>
<th>Proje Adı</th>
<th>Görev</th>
<th>Bölüm</th>
<th>Görev Durum</th>
</tr>
</thead>
<tbody>
@foreach(var grv in gorev)
{
<tr>
<td>@grv.gorev_id</td>
@foreach(var prj in proje)
{
@if(grv.proje_id==prj.proje_id)
{
<td>@prj.proje_adi</td>
}
}
<td>@grv.gorev</td>
@foreach(var blm in bolum1)
{
@if(grv.bolum_id==blm.bolum_id)
{
<td>@blm.bolum_adi</td>
}
}
<td>@grv.gorev_durum</td>
</tr>
}
</tbody>
</table>
}
</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.SqlClient;
using System.Data;
using System.Net.Mail;
using static Todo.Pages.LoginCheck;
namespace Todo.Pages
{
public class Users2
{
public int user_id { get; set; }
public string isim { get; set; }
public string soyisim { get; set; }
public string email { get; set; }
public string sifre { get; set; }
public string kayit_tarihi { get; set; }
public int rol_id { get; set; }
public int bolum_id { get; set; }
public bool kisi_aktiflik { get; set; }
}
public class Projes
{
public int proje_id {get;set;}
public string proje_adi {get;set;}
public string proje_baslangic {get;set;}
public string proje_bitis {get;set;}
public int bolum_id{get;set;}
public bool proje_durum{get;set;}
}
public class GorevAtama
{
public int atama_id{get;set;}
public int user_id{get;set;}
public int gorev_id{get;set;}
public int bolum_id{get;set;}
public int gorev_durum{get;set;}
}
public class Gorevs{
public int gorev_id{get;set;}
public int proje_id{get;set;}
public string gorev {get;set;}
public int bolum_id{get;set;}
public int gorev_durum{get;set;}
}
public class Bolums1{
public int bolum_id{get;set;}
public string bolum_adi {get;set;}
}
public class GorevEkleAtaBase:ComponentBase
{
[Inject]
IJSRuntime JSRuntime { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public List<Projes> proje=new List<Projes>();
public List<Gorevs> gorev=new List<Gorevs>();
public List<Bolums1> bolum1=new List<Bolums1>();
public List<GorevAtama> atama= new List<GorevAtama>();
public List<Users2> user2=new List<Users2>();
public string Gorev{get;set;}
public string Proje_id{get;set;}
public string GorevID{get;set;}
public string KisiID{get;set;}
public string ResultMessage { get; set; } = "";
public ElementReference RefMulSelect;
public IList<string> ChoosedMulItem { get; set; } = new List<string>();
public void gorevekle(){
try{
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText = "insert into gorev(proje_id,gorev,bolum_id) values("+Proje_id+",'"+Gorev+"',"+Loginclass.bolum_id_tut+")";
Console.WriteLine(cmd.CommandText);
baglanti.Open();
cmd.ExecuteNonQuery();
baglanti.Close();
/*OnInitializedAsync();*/
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public void gorevata(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
SqlCommand cmd = baglanti.CreateCommand();
string email="";
string gorevtext="";
string projeadi="";
try
{
foreach(var mlt in ChoosedMulItem){
cmd.CommandText = "insert into gorev_ata(user_id,gorev_id,bolum_id) values("+mlt+","+GorevID+","+Loginclass.bolum_id_tut+")";
baglanti.Open();
cmd.ExecuteNonQuery();
baglanti.Close();
foreach(var user in user2)
{
if(user.user_id.ToString()==mlt)
{
email=user.email;
}
}
foreach(var gorev1 in gorev)
{
if(gorev1.gorev_id.ToString()==GorevID)
{
gorevtext=gorev1.gorev;
}
}
foreach(var gorev1 in gorev)
{
foreach(var prj in proje)
{
if(gorev1.proje_id==prj.proje_id && gorev1.gorev_id.ToString()==GorevID)
{
projeadi=prj.proje_adi;
}
}
}
MailYolla(email,gorevtext,projeadi);
}
ChoosedMulItem.Clear();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
protected override async Task OnInitializedAsync()
{
if(Loginclass.m1=="NULL" && Loginclass.m2=="NULL")
{
NavigationManager.NavigateTo("/");
}
else
{
if(Loginclass.rol_id_tut=="1"){
proje.Clear();
gorev.Clear();
bolum1.Clear();
user2.Clear();
/*atama.Clear();*/
proje=Projegetir();
gorev=Gorevgetir();
bolum1=BolumGetir1();
user2=Usergoster();
/*atama=Gorevatamagetir();*/
}
}
}
public List<Users2> Usergoster(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from users";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "user2");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Users2 pm = new Users2();
pm.user_id = Int32.Parse(dsps.Tables[0].Rows[i]["user_id"].ToString());
pm.isim = dsps.Tables[0].Rows[i]["isim"].ToString();
pm.soyisim = dsps.Tables[0].Rows[i]["soyisim"].ToString();
pm.email = dsps.Tables[0].Rows[i]["email"].ToString();
pm.rol_id = Int32.Parse(dsps.Tables[0].Rows[i]["rol_id"].ToString());
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
user2.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return user2;
}
public List<Gorevs> Gorevgetir(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Gorev";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "gorev");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Gorevs pm = new Gorevs();
pm.gorev_id = Int32.Parse(dsps.Tables[0].Rows[i]["gorev_id"].ToString());
pm.proje_id = Int32.Parse(dsps.Tables[0].Rows[i]["proje_id"].ToString());
pm.gorev = dsps.Tables[0].Rows[i]["gorev"].ToString();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.gorev_durum = Int32.Parse(dsps.Tables[0].Rows[i]["gorev_durum"].ToString());
gorev.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return gorev;
}
public List<Bolums1> BolumGetir1(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Bolum";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "bolum1");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Bolums1 pm = new Bolums1();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.bolum_adi = dsps.Tables[0].Rows[i]["bolum_adi"].ToString();
bolum1.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return bolum1;
}
public void MailYolla(string email,string gorev,string projeadi)
{
using (MailMessage mail = new MailMessage()) {
mail.From = new MailAddress("todo_bilgilendirme@hotmail.com");
mail.To.Add(email);
mail.Subject = "Görev Bilgilendirme";
mail.Body = projeadi+" projesinin "+gorev+" görevine atandın";
mail.IsBodyHtml = true;
using (SmtpClient smtp = new SmtpClient("smtp.outlook.com", 587))
{
smtp.Credentials = new System.Net.NetworkCredential("todo_bilgilendirme@hotmail.com", "02021982Ali");
smtp.EnableSsl =true;
smtp.Send(mail);
ResultMessage = "Mail Gitti";
}
}
}
public List<Projes> Projegetir(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Proje";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "proje");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Projes pm = new Projes();
pm.proje_id = Int32.Parse(dsps.Tables[0].Rows[i]["proje_id"].ToString());
pm.proje_adi = dsps.Tables[0].Rows[i]["proje_adi"].ToString();
pm.proje_baslangic = dsps.Tables[0].Rows[i]["proje_baslangic"].ToString();
pm.proje_bitis = dsps.Tables[0].Rows[i]["proje_bitis"].ToString();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
proje.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return proje;
}
public void ProjeID(ChangeEventArgs e){
Proje_id=e.Value.ToString();
}
public async void ChangedMulSelect()
{
ChoosedMulItem = await JSRuntime.InvokeAsync<IList<string>>("mulselect", new object[] {RefMulSelect});
foreach(var kisi2 in ChoosedMulItem)
{
Console.WriteLine(kisi2);
}
await InvokeAsync(StateHasChanged);
}
public void Gorevekleacil(){
JSRuntime.InvokeVoidAsync("JSgorevekle");
}
public void Gorevatamaacil(){
JSRuntime.InvokeVoidAsync("JSgorevatama");
}
}
}
@page "/gorevguncelle"
@inherits GorevGuncelleAtaBase
@if (gorevs is null)
{
<p><em>Loading... !</em></p>
}
else
{
<table class="table" style="width:40%;border:3px solid black;position:relative;float:left">
<thead>
<tr>
<th>Görev ID</th>
<th>Proje Adı</th>
<th>Görev</th>
<th>Bölüm ID</th>
<th>Görev Durum</th>
</tr>
</thead>
<tbody style="overflow: scroll;">
@foreach(var grv2 in gorevs)
{
<tr>
<td>@grv2.gorev_id</td>
@foreach(var prj2 in projes)
{
@if(grv2.proje_id==prj2.proje_id)
{
<td>@prj2.proje_adi</td>
}
}
<td>@grv2.gorev</td>
@foreach(var blm2 in bolums)
{
@if(grv2.bolum_id==blm2.bolum_id)
{
<td>@blm2.bolum_adi</td>
}
}
<td>@grv2.gorev_durum</td>
</tr>
}
</tbody>
</table>
}
<input type="button" id="grvguncellebtn" value="Gorev Guncelle" onclick="guncellegorev()">
<div id="guncellegorevdiv">
<input type="text" placeholder="Güncellenicek Görev Id girin" @bind:event="oninput" @bind="Gorevguncid">
<input type="text" placeholder="Görev Giriniz" @bind:event="oninput" @bind="Gorevyeni">
<button @onclick="gorevguncelle">Güncelle</button>
</div>
\ 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 Todo.Pages.LoginCheck;
namespace Todo.Pages
{
public class Projes3
{
public int proje_id {get;set;}
public string proje_adi {get;set;}
public string proje_baslangic {get;set;}
public string proje_bitis {get;set;}
public int bolum_id{get;set;}
}
public class Gorevs2{
public int gorev_id{get;set;}
public int proje_id{get;set;}
public string gorev {get;set;}
public int bolum_id{get;set;}
public int gorev_durum{get;set;}
}
public class Bolums2{
public int bolum_id{get;set;}
public string bolum_adi {get;set;}
}
public class GorevGuncelleAtaBase:ComponentBase
{
[Inject]
public NavigationManager NavigationManager { get; set; }
public List<Projes3> projes=new List<Projes3>();
public List<Gorevs2> gorevs=new List<Gorevs2>();
public List<Bolums2> bolums=new List<Bolums2>();
public string Gorevsilid{get;set;}
public string Gorevguncid{get;set;}
public string Gorevyeni{get;set;}
protected override async Task OnInitializedAsync()
{
if(Loginclass.m1=="NULL" && Loginclass.m2=="NULL")
{
NavigationManager.NavigateTo("/");
}
else
{
if(Loginclass.rol_id_tut=="1"){
projes.Clear();
gorevs.Clear();
bolums.Clear();
projes=Projegoster();
gorevs=Gorevgoster();
bolums=Bolumgoster();
}
}
}
public List<Gorevs2> Gorevgoster(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Gorev";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "gorevs");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Gorevs2 pm = new Gorevs2();
pm.gorev_id = Int32.Parse(dsps.Tables[0].Rows[i]["gorev_id"].ToString());
pm.proje_id = Int32.Parse(dsps.Tables[0].Rows[i]["proje_id"].ToString());
pm.gorev = dsps.Tables[0].Rows[i]["gorev"].ToString();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.gorev_durum = Int32.Parse(dsps.Tables[0].Rows[i]["gorev_durum"].ToString());
gorevs.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return gorevs;
}
public List<Bolums2> Bolumgoster(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Bolum";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "bolums");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Bolums2 pm = new Bolums2();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
pm.bolum_adi = dsps.Tables[0].Rows[i]["bolum_adi"].ToString();
bolums.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return bolums;
}
public List<Projes3> Projegoster(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
string sql = "select *from Proje";
SqlDataAdapter daps= new SqlDataAdapter (sql,baglanti);
DataSet dsps = new DataSet();
try
{
daps.Fill(dsps, "projes");
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Projes3 pm = new Projes3();
pm.proje_id = Int32.Parse(dsps.Tables[0].Rows[i]["proje_id"].ToString());
pm.proje_adi = dsps.Tables[0].Rows[i]["proje_adi"].ToString();
pm.proje_baslangic = dsps.Tables[0].Rows[i]["proje_baslangic"].ToString();
pm.proje_bitis = dsps.Tables[0].Rows[i]["proje_bitis"].ToString();
pm.bolum_id = Int32.Parse(dsps.Tables[0].Rows[i]["bolum_id"].ToString());
projes.Add(pm);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return projes;
}
public void gorevsil(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
baglanti.Open();
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText = "delete from gorev where gorev_id="+Int32.Parse(Gorevsilid)+"";
Console.WriteLine(cmd.CommandText);
cmd.ExecuteNonQuery();
baglanti.Close();
}
public void gorevguncelle(){
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
baglanti.Open();
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText = "update gorev set gorev='"+Gorevyeni+"' where gorev_id="+Int32.Parse(Gorevguncid)+"";
Console.WriteLine(cmd.CommandText);
cmd.ExecuteNonQuery();
baglanti.Close();
}
}
}
@page "/Index"
<PageTitle>Index</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
@page "/"
<div id="dis-div">
<div class="login-div">
<h1>Login</h1>
<div class="textbox">
<span class="material-icons">email</span>
<input class="input-1" type="email" @bind="loginemail" @bind:event="oninput" placeholder="Enter Email" >
</div>
<div class="textbox">
<span class="material-icons">lock</span>
<input class="input-1" type="password" @bind="loginpassword" @bind:event="oninput" id="password" placeholder="Enter Password" maxlength="8" >
@*/<div id="eye" @onclick="myFunction"></div>*@
</div>
<input class="submit-2" type="button" @onclick="login_giris" value="Login">
<br/><br/>
<p>Don't have an account?<a href="/register" style="color:red"> Register</a></p>
</div>
<div id="callback">
<p id="pp">Başarıyla Giriş Yapıldı</p>
</div>
<div id="callback2">
<p id="pp">Boyle bir hesap mevcut değil veya giriş bilgileri yanlış</p>
</div>
<div id="callback3">
<p id="pp">Giriş yapabilmeniz için onay bekleyiniz</p>
</div>
</div>
\ 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 Todo.Pages;
using static Todo.Pages.LoginCheck;
namespace Todo.Pages
{
public partial class Login
{
[Inject]
IJSRuntime JSRuntime { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public string loginemail{get;set;}
public string loginpassword{get;set;}
public string Result { get; set; }
protected override void OnInitialized()
{
Loginclass.m1="NULL";
Loginclass.m2="NULL";
}
public void login_giris(){
try{
string db = @"workstation id=blazortodos.mssql.somee.com;packet size=4096;user id=latral4_SQLLogin_1;pwd=516swqticy;data source=blazortodos.mssql.somee.com;persist security info=False;initial catalog=blazortodos";
SqlConnection baglanti = new SqlConnection(db);
SqlCommand cmd = baglanti.CreateCommand();
cmd.CommandText ="exec user_login '"+loginemail+"','"+loginpassword+"',@sayi OUTPUT,@onay OUTPUT,@roleid OUTPUT,@bolumsid OUTPUT,@kisiid OUTPUT";
Console.WriteLine(cmd.CommandText);
SqlParameter outputParam = cmd.Parameters.Add("@sayi", SqlDbType.Int);
outputParam.Direction = ParameterDirection.Output;
SqlParameter outputParam2 = cmd.Parameters.Add("@onay", SqlDbType.Int);
outputParam2.Direction = ParameterDirection.Output;
SqlParameter Roleid = cmd.Parameters.Add("@roleid", SqlDbType.Int);
Roleid.Direction = ParameterDirection.Output;
SqlParameter Bolumeid = cmd.Parameters.Add("@bolumsid", SqlDbType.Int);
Bolumeid.Direction = ParameterDirection.Output;
SqlParameter Kisiid = cmd.Parameters.Add("@kisiid", SqlDbType.Int);
Kisiid.Direction = ParameterDirection.Output;
baglanti.Open();
cmd.ExecuteNonQuery();
baglanti.Close();
if(outputParam.Value.ToString()=="1")
{
Loginclass.m1="NULL";
Loginclass.m2="NULL";
JSRuntime.InvokeVoidAsync("JSCallback2");
}
else if(outputParam.Value.ToString()=="2")
{
JSRuntime.InvokeVoidAsync("JSCallback3");
}
else if(outputParam.Value.ToString()=="3" && Roleid.Value.ToString()=="0")
{
Loginclass.m1=loginemail;
Loginclass.m2=loginpassword;
Loginclass.rol_id_tut=Roleid.Value.ToString();
Loginclass.bolum_id_tut=Bolumeid.Value.ToString();
Loginclass.kisi_id_tut=Kisiid.Value.ToString();
JSRuntime.InvokeVoidAsync("JSCallback");
JSRuntime.InvokeVoidAsync("yenile",Loginclass.rol_id_tut);
NavigationManager.NavigateTo("/Admin");
}
else if(outputParam.Value.ToString()=="3" && Roleid.Value.ToString()=="1")
{
Loginclass.m1=loginemail;
Loginclass.m2=loginpassword;
Loginclass.rol_id_tut=Roleid.Value.ToString();
Loginclass.bolum_id_tut=Bolumeid.Value.ToString();
Loginclass.kisi_id_tut=Kisiid.Value.ToString();
JSRuntime.InvokeVoidAsync("JSCallback");
JSRuntime.InvokeVoidAsync("yenile",Loginclass.rol_id_tut);
NavigationManager.NavigateTo("/gorevekleata");
}
else if(outputParam.Value.ToString()=="3" && Roleid.Value.ToString()=="2")
{
Loginclass.m1=loginemail;
Loginclass.m2=loginpassword;
Loginclass.rol_id_tut=Roleid.Value.ToString();
Loginclass.bolum_id_tut=Bolumeid.Value.ToString();
Loginclass.kisi_id_tut=Kisiid.Value.ToString();
JSRuntime.InvokeVoidAsync("JSCallback");
JSRuntime.InvokeVoidAsync("yenile",Loginclass.rol_id_tut);
NavigationManager.NavigateTo("/todo");
}
} catch(Exception e){
Console.WriteLine(e.Message);
}
}
}}
\ 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.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using Todo.Pages;
namespace Todo.Pages
{
public partial class LoginCheck{
public class Loginclass{
public static string m1{get;set;}="NULL";
public static string m2{get;set;}="NULL";
public static string rol_id_tut {get;set;}="NULL";
public static string bolum_id_tut{get;set;}="NULL";
public static string kisi_id_tut{get;set;}="NULL";
}
}}
\ No newline at end of file
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