Beruflich Dokumente
Kultur Dokumente
Admin
namespace Bug_Management
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public Administration()
{
this.Init += new System.EventHandler(Page_Init);
}
Utility.CheckSecurity(3);
if (!IsPostBack){
Page_Show(sender, e);
}
}
if(Utility!=null) Utility.DBClose();
}
InitializeComponent();
if (Login_logged) {
Login_login.Text = "Logout";
Login_trpassword.Visible = false;
Login_trname.Visible = false;
Login_labelname.Visible = true;
Login_labelname.Text = Utility.Dlookup("employees", "login", "employee_id="
+ Session["UserID"]) + " ";
} else {
Login_login.Text = "Login";
Login_trpassword.Visible = true;
Login_trname.Visible = true;
Login_labelname.Visible = false;
}
Login_logged = false;
Session["UserID"] = 0;
Session["UserRights"] = 0;
Login_Show();
} else {
Login_message.Visible = false;
Session["UserID"] = Convert.ToInt32(Utility.Dlookup("employees",
"employee_id", "login ='" + Login_name.Text + "' and pass='" +
CCUtility.Quote(Login_password.Text) +"'"));
Login_logged = true;
Session["UserRights"] = Convert.ToInt32(Utility.Dlookup("employees",
"security_level", "login ='" + Login_name.Text + "' and pass='" +
CCUtility.Quote(Login_password.Text) + "'"));
}
}
}
}
Customer Reg
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace bug
{
/// <summary>
/// Summary description for cusreg.
/// </summary>
public partial class cusreg : System.Web.UI.Page
{
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
}
Employee
namespace Bug_Management
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public EmployeeMaint()
{
this.Init += new System.EventHandler(Page_Init);
}
public void ValidateNumeric(object source, ServerValidateEventArgs args) {
try{
Decimal temp=Decimal.Parse(args.Value);
args.IsValid=true;
}catch{
args.IsValid=false; }
}
if (!IsPostBack){
p_Employee_employee_id.Value =
Utility.GetParam("employee_id");Page_Show(sender, e);
}
}
if(((System.Web.UI.WebControls.BaseValidator)Page.Validators[i]).ID.ToString().StartsWith("
Employee")){
if(!Page.Validators[i].IsValid){
Employee_ValidationSummary.Text+=Page.Validators[i].ErrorMessage+"<br>";
result=false;
}
}
}
Employee_ValidationSummary.Visible=(!result);
return result;
}
void Employee_Show() {
Utility.buildListBox(Employee_security_level.Items,Employee_security_level_lov,null,"");
bool ActionInsert=true;
if (p_Employee_employee_id.Value.Length > 0 ) {
string sWhere = "";
sWhere += "employee_id=" +
CCUtility.ToSQL(p_Employee_employee_id.Value, FieldTypes.Number);
try
{Employee_security_level.SelectedIndex=Employee_security_level.Items.IndexOf(Employee_s
ecurity_level.Items.FindByValue(s));
}catch{}}
}}
if(ActionInsert){
Employee_delete.Visible=false;
Employee_update.Visible=false;
string p2_login=CCUtility.ToSQL(Utility.GetParam("Employee_login"),
FieldTypes.Text) ;
string p2_pass=CCUtility.ToSQL(Utility.GetParam("Employee_pass"),
FieldTypes.Text) ;
string
p2_security_level=CCUtility.ToSQL(Utility.GetParam("Employee_security_level"),
FieldTypes.Number) ;
string
p2_employee_name=CCUtility.ToSQL(Utility.GetParam("Employee_employee_name"),
FieldTypes.Text) ;
string p2_email=CCUtility.ToSQL(Utility.GetParam("Employee_email"),
FieldTypes.Text) ;
if(bResult){
if(sSQL.Length==0){
sSQL = "insert into employees (" +
"login," +
"pass," +
"security_level," +
"employee_name," +
"email)" +
" values (" +
p2_login + "," +
p2_pass + "," +
p2_security_level + "," +
p2_employee_name + "," +
p2_email + ")";
}
Employee_BeforeSQLExecute(sSQL,"Insert");
}
return bResult;
}
bool bResult=Employee_Validate();
if(bResult){
if (p_Employee_employee_id.Value.Length > 0) {
sWhere = sWhere + "employee_id=" +
CCUtility.ToSQL(p_Employee_employee_id.Value, FieldTypes.Number);
}
if (bResult){
Employee_BeforeSQLExecute(sSQL,"Update");
try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Employee_ValidationSummary.Text += e.Message;
Employee_ValidationSummary.Visible = true;
return false;
}
}
if (bResult){
}
}
return bResult;
}
if (p_Employee_employee_id.Value.Length > 0) {
sWhere += "employee_id=" +
CCUtility.ToSQL(p_Employee_employee_id.Value, FieldTypes.Number);
}
//Changed
//OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
//as
SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);
try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Employee_ValidationSummary.Text += e.Message;
Employee_ValidationSummary.Visible = true;
return false;
}
return true;
}
Bug Record
namespace Bug_Management
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public BugRecord()
{
this.Init += new System.EventHandler(Page_Init);
}
Utility.CheckSecurity(1);
if (!IsPostBack){
p_Bugs_bug_id.Value = Utility.GetParam("bug_id");Page_Show(sender,
e);
}
}
}
private bool Bugs_Validate(){
bool result=true;
Bugs_ValidationSummary.Text="";
for(int i=0;i<Page.Validators.Count;i++){
if(((System.Web.UI.WebControls.BaseValidator)Page.Validators[i]).ID.ToString().StartsWith("
Bugs")){
if(!Page.Validators[i].IsValid){
Bugs_ValidationSummary.Text+=Page.Validators[i].ErrorMessage+"<br>";
result=false;
}
}
}
Bugs_ValidationSummary.Visible=(!result);
return result;
}
void Bugs_Show() {
bool ActionInsert=true;
if (p_Bugs_bug_id.Value.Length > 0 ) {
string sWhere = "";
sWhere += "bug_id=" + CCUtility.ToSQL(p_Bugs_bug_id.Value,
FieldTypes.Number);
{string s;
s=CCUtility.GetValue(row, "project_id");
try
{Bugs_project_id.SelectedIndex=Bugs_project_id.Items.IndexOf(Bugs_project_id.Items.FindBy
Value(s));
}catch{}}
{string s;
s=CCUtility.GetValue(row, "priority_id");
if(s.Length==0) s= "3";
try
{Bugs_priority_id.SelectedIndex=Bugs_priority_id.Items.IndexOf(Bugs_priority_id.Items.Find
ByValue(s));
}catch{}}
try
{Bugs_assigned_to.SelectedIndex=Bugs_assigned_to.Items.IndexOf(Bugs_assigned_to.Items.Fi
ndByValue(s));
}catch{}}
{string s;
s=CCUtility.GetValue(row, "status_id");
if(s.Length==0) s= "1";
try
{Bugs_status_id.SelectedIndex=Bugs_status_id.Items.IndexOf(Bugs_status_id.Items.FindByVal
ue(s));
}catch{}}
Bugs_insert.Visible=false;
ActionInsert=false;
}}
if(ActionInsert){
String pValue;
Bugs_date_assigned.Text=DateTime.Today.ToString("d"); }
}
bool Bugs_insert_Click(Object Src, EventArgs E) {
string sSQL="";
bool bResult=Bugs_Validate();
string s1_UserID=CCUtility.ToSQL(Session["UserID"].ToString(),
FieldTypes.Number);
string p2_bug_name=CCUtility.ToSQL(Utility.GetParam("Bugs_bug_name"),
FieldTypes.Text) ;
string p2_bug_desc=CCUtility.ToSQL(Utility.GetParam("Bugs_bug_desc"),
FieldTypes.Text) ;
string p2_project_id=CCUtility.ToSQL(Utility.GetParam("Bugs_project_id"),
FieldTypes.Number) ;
string p2_priority_id=CCUtility.ToSQL(Utility.GetParam("Bugs_priority_id"),
FieldTypes.Number) ;
string p2_assigned_to=CCUtility.ToSQL(Utility.GetParam("Bugs_assigned_to"),
FieldTypes.Number) ;
string
p2_date_assigned=CCUtility.ToSQL(Utility.GetParam("Bugs_date_assigned"),
FieldTypes.Text) ;
string p2_status_id=CCUtility.ToSQL(Utility.GetParam("Bugs_status_id"),
FieldTypes.Number) ;
string
p2_date_resolved=CCUtility.ToSQL(Utility.GetParam("Bugs_date_resolved"),
FieldTypes.Text) ;
string p2_resolution=CCUtility.ToSQL(Utility.GetParam("Bugs_resolution"),
FieldTypes.Text) ;
if(bResult){
if(sSQL.Length==0){
sSQL = "insert into bugs (" +
"[assigned_by]," +
"bug_name," +
"bug_desc," +
"project_id," +
"priority_id," +
"assigned_to," +
"date_assigned," +
"status_id," +
"date_resolved," +
"resolution)" +
" values (" +
s1_UserID + "," +
p2_bug_name + "," +
p2_bug_desc + "," +
p2_project_id + "," +
p2_priority_id + "," +
p2_assigned_to + "," +
p2_date_assigned + "," +
p2_status_id + "," +
p2_date_resolved + "," +
p2_resolution + ")";
}
Bugs_BeforeSQLExecute(sSQL,"Insert");
try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Bugs_ValidationSummary.Text += e.Message;
Bugs_ValidationSummary.Visible = true;
return false;
}
}
return bResult;
}
bool bResult=Bugs_Validate();
if(bResult){
if (p_Bugs_bug_id.Value.Length > 0) {
sWhere = sWhere + "bug_id=" + CCUtility.ToSQL(p_Bugs_bug_id.Value,
FieldTypes.Number);
}
if (bResult){
Bugs_BeforeSQLExecute(sSQL,"Update");
//changed
//OleDbCommand cmd = new OleDbCommand(sSQL,
Utility.Connection);
//as
SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);
try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Bugs_ValidationSummary.Text += e.Message;
Bugs_ValidationSummary.Visible = true;
return false;
}
}
if (bResult){
}
}
return bResult;
}
if (p_Bugs_bug_id.Value.Length > 0) {
sWhere += "bug_id=" + CCUtility.ToSQL(p_Bugs_bug_id.Value,
FieldTypes.Number);
}
Bugs_BeforeSQLExecute(sSQL,"Delete");
SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);
try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Bugs_ValidationSummary.Text += e.Message;
Bugs_ValidationSummary.Visible = true;
return false;
}
return true;
}
if(bResult)Response.Redirect(Bugs_FormAction+"");
} }
}