using System; using System.Data; using System.Text; using System.Xml; using CMS.CMSHelper; using CMS.GlobalHelper; using CMS.SettingsProvider; using CMS.Synchronization; using CMS.UIControls; public partial class CMSModules_Integration_Pages_Administration_View : CMSIntegrationPage { #region "Properties" /// /// Gets or sets the task identifier. /// public int TaskID { get { return QueryHelper.GetInteger("taskid", 0); } } #endregion" #region "Page events" protected void Page_Load(object sender, EventArgs e) { CurrentMaster.Title.TitleText = GetString("Task.ViewHeader"); CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Integration/tasks.png"); RegisterModalPageScripts(); IntegrationTaskInfo ti = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(TaskID); // Set edited object EditedObject = ti; if (ti != null) { CurrentMaster.Title.TitleText += " (" + HTMLHelper.HTMLEncode(ti.TaskTitle) + ")"; string direction = GetString(ti.TaskIsInbound ? "integration.inbound" : "integration.outbound"); // Prepare task description StringBuilder sbTaskInfo = new StringBuilder(); sbTaskInfo.Append(""); sbTaskInfo.Append(""); sbTaskInfo.Append(""); sbTaskInfo.Append(""); sbTaskInfo.Append("
" + GetString("integration.taskdirection") + ":" + direction + "
" + GetString("integration.tasktype") + ":" + ti.TaskType + "
" + GetString("integration.tasktime") + ":" + ti.TaskTime + "
"); string objectType = ti.TaskObjectType; if (ti.TaskNodeID > 0) { objectType = PredefinedObjectType.DOCUMENT; } viewDataSet.ObjectType = objectType; viewDataSet.DataSet = GetDataSet(ti.TaskData, ti.TaskType, ti.TaskObjectType); viewDataSet.AdditionalContent = sbTaskInfo.ToString(); } } #endregion #region "Methods" /// /// Returns the dataset loaded from the given document data. /// /// Document data to make the dataset from /// Task type /// Task object type protected virtual DataSet GetDataSet(string documentData, TaskTypeEnum taskType, string taskObjectType) { SyncHelper syncHelper = SyncHelper.GetInstance(); syncHelper.OperationType = OperationTypeEnum.Synchronization; string className = CMSHierarchyHelper.GetNodeClassName(documentData, ExportFormatEnum.XML); DataSet ds = syncHelper.GetSynchronizationTaskDataSet(taskType, className, taskObjectType); XmlParserContext xmlContext = new XmlParserContext(null, null, null, XmlSpace.None); XmlReader reader = new XmlTextReader(documentData, XmlNodeType.Element, xmlContext); return DataHelper.ReadDataSetFromXml(ds, reader, null, null); } #endregion }