Initial commit
This commit is contained in:
38
Helper/Log.cs
Normal file
38
Helper/Log.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Configuration;
|
||||
using Microsoft.JScript;
|
||||
using Convert = System.Convert;
|
||||
|
||||
namespace QW2021C.Helper
|
||||
{
|
||||
public class Log
|
||||
{
|
||||
public void insert_entry(int loglevel, int userid, string description)
|
||||
{
|
||||
clsDB db = new clsDB();
|
||||
if (loglevel <= get_level()) db.insert_log(loglevel, userid, description);
|
||||
}
|
||||
|
||||
private int get_level()
|
||||
{
|
||||
return Convert.ToInt32(ConfigurationSettings.AppSettings["LogLevel"]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
63
Helper/Messagebox.cs
Normal file
63
Helper/Messagebox.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace QW2021C.Helper
|
||||
{
|
||||
public class MessageBox
|
||||
{
|
||||
// Lets keep the message coming from all the pages here
|
||||
static Dictionary<Page, Queue> pageTable = null;
|
||||
|
||||
static MessageBox()
|
||||
{
|
||||
// Create the store
|
||||
pageTable = new Dictionary<Page, Queue>();
|
||||
}
|
||||
|
||||
public static void Show(string str)
|
||||
{
|
||||
// Lets find out what page is sending the request
|
||||
Page page = HttpContext.Current.Handler as Page;
|
||||
|
||||
// If a valid page is found
|
||||
if (page != null)
|
||||
{
|
||||
// Check if this page is requesing message show for the first time
|
||||
if (pageTable.ContainsKey(page) == false)
|
||||
{
|
||||
// Lets create a message queue dedicated for this page.
|
||||
pageTable.Add(page, new Queue());
|
||||
}
|
||||
|
||||
// Let us add messages of this to the queue now
|
||||
pageTable[page].Enqueue(str);
|
||||
|
||||
// Now let put a hook on the page unload where we will show our message
|
||||
page.Unload += new EventHandler(page_Unload);
|
||||
}
|
||||
}
|
||||
|
||||
static void page_Unload(object sender, EventArgs e)
|
||||
{
|
||||
// Lets find out which page is getting unloaded
|
||||
Page page = sender as Page;
|
||||
|
||||
// If a valid page is founf
|
||||
if (page != null)
|
||||
{
|
||||
// Extract the messages for this page and push them to client side
|
||||
HttpContext.Current.Response.Write("<script>alert('" + pageTable[page].Dequeue() + "');</script>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
106
Helper/wettkampf.cs
Normal file
106
Helper/wettkampf.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
30
Helper/zipHelper.cs
Normal file
30
Helper/zipHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace QW2021C.Helper
|
||||
{
|
||||
public class zipHelper
|
||||
{
|
||||
public void Decompress(FileInfo fileToDecompress)
|
||||
{
|
||||
using (FileStream originalFileStream = fileToDecompress.OpenRead())
|
||||
{
|
||||
string currentFileName = fileToDecompress.FullName;
|
||||
string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);
|
||||
|
||||
using (FileStream decompressedFileStream = File.Create(newFileName))
|
||||
{
|
||||
using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
|
||||
{
|
||||
decompressionStream.CopyTo(decompressedFileStream);
|
||||
Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user