/// <summary> /// Procedure is processing the inspections on screen, i.e. to add or delete /// if them check boxes was selected/unselected /// </summary> private void ProcessingItems() { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; foreach(DataGridItem item in dgInspections.Items) { if(((CheckBox)item.FindControl("chAdd")).Enabled) { if(IsPast) order.daCurrentDate = ((DateTime)ViewState["WorkOrderCreatedDate"]); else order.daCurrentDate = DateTime.Now; order.iInspectSchedDetailId = Convert.ToInt32(item.Cells[0].Text); order.iWOInspectionId = Convert.ToInt32(item.Cells[1].Text); order.bChecked = ((CheckBox)item.FindControl("chAdd")).Checked; order.UpdateInspection(); } } } catch(Exception ex) { throw new Exception(ex.Message, ex); } finally { if(order != null) order.Dispose(); } }