/// <summary> /// This method binds the values to grid on Page load /// </summary> private void PopulateGrid() { grdBatchImportConfiguration.CssClass = WELLBOOKSUMMARYCSS; grdBatchImportConfiguration.EnableViewState = true; grdBatchImportConfiguration.HeaderStyle.CssClass = FIXEDHEADERCSS; grdBatchImportConfiguration.HeaderStyle.Height = new Unit(20, UnitType.Pixel); grdBatchImportConfiguration.RowStyle.CssClass = EVENROWSTYLECSS; grdBatchImportConfiguration.AlternatingRowStyle.CssClass = ODDROWSTYLECSS; XmlDocument batchImportDoc = null; BatchImportBLL ObjBatchImportBLL = new BatchImportBLL(); try { batchImportDoc = ObjBatchImportBLL.GetOnlyBatchImportXML(strBookID); //loading grid from values configured in XML if (batchImportDoc != null) { objWellBookBLL = new WellBookBLL(); DataTable dtResult = objWellBookBLL.GetTypeIIIPagesForBook(strParentSiteURL, strBookID, "No"); DataView dvResultTable; dvResultTable = dtResult.DefaultView; dtResult = dvResultTable.ToTable(true, "Page_Name"); grdBatchImportConfiguration.DataSource = dtResult; grdBatchImportConfiguration.DataBind(); foreach (GridViewRow gdvRow in grdBatchImportConfiguration.Rows) { XmlNode node = batchImportDoc.SelectSingleNode("/batchImport[@BookID='" + strBookID + "']/pageName[@name='" + HttpUtility.HtmlDecode(gdvRow.Cells[0].Text) + "']"); if (node != null) { TextBox txtSharedAreaPath = (TextBox)gdvRow.FindControl("txtSharedAreaPath"); txtSharedAreaPath.Text = node.SelectSingleNode("sharedPath").Attributes["path"].Value; DropDownList cboFileType = (DropDownList)gdvRow.FindControl("cboFileType"); foreach (ListItem eachItem in cboFileType.Items) { if (eachItem.Text == node.SelectSingleNode("fileType").Attributes["type"].Value) { eachItem.Selected = true; } } DropDownList cboNamingConvention = (DropDownList)gdvRow.FindControl("cboNamingConvention"); foreach (ListItem eachItem in cboNamingConvention.Items) { if (eachItem.Text == node.SelectSingleNode("fileFormat").Attributes["format"].Value) { eachItem.Selected = true; } } } else { gdvRow.Cells[0].ForeColor = Color.Red; } } } //loading grid with default values else { objWellBookBLL = new WellBookBLL(); DataTable dtResult = objWellBookBLL.GetTypeIIIPagesForBook(strParentSiteURL, strBookID, "No"); DataView dvResultTable; dvResultTable = dtResult.DefaultView; dtResult = dvResultTable.ToTable(true, "Page_Name"); grdBatchImportConfiguration.DataSource = dtResult; grdBatchImportConfiguration.DataBind(); } } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Gets the batch import XML. /// </summary> /// <param name="bookID">The book ID.</param> private void GetBatchImportXML(string bookID) { XmlDocument batchImportDoc = null; BatchImportBLL ObjBatchImportBLL = new BatchImportBLL(); batchImportDoc = ObjBatchImportBLL.GetOnlyBatchImportXML(bookID); //Bind the gridview if (batchImportDoc != null) { DataTable dtXMLResults = GetXMLFileData(batchImportDoc, bookID); if (dtXMLResults != null && dtXMLResults.Rows.Count > 0) { ExceptionBlock.Visible = false; lblException.Visible = false; btnContinue.Visible = true; gvBatchImportConfirmation.DataSource = dtXMLResults; gvBatchImportConfirmation.DataBind(); } else { ExceptionBlock.Visible = true; lblException.Visible = true; btnContinue.Visible = false; lblException.Text = "There are currently no details to be displayed."; } } }