using System;
using System.Data.SqlClient;
using Microsoft.JSInterop;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using System.Data;
using Todo_App.Data;
using System.Text.Json;
namespace Todo_App.Pages{
    public partial class AdminTeamsPage{
        public class gelen_ekipler{
          public int  ekip_ID{get;set;}
          public string ekip_Adi{get;set;}
          public int ekip_uye_sayisi{get;set;}
          public int ekip_lider_ID{get;set;} 
        }
        SqlConnection baglanti2 = new SqlConnection("workstation id=BlazorOSM.mssql.somee.com;packet size=4096;user id=mssql_58_SQLLogin_1;pwd=ztdvdv9bog;data source=BlazorOSM.mssql.somee.com;persist security info=False;initial catalog=BlazorOSM");
     
        List<gelen_ekipler> gelen_ekipler_list=new List<gelen_ekipler>();
        protected override void OnInitialized(){
             try
            {
                SqlCommand cmd = new SqlCommand("Todo_Get_Teams", baglanti2);
                cmd.CommandType = CommandType.StoredProcedure;
                baglanti2.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    gelen_ekipler_list.Add(new gelen_ekipler {ekip_ID =Int32.Parse(dr["Team_ID"].ToString()),ekip_Adi =dr["Team_name"].ToString(),ekip_lider_ID=Int32.Parse(dr["Team_leader_ID"].ToString()),ekip_uye_sayisi=Int32.Parse(dr["Team_member_number"].ToString())});
                }
                baglanti2.Close();
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
            }
        }
    }
    
}