protected void WzInspectionUpd_FinishButtonClick(object sender, WizardNavigationEventArgs e) { if (fldSelectedKey.Value != "") { Guid InspectionId = new Guid(fldSelectedKey.Value); Inspection objInspection = new Inspection(); InspectionDetailsRow InspectionDetails = Inspection.GetInspectionDetailsRow(); InspectionDetails.InspectionTypeId = new Guid(ddlInspectionTypeIdUpd.SelectedValue); InspectionDetails.InspectingOfficerId = new Guid(ddlInspectingOfficerIdUpd.SelectedValue); InspectionDetails.InspectorOfficeName = txtInspectorOfficeNameUpd.Text; InspectionDetails.InspectedOfficeId = new Guid(ddlInspectedOfficeIdUpd.SelectedValue); InspectionDetails.LicenseId = new Guid(ddlLicenseIdUpd.SelectedValue); InspectionDetails.IsDiscrepancyFound = IsdescripancyFoundUpd.Checked; InspectionDetails.Remarks = txtInspectionRemarksUpd.Text; Wizard Container = (Wizard)Master.FindControl("Main").FindControl("WzInspectionUpd"); List <CheckListInspectionRow> CheckListRows = new List <CheckListInspectionRow>(); string filename = Server.MapPath("~\\Inspection\\InspectionCheckList.xml"); XmlDocument InspectionCheckListXml = new XmlDocument(); InspectionCheckListXml.Load(filename); foreach (XmlNode Node in InspectionCheckListXml.SelectNodes("DocumentElement/Items")) { CheckListInspectionRow CheckListRow = Inspection.GetCheckListRow(); TextBox txtRemarks = (TextBox)Container.FindControl("txt" + Node.Attributes["ItemId"].Value); CheckBox chkYesNo = (CheckBox)Container.FindControl("chk" + Node.Attributes["ItemId"].Value); CheckListRow.InspectionCheckListId = new Guid(Node.Attributes["ItemId"].Value); if (null != txtRemarks) { CheckListRow.Remarks = txtRemarks.Text; } else { CheckListRow.SetRemarksNull(); } if (null != chkYesNo) { CheckListRow.Checked = chkYesNo.Checked; } else { CheckListRow.Checked = false; } CheckListRows.Add(CheckListRow); } DataTable InspectionQueries = (DataTable)ViewState["InspectionQueryListDetails"]; objInspection.UpdateInspection(InspectionDetails, CheckListRows, InspectionQueries, InspectionId); } }
/// <summary> /// This function updates a Inspection record to InspectionDetails table /// </summary> /// <param name="InspectionDetails">A instance of InspectionDetailsRow</param> /// <param name="InspectionCheckListDetails">A list onject of InspectionCheckListDetails which will be passedc from presenetation layer /// how many checklists are selected for a particular Inspection Record</param> /// <param name="QueryList">The datattable object , which is added in one-many relationship </param> /// <param name="InspectionId">the key on which the particular record will be identified , The records which needs updation</param> /// <returns></returns> public bool UpdateInspection(InspectionDetailsRow InspectionDetails, List <CheckListInspectionRow> InspectionCheckListDetails, DataTable QueryList, Guid InspectionId) { string curUser = Thread.CurrentPrincipal.Identity.Name; IgrssAdapters.InspDetails.UpdateInspectionDetails(InspectionId, InspectionDetails.InspectionTypeId, InspectionDetails.InspectingOfficerId, InspectionDetails.InspectedOfficeId, InspectionDetails.LicenseId, InspectionDetails.InspectorOfficeName, InspectionDetails.IsDiscrepancyFound, InspectionDetails.Remarks, null, null, null, curUser, DateTime.Now); foreach (CheckListInspectionRow row in InspectionCheckListDetails) { //IgrssAdapters.InspChecklist.DeleteInspectionCheckListById(InspectionId); IgrssAdapters.InspChecklist.UpdateInspectionCheckList(InspectionId, row.InspectionCheckListId, row.Checked, row.Remarks, curUser, DateTime.Now); } foreach (DataRow Query in QueryList.Rows) { IgrssAdapters.InspQueries.DeleteInspectionQueriesById(InspectionId); IgrssAdapters.InspQueries.AddNewInspectionQueries(Guid.NewGuid(), InspectionId, (Guid)Query["CheckListId"], (string)Query["Query"], null, (string)Query["Remarks"], curUser, DateTime.Now); } return(true); }
/// <summary> /// This function updates a Inspection record to InspectionDetails table /// </summary> /// <param name="InspectionDetails">A instance of InspectionDetailsRow</param> /// <param name="InspectionCheckListDetails">A list onject of InspectionCheckListDetails which will be passedc from presenetation layer /// how many checklists are selected for a particular Inspection Record</param> /// <param name="QueryList">The datattable object , which is added in one-many relationship </param> /// <param name="InspectionId">the key on which the particular record will be identified , The records which needs updation</param> /// <returns></returns> public bool UpdateInspection(InspectionDetailsRow InspectionDetails, List<CheckListInspectionRow> InspectionCheckListDetails, DataTable QueryList, Guid InspectionId) { string curUser = Thread.CurrentPrincipal.Identity.Name; IgrssAdapters.InspDetails.UpdateInspectionDetails(InspectionId, InspectionDetails.InspectionTypeId, InspectionDetails.InspectingOfficerId, InspectionDetails.InspectedOfficeId, InspectionDetails.LicenseId, InspectionDetails.InspectorOfficeName, InspectionDetails.IsDiscrepancyFound, InspectionDetails.Remarks, null, null, null, curUser, DateTime.Now); foreach (CheckListInspectionRow row in InspectionCheckListDetails) { //IgrssAdapters.InspChecklist.DeleteInspectionCheckListById(InspectionId); IgrssAdapters.InspChecklist.UpdateInspectionCheckList(InspectionId, row.InspectionCheckListId, row.Checked, row.Remarks, curUser, DateTime.Now); } foreach (DataRow Query in QueryList.Rows) { IgrssAdapters.InspQueries.DeleteInspectionQueriesById(InspectionId); IgrssAdapters.InspQueries.AddNewInspectionQueries(Guid.NewGuid(), InspectionId, (Guid) Query["CheckListId"], (string) Query["Query"], null, (string) Query["Remarks"], curUser, DateTime.Now); } return true; }