private void Page_Load(object sender, System.EventArgs e) { try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { EquipId=Convert.ToInt32(Request.QueryString["id"]); } catch(FormatException fex) { Session["lastpage"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } string [,] arrBrdCrumbs = new string [3,2]; arrBrdCrumbs[0,0]="main.aspx"; arrBrdCrumbs[0,1]="Home"; arrBrdCrumbs[1,0]="list.aspx"; arrBrdCrumbs[1,1]="Equipment List"; arrBrdCrumbs[2,0]="view.aspx?id="+EquipId+""; arrBrdCrumbs[2,1]="Equipment Detail"; PageTitle = "Equipment-Edit Disposal Info"; Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle); Header.PageTitle=PageTitle; SaveCancelControl.ParentPageURL=ParentPageURL; if(!IsPostBack) { equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; ddMethod.DataTextField = "vchName"; ddMethod.DataValueField = "Id"; ddMethod.DataSource = new DataView(equip.GetEquipDispMethodsList()); ddMethod.DataBind(); // getting equipment's data if(equip.EquipmentDetail_Disp() != -1) { if(equip.daDisposed.IsNull) adtDisposed.Date = new DateTime(adtDisposed.MinYear, 1, 1); else adtDisposed.Date = equip.daDisposed.Value; if(equip.daOutOfService.IsNull) adtOutOfService.Date = new DateTime(adtOutOfService.MinYear, 1, 1); else adtOutOfService.Date = equip.daOutOfService.Value; if(equip.sDispOrgContact.IsNull) tbOrgContact.Text = ""; else tbOrgContact.Text = equip.sDispOrgContact.Value; if(equip.curDispAmount.IsNull) tbAmount.Text = ""; else tbAmount.Text = equip.curDispAmount.Value.ToString("0.00"); if(equip.iDispUnits.IsNull) tbUnits.Text = ""; else tbUnits.Text = equip.iDispUnits.Value.ToString(); if(equip.sDispNotes.IsNull) tbNotes.Text = ""; else tbNotes.Text = equip.sDispNotes.Value; if(equip.iDispMethod.IsNull) ddMethod.SelectedIndex = 0; else ddMethod.SelectedValue = equip.iDispMethod.Value.ToString(); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, "editDisp.aspx.cs"); Session["lastpage"] = ParentPageURL; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) { equip.Dispose(); } } }