0% found this document useful (0 votes)
92 views

Namespace: Administration

The document contains code for managing administration, customer registration, and employee maintenance functions for a bug tracking system. It includes code for login authentication, inserting customer and employee records into databases, and updating or deleting employee records. Functions are defined for validating user input, loading dropdown lists, and performing common database operations like selecting, inserting, updating and deleting records.

Uploaded by

Sowmi Daalu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Namespace: Administration

The document contains code for managing administration, customer registration, and employee maintenance functions for a bug tracking system. It includes code for login authentication, inserting customer and employee records into databases, and updating or deleting employee records. Functions are defined for validating user input, loading dropdown lists, and performing common database operations like selecting, inserting, updating and deleting records.

Uploaded by

Sowmi Daalu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 20

CODING

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 partial class Administration : System.Web.UI.Page

protected CCUtility Utility;

protected System.Web.UI.HtmlControls.HtmlInputHidden Login_querystring;


protected System.Web.UI.HtmlControls.HtmlInputHidden Login_ret_page;

protected string Administration_FormAction=".aspx?";

protected string Login_FormAction="Administration.aspx?";

public Administration()
{
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; }
}

protected void Page_Load(object sender, EventArgs e)


{
Utility=new CCUtility(this);

Utility.CheckSecurity(3);

if (Session["UserID"] != null && Int16.Parse(Session["UserID"].ToString()) > 0)


Login_logged = true;

if (!IsPostBack){
Page_Show(sender, e);
}
}

protected void Page_Unload(object sender, EventArgs e)


{

if(Utility!=null) Utility.DBClose();
}

protected void Page_Init(object sender, EventArgs e)


{

InitializeComponent();

Login_login.Click += new System.EventHandler (this.Login_login_Click);

protected void Page_Show(object sender, EventArgs e)


{
Administration_Show();
Login_Show();

protected void Administration_Show(){}


protected bool Login_logged = false;
void Login_Show() {

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;
}

protected void Login_login_Click(Object Src, EventArgs E) {


if (Login_logged) {

Login_logged = false;
Session["UserID"] = 0;
Session["UserRights"] = 0;
Login_Show();

} else {

int iPassed = Convert.ToInt32(Utility.Dlookup("employees", "count(*)", "login


='" + Login_name.Text + "' and pass='" + CCUtility.Quote(Login_password.Text) + "'"));
if (iPassed > 0) {

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) + "'"));

string sQueryString = Utility.GetParam("querystring");


string sPage = Utility.GetParam("ret_page");
if (! sPage.Equals(Request.ServerVariables["SCRIPT_NAME"]) &&
sPage.Length > 0) {
Response.Redirect(sPage + "?" + sQueryString);
} else {
Login_Show();
}
} else {
Login_message.Visible = true;
}

}
}

}
}

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
{

protected void Page_Load(object sender, System.EventArgs e)


{
// Put user code to initialize the page here
}

#region Web Form Designer generated code


override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{

}
#endregion

protected void Button1_Click(object sender, System.EventArgs e)


{
try
{
SqlConnection con=new
SqlConnection("server=.;database=bugtracking;uid=sa;");
con.Open();
SqlCommand cmd=new SqlCommand("insert into customerreg
values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" +
TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "')");
cmd.Connection=con;
cmd.ExecuteNonQuery();
SqlCommand cmd2=new SqlCommand("insert into employees
values('"+"customer_"+ TextBox4.Text +"','" + TextBox1.Text + "','" + TextBox2.Text + "','"+
TextBox6.Text +"',1)");
cmd2.Connection=con;
cmd2.ExecuteNonQuery();
Label1.Text="Customer Registered sucessfully";
con.Close();
}
catch(Exception ex)
{
Label1.Text=ex.Message.ToString();
}
}

protected void Button2_Click(object sender, System.EventArgs e)


{
Response.Redirect("home.aspx");

}
}
}

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 partial class EmployeeMaint : System.Web.UI.Page

protected CCUtility Utility;

protected string Employee_FormAction="EmployeeList.aspx?";


protected String[] Employee_security_level_lov = "1;Developer;3;Administrator".Split(new
Char[] {';'});

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; }
}

protected void Page_Load(object sender, EventArgs e)


{
Utility=new CCUtility(this);

if (!IsPostBack){

p_Employee_employee_id.Value =
Utility.GetParam("employee_id");Page_Show(sender, e);
}
}

protected void Page_Unload(object sender, EventArgs e)


{
if(Utility!=null) Utility.DBClose();
}

protected void Page_Init(object sender, EventArgs e)


{
InitializeComponent();
Employee_insert.ServerClick += new System.EventHandler
(this.Employee_Action);
Employee_update.ServerClick += new System.EventHandler
(this.Employee_Action);
Employee_delete.ServerClick += new System.EventHandler
(this.Employee_Action);

protected void Page_Show(object sender, EventArgs e)


{
Employee_Show();

private bool Employee_Validate(){


bool result=true;
Employee_ValidationSummary.Text="";
for(int i=0;i<Page.Validators.Count;i++){

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);

string sSQL = "select * from employees where " + sWhere;

SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);

DataSet ds = new DataSet();


DataRow row;

if (dsCommand.Fill(ds, 0, 1, "Employee") > 0) {


row = ds.Tables[0].Rows[0];

Employee_employee_id.Value = CCUtility.GetValue(row, "employee_id");

Employee_login.Text = CCUtility.GetValue(row, "login");


Employee_pass.Text = CCUtility.GetValue(row, "pass");
{string s;
s=CCUtility.GetValue(row, "security_level");

try
{Employee_security_level.SelectedIndex=Employee_security_level.Items.IndexOf(Employee_s
ecurity_level.Items.FindByValue(s));
}catch{}}

Employee_employee_name.Text = CCUtility.GetValue(row, "employee_name");


Employee_email.Text = CCUtility.GetValue(row, "email");
Employee_insert.Visible=false;
ActionInsert=false;

}}

if(ActionInsert){
Employee_delete.Visible=false;
Employee_update.Visible=false;

bool Employee_insert_Click(Object Src, EventArgs E) {


string sSQL="";
bool bResult=Employee_Validate();

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");

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 bResult;
}

void Employee_BeforeSQLExecute(string SQL,String Action){ }

bool Employee_update_Click(Object Src, EventArgs E) {


string sWhere = "";
string sSQL ="";

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){

sSQL = "update employees set " +


"[login]="
+CCUtility.ToSQL(Utility.GetParam("Employee_login"),FieldTypes.Text) +
",[pass]="
+CCUtility.ToSQL(Utility.GetParam("Employee_pass"),FieldTypes.Text) +
",[security_level]="
+CCUtility.ToSQL(Utility.GetParam("Employee_security_level"),FieldTypes.Number) +
",[employee_name]="
+CCUtility.ToSQL(Utility.GetParam("Employee_employee_name"),FieldTypes.Text) +
",[email]="
+CCUtility.ToSQL(Utility.GetParam("Employee_email"),FieldTypes.Text) ;

sSQL = sSQL + " where " + sWhere;

Employee_BeforeSQLExecute(sSQL,"Update");

SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

try {
cmd.ExecuteNonQuery();
} catch(Exception e) {
Employee_ValidationSummary.Text += e.Message;
Employee_ValidationSummary.Visible = true;
return false;
}
}

if (bResult){

}
}
return bResult;
}

bool Employee_delete_Click(Object Src, EventArgs E) {


string sWhere = "";

if (p_Employee_employee_id.Value.Length > 0) {
sWhere += "employee_id=" +
CCUtility.ToSQL(p_Employee_employee_id.Value, FieldTypes.Number);
}

string sSQL = "delete from employees where " + sWhere;


Employee_BeforeSQLExecute(sSQL,"Delete");

//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;
}

void Employee_Action(Object Src, EventArgs E) {


bool bResult=true;
if(((HtmlInputButton)Src).ID.IndexOf("insert")>0) bResult=Employee_insert_Click(Src,E);
if(((HtmlInputButton)Src).ID.IndexOf("update")>0) bResult=Employee_update_Click(Src,E);
if(((HtmlInputButton)Src).ID.IndexOf("delete")>0) bResult=Employee_delete_Click(Src,E);

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 partial class BugRecord : System.Web.UI.Page


{

protected CCUtility Utility;

protected string Bugs_FormAction="Default.aspx?";

public BugRecord()
{
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; }
}

protected void Page_Load(object sender, EventArgs e)


{
Utility=new CCUtility(this);

Utility.CheckSecurity(1);

if (!IsPostBack){

p_Bugs_bug_id.Value = Utility.GetParam("bug_id");Page_Show(sender,
e);
}
}

protected void Page_Unload(object sender, EventArgs e)


{
if(Utility!=null) Utility.DBClose();
}

protected void Page_Init(object sender, EventArgs e)


{
InitializeComponent();
Bugs_insert.ServerClick += new System.EventHandler (this.Bugs_Action);
Bugs_update.ServerClick += new System.EventHandler (this.Bugs_Action);
Bugs_delete.ServerClick += new System.EventHandler (this.Bugs_Action);
Bugs_cancel.ServerClick += new System.EventHandler (this.Bugs_Action);
}

protected void Page_Show(object sender, EventArgs e)


{
Bugs_Show();

}
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() {

Utility.buildListBox(Bugs_project_id.Items,"select project_id,project_name from projects order


by 2","project_id","project_name",null,"");
Utility.buildListBox(Bugs_priority_id.Items,"select priority_id,priority_desc from priorities
order by 2","priority_id","priority_desc",null,"");
Utility.buildListBox(Bugs_assigned_to.Items,"select employee_id,employee_name from
employees order by 2","employee_id","employee_name",null,"");
Utility.buildListBox(Bugs_status_id.Items,"select status_id,status from statuses order by
2","status_id","status",null,"");

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 sSQL = "select * from bugs where " + sWhere;

SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL,Utility.Connection);

DataSet ds = new DataSet();


DataRow row;

if (dsCommand.Fill(ds, 0, 1, "Bugs") > 0) {


row = ds.Tables[0].Rows[0];

Bugs_bug_id.Value = CCUtility.GetValue(row, "bug_id");

Bugs_bug_name.Text = CCUtility.GetValue(row, "bug_name");


Bugs_bug_desc.Text = CCUtility.GetValue(row, "bug_desc");

{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{}}

Bugs_assigned_by.Text =Server.HtmlEncode( Utility.Dlookup("employees",


"employee_name", "employee_id=" + CCUtility.ToSQL(CCUtility.GetValue(row,
"assigned_by"), FieldTypes.Number)).ToString());
{string s;
s=CCUtility.GetValue(row, "assigned_to");

try
{Bugs_assigned_to.SelectedIndex=Bugs_assigned_to.Items.IndexOf(Bugs_assigned_to.Items.Fi
ndByValue(s));
}catch{}}

Bugs_date_assigned.Text = CCUtility.GetValue(row, "date_assigned");

{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_date_resolved.Text = CCUtility.GetValue(row, "date_resolved");


Bugs_resolution.Text = CCUtility.GetValue(row, "resolution");

Bugs_insert.Visible=false;
ActionInsert=false;

}}

if(ActionInsert){

String pValue;

pValue = Utility.GetParam("bug_id");Bugs_bug_id.Value = pValue;


if(Session["UserID"]!=null)
pValue = Session["UserID"].ToString();
else
pValue="";if (pValue.Length>0){Bugs_assigned_by.Text =
Utility.Dlookup("employees", "employee_name", "employee_id=" +
pValue);}Bugs_delete.Visible=false;
Bugs_update.Visible=false;

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");

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 bResult;
}

void Bugs_BeforeSQLExecute(string SQL,String Action){

bool Bugs_update_Click(Object Src, EventArgs E) {


string sWhere = "";
string sSQL ="";

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){

sSQL = "update bugs set " +


"[bug_name]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_bug_name"),FieldTypes.Text) +
",[bug_desc]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_bug_desc"),FieldTypes.Text) +
",[project_id]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_project_id"),FieldTypes.Number) +
",[priority_id]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_priority_id"),FieldTypes.Number) +
",[assigned_to]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_assigned_to"),FieldTypes.Number) +
",[date_assigned]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_date_assigned"),FieldTypes.Text) +
",[status_id]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_status_id"),FieldTypes.Number) +
",[date_resolved]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_date_resolved"),FieldTypes.Text) +
",[resolution]="
+CCUtility.ToSQL(Utility.GetParam("Bugs_resolution"),FieldTypes.Text) ;

sSQL = sSQL + " where " + sWhere;

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;
}

bool Bugs_delete_Click(Object Src, EventArgs E) {


string sWhere = "";

if (p_Bugs_bug_id.Value.Length > 0) {
sWhere += "bug_id=" + CCUtility.ToSQL(p_Bugs_bug_id.Value,
FieldTypes.Number);
}

string sSQL = "delete from bugs where " + sWhere;

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;
}

void Bugs_Action(Object Src, EventArgs E) {


bool bResult=true;
if(((HtmlInputButton)Src).ID.IndexOf("insert")>0) bResult=Bugs_insert_Click(Src,E);
if(((HtmlInputButton)Src).ID.IndexOf("update")>0) bResult=Bugs_update_Click(Src,E);
if(((HtmlInputButton)Src).ID.IndexOf("delete")>0) bResult=Bugs_delete_Click(Src,E);
if(((HtmlInputButton)Src).ID.IndexOf("cancel")>0) bResult=Bugs_cancel_Click(Src,E);

if(bResult)Response.Redirect(Bugs_FormAction+"");
} }
}

You might also like