protected void LinkButtonGetEmployee_Click(object sender, EventArgs e) { try { DataLayer.Employees es = new DataLayer.Employees(); DataLayer.Employee employee = es.GetEmployee(int.Parse(TextBoxEID.Text)); TextBoxFName.Text = employee.FirstName; TextBoxLName.Text = employee.LastName; TextBoxDepartment.Text = employee.DepartmentName; LabelDeptId.Text = employee.DepartmentId.ToString(); hfOldDeptName.Value = employee.DepartmentName; DataLayer.ApplicationLog.Add4("Searched for user id: " + TextBoxEID.Text); GridViewAppLog.DataSource = DataLayer.ApplicationLog.GetLog("ASPDemo Application"); GridViewAppLog.DataBind(); } catch (SqlException sqlex) { // Connection error... LabelError.Text = sqlex.Message; } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LabelError.Text = ""; try { string connString = DataLayer.DB.ConnectionString; DataLayer.DB.ApplicationName = "ASPDemo Application"; DataLayer.DB.ConnectionTimeout = 5; SqlConnection conn = DataLayer.DB.GetSqlConnection(); GridViewAppLog.DataSource = DataLayer.ApplicatioLog.GetLog("ASPDemo Application"); GridViewAppLog.DataBind(); } catch (SqlException sqlex) { LabelError.Text = sqlex.Message; } } }