Initial commit
This commit is contained in:
186
Administration/AdminTeilnehmer.aspx.cs
Normal file
186
Administration/AdminTeilnehmer.aspx.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace QW2021C.Administration
|
||||
{
|
||||
public partial class AdminTeilnehmer : System.Web.UI.Page
|
||||
{
|
||||
List<Geschlecht> geschlechter = new List<Geschlecht>();
|
||||
List<Natianlitaet> nationalitaeten = new List<Natianlitaet>();
|
||||
List<Kategorie> kategorien = new List<Kategorie>();
|
||||
|
||||
Helper.Log log = new Helper.Log();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (Page.IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (Session["LoggedIn"].ToString() == "False")
|
||||
{
|
||||
Response.Redirect("~/default.aspx");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
Response.Redirect("~/default.aspx");
|
||||
return;
|
||||
|
||||
}
|
||||
BindDataSource();
|
||||
}
|
||||
|
||||
public void BindDataSource()
|
||||
{
|
||||
clsDB db = new clsDB();
|
||||
db.Get_Tabledata("Select geschlecht from geschlecht", false, true);
|
||||
foreach (DataRow r in db.dsdaten.Tables[0].Rows)
|
||||
geschlechter.Add(new Geschlecht(r[0].ToString()));
|
||||
var index = this.Grid1.Columns.FindIndex(col => col.Field == "Geschlecht");
|
||||
this.Grid1.Columns.ElementAt(index).DataSource = geschlechter;
|
||||
|
||||
db.dsdaten.Tables.Clear();
|
||||
db.Get_Tabledata(" SELECT [Nationalitaet] FROM [nat] ORDER BY [Nationalitaet]", false, true);
|
||||
foreach (DataRow r in db.dsdaten.Tables[0].Rows)
|
||||
nationalitaeten.Add(new Natianlitaet(r[0].ToString()));
|
||||
var index1 = this.Grid1.Columns.FindIndex(col => col.Field == "Nationalitaet");
|
||||
this.Grid1.Columns.ElementAt(index1).DataSource = nationalitaeten;
|
||||
|
||||
|
||||
db.dsdaten.Tables.Clear();
|
||||
db.Get_Tabledata("SELECT [Kategorie] FROM [kat] where aktiv=1 order by kategorie", false, true);
|
||||
foreach (DataRow r in db.dsdaten.Tables[0].Rows)
|
||||
kategorien.Add(new Kategorie(r[0].ToString()));
|
||||
var index2 = this.Grid1.Columns.FindIndex(col => col.Field == "Kategorie");
|
||||
this.Grid1.Columns.ElementAt(index2).DataSource = kategorien;
|
||||
}
|
||||
|
||||
private List<Fehler> Errors = new List<Fehler>();
|
||||
protected void Button1_Click(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e)
|
||||
{
|
||||
clsDB db = new clsDB();
|
||||
db.Add_New_Teilnehmer("", Session["UserID"].ToString());
|
||||
this.Grid1.DataBind();
|
||||
log.insert_entry(2, Convert.ToInt32(Session["UserID"]), "Teilnehmer hinzugefügt");
|
||||
}
|
||||
|
||||
protected void Grid1_ServerEditRow(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
|
||||
{
|
||||
clsDB db = new clsDB();
|
||||
Dictionary<string, object> data = e.Arguments["data"] as Dictionary<string, object>;
|
||||
|
||||
db.Get_Tabeldata_for_Update("Select * from teilnehmer where teilnehmernr=" + data["Teilnehmernr"].ToString());
|
||||
foreach (KeyValuePair<string, object> keyval in data)
|
||||
db.dsdaten.Tables[0].Rows[0][keyval.Key] = keyval.Value;
|
||||
db.Update_Tabeldata();
|
||||
this.Grid1.DataBind();
|
||||
//Check_Teilnehmer();
|
||||
//log.insert_entry(2, Convert.ToInt32(Session["UserID"]), "Teilnehmer gespeichert");
|
||||
}
|
||||
|
||||
private void Check_Teilnehmer()
|
||||
{
|
||||
|
||||
clsDB db = new clsDB();
|
||||
DataTable paramdaten = new DataTable();
|
||||
DataRow dbr = paramdaten.NewRow();
|
||||
|
||||
paramdaten.Columns.Clear();
|
||||
paramdaten.Rows.Clear();
|
||||
|
||||
|
||||
dbr = paramdaten.NewRow();
|
||||
paramdaten.Columns.Add("Paramname");
|
||||
paramdaten.Columns.Add("Paramvalue");
|
||||
|
||||
dbr[0] = "@VereinNr";
|
||||
dbr[1] = Session["Vereinnr"].ToString();
|
||||
paramdaten.Rows.Add(dbr);
|
||||
dbr = paramdaten.NewRow();
|
||||
dbr[0] = "@UserNr";
|
||||
dbr[1] = Session["Userid"].ToString();
|
||||
paramdaten.Rows.Add(dbr);
|
||||
Panel1.Visible = false;
|
||||
db.Get_Tabledata("chk_teilnehmer", "", "", "", true, paramdaten);
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
Panel1.Visible = true;
|
||||
foreach (DataRow r in db.dsdaten.Tables[0].Rows)
|
||||
Errors.Add(new Fehler(r[0].ToString(), r[1].ToString()));
|
||||
this.Fehlergrid.DataSource = Errors;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
public class Geschlecht
|
||||
{
|
||||
public Geschlecht()
|
||||
{
|
||||
}
|
||||
|
||||
public Geschlecht(string geschlecht)
|
||||
{
|
||||
this.Geschl = geschlecht;
|
||||
this.Geschlecht_Bez = geschlecht;
|
||||
}
|
||||
|
||||
public string Geschl { get; set; }
|
||||
public string Geschlecht_Bez { get; set; }
|
||||
}
|
||||
|
||||
public class Natianlitaet
|
||||
{
|
||||
public Natianlitaet()
|
||||
{
|
||||
}
|
||||
|
||||
public Natianlitaet(string nationalitaet)
|
||||
{
|
||||
this.Nationalitaet = nationalitaet;
|
||||
this.Nationalitaet_Bez = nationalitaet;
|
||||
}
|
||||
|
||||
public string Nationalitaet { get; set; }
|
||||
public string Nationalitaet_Bez { get; set; }
|
||||
}
|
||||
|
||||
public class Kategorie
|
||||
{
|
||||
public Kategorie()
|
||||
{
|
||||
}
|
||||
|
||||
public Kategorie(string kategorie)
|
||||
{
|
||||
this.Kat = kategorie;
|
||||
this.Kategorie_Bez = kategorie;
|
||||
}
|
||||
public string Kat { get; set; }
|
||||
public string Kategorie_Bez { get; set; }
|
||||
}
|
||||
|
||||
public class Fehler
|
||||
{
|
||||
public Fehler()
|
||||
{
|
||||
}
|
||||
|
||||
public Fehler(string Teilnehmer, string Fehlerbeschreibung)
|
||||
{
|
||||
this.Teilnehmer = Teilnehmer;
|
||||
this.Fehlerbeschreibung = Fehlerbeschreibung;
|
||||
}
|
||||
public string Teilnehmer { get; set; }
|
||||
public string Fehlerbeschreibung { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user