private void btnLink_Click(object sender, System.EventArgs e) { try { inspect = new clsInspections(); inspect.cAction = "I"; inspect.iOrgId = OrgId; inspect.iInspectItemId = ItemId; inspect.iPMSchedDetailId = Convert.ToInt32(ddlPMServices.SelectedValue); inspect.InspectItemPMItemDetails(); dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem()); dgPMItems.DataBind(); dgPMItems.Visible = true; ShowPMItems(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sCurrentPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspect != null) { inspect.Dispose(); } } }
private void dgPMItems_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { inspect = new clsInspections(); inspect.cAction = "D"; inspect.iOrgId = OrgId; inspect.iInspectItemId = ItemId; inspect.iInspectItemPMItemId = Convert.ToInt32(e.Item.Cells[0].Text); inspect.InspectItemPMItemDetails(); dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem()); dgPMItems.DataBind(); if (dgPMItems.Items.Count == 0) { dgPMItems.Visible = false; } ShowPMItems(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sCurrentPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspect != null) { inspect.Dispose(); } } }