/// <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>
 /// This method Saves or Upadates the values into BatchImportXML
 /// </summary>
 private void SaveOrUpdateBatchImportXML()
 {
     objBatchImport = new Shell.SharePoint.DWB.Business.DataObjects.BatchImport();
     objBatchImport.BookID = strBookID;
     objBatchImport.DefaultSharedPath = strSharedAreaPath;
     objBatchImport.UserName = GetUserName();
     string strRowFilter;
     arlPageName = new ArrayList();
     foreach (GridViewRow gdvRow in grdBatchImportConfiguration.Rows)
     {
         objPageName = new PageName();
         objPageName.Name = HttpUtility.HtmlDecode(gdvRow.Cells[0].Text);
         DataTable dtResult = objWellBookBLL.GetTypeIIIPagesForBook(strParentSiteURL, strBookID, "No");
         DataView dvResultTable;
         dvResultTable = dtResult.DefaultView;
         strRowFilter = "Page_Name = '" + objPageName.Name + "'";
         dvResultTable.RowFilter = strRowFilter;
         dtResult = dvResultTable.ToTable();
         objPageName.PageCount = dtResult.Rows.Count.ToString();
         TextBox txtSharedAreaPath = (TextBox)gdvRow.FindControl("txtSharedAreaPath");
         objSharedPath = new SharedPath();
         objSharedPath.Path = txtSharedAreaPath.Text;
         objPageName.SharedPath = objSharedPath;
         DropDownList cboFileType = (DropDownList)gdvRow.FindControl("cboFileType");
         objFileType = new FileType();
         objFileType.Type = cboFileType.SelectedItem.Text;
         objPageName.FileType = objFileType;
         DropDownList cboNamingConvention = (DropDownList)gdvRow.FindControl("cboNamingConvention");
         objFileFormat = new FileFormat();
         objFileFormat.Format = cboNamingConvention.SelectedItem.Text;
         objFileFormat.ActualFormat = cboNamingConvention.SelectedItem.Value;
         objPageName.FileFormat = objFileFormat;
         arlPageName.Add(objPageName);
     }
     objBatchImport.PageName = arlPageName;
     objBatchImports = new BatchImports();
     arlBatchImport = new ArrayList();
     arlBatchImport.Add(objBatchImport);
     objBatchImports.BatchImport = arlBatchImport;
     BatchImportXmlGeneratotorBLL objBatchImportXmlGeneratotorBLL;
     objBatchImportXmlGeneratotorBLL = new BatchImportXmlGeneratotorBLL();
     XmlDocument xmlDoc = objBatchImportXmlGeneratotorBLL.CreateBatchImportXML(objBatchImports);
     //GetXMLFileData(xmlDoc, strBookID);
     BatchImportBLL objBatchImportBLL;
     objBatchImportBLL = new BatchImportBLL();
     objBatchImportBLL.UploadToDocumentLib(strBookID, xmlDoc);
 }
        /// <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.";
                }
            }
        }