/// <summary> /// Creates the batch import. /// </summary> /// <param name="batchImports">The batch imports.</param> /// <param name="BatchImportsNode">The batch imports node.</param> private void CreateBatchImport(BatchImports batchImports, XmlNode BatchImportsNode) { XmlElement BatchImportElement; foreach (BatchImport objBatchImport in batchImports.BatchImport) { BatchImportElement = objXmlDocument.CreateElement(BATCHIMPORT); BatchImportsNode.AppendChild(BatchImportElement); if (objBatchImport.BookID.Length > 0) { XmlAttribute BookIDAttribute = objXmlDocument.CreateAttribute(BOOKID); BatchImportElement.Attributes.Append(BookIDAttribute); BookIDAttribute.Value = objBatchImport.BookID; } if (objBatchImport.DefaultSharedPath.Length > 0) { XmlAttribute DefaultPathAttribute = objXmlDocument.CreateAttribute(DEFAULTPATH); BatchImportElement.Attributes.Append(DefaultPathAttribute); DefaultPathAttribute.Value = objBatchImport.DefaultSharedPath; } if (objBatchImport.UserName.Length > 0) { XmlAttribute UserNameAttribute = objXmlDocument.CreateAttribute(USERNAME); BatchImportElement.Attributes.Append(UserNameAttribute); UserNameAttribute.Value = objBatchImport.UserName; } foreach (PageName objPageName in objBatchImport.PageName) { if (objPageName != null) { CreatePageName(objPageName, BatchImportElement); } } } }
/// <summary> /// Creates the batch import XML. /// </summary> /// <param name="batchImports">The batch imports.</param> /// <returns></returns> public XmlDocument CreateBatchImportXML(BatchImports batchImports) { if (batchImports != null) { objXmlDocument = new XmlDocument(); objXmlDocument = CreateRootElement(batchImports); } return objXmlDocument; }
/// <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> /// Creates the root element. /// </summary> /// <param name="batchImports">The batch imports.</param> /// <returns></returns> private XmlDocument CreateRootElement(BatchImports batchImports) { //Creating the root Xml Element Batch Imports. XmlElement BatchImportsElement = objXmlDocument.CreateElement(BATCHIMPORTS); objXmlDocument.AppendChild(BatchImportsElement); //Creating the RequestInfo node with Name attribute. XmlNode BatchImportsNode = objXmlDocument.DocumentElement; if (batchImports.BatchImport != null) { //Method call to create Batch import. CreateBatchImport(batchImports, BatchImportsNode); } else objXmlDocument = null; //returns the final SearchRequest Xml. return objXmlDocument; }