You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.8 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace QW2021C.Helper
{
public class wettkampf
{
public string W1 { get; set; }
public string W2 { get; set; }
public string W3 { get; set; }
public string W4 { get; set; }
public Boolean ar1 { get; set; }
public Boolean ar2 { get; set; }
public Boolean ar3 { get; set; }
public Boolean ar4 { get; set; }
public wettkampf()
{
get_wettkaempfe();
this.ar1 = get_anmelderunde("1");
this.ar2 = get_anmelderunde("2");
this.ar3 = get_anmelderunde("3");
this.ar4 = get_anmelderunde("4");
}
public string get_wettkampforte_oneString()
{
return "Wettkampforte: " + this.W1 + ", " + this.W2 + ", " + this.W3 + ", " + this.W4 + ", ";
}
public void get_wettkaempfe()
{
clsDB db = new clsDB();
SqlConnection myConnection = new SqlConnection(db.Connectionstring);
SqlCommand myCommand = new SqlCommand("get_wettkaempfe", myConnection);
myCommand.Parameters.Add(new SqlParameter("@w1", SqlDbType.VarChar, 50, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, 0));
myCommand.Parameters.Add(new SqlParameter("@w2", SqlDbType.VarChar, 50, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, 0));
myCommand.Parameters.Add(new SqlParameter("@w3", SqlDbType.VarChar, 50, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, 0));
myCommand.Parameters.Add(new SqlParameter("@w4", SqlDbType.VarChar, 50, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, 0));
myCommand.CommandType = CommandType.StoredProcedure;
try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
this.W1 = myCommand.Parameters["@W1"].Value.ToString();
this.W2 = myCommand.Parameters["@W2"].Value.ToString();
this.W3 = myCommand.Parameters["@W3"].Value.ToString();
this.W4 = myCommand.Parameters["@W4"].Value.ToString();
}
catch (Exception ex)
{
//return null;
}
finally
{
if (myConnection.State == ConnectionState.Open)
myConnection.Close();
}
}
public Boolean get_anmelderunde(string runde)
{
clsDB db = new clsDB();
SqlConnection myConnection = new SqlConnection(db.Connectionstring);
SqlCommand myCommand = new SqlCommand("get_anmelderunde", myConnection);
myCommand.Parameters.Add(new SqlParameter("@ar", SqlDbType.VarChar, 50, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, runde));
myCommand.Parameters.Add(new SqlParameter("@re", SqlDbType.VarChar, 50, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, 0));
myCommand.CommandType = CommandType.StoredProcedure;
try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
if (myCommand.Parameters["@re"].Value.ToString() == "1")
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
finally
{
if (myConnection.State == ConnectionState.Open)
myConnection.Close();
}
}
}
}