protected void test_Click(object sender, EventArgs e)
{
XmlDocument Reportxml = new XmlDocument();
try
{
// Specify the directory you want to manipulate.
string path = Server.MapPath("Store/Reports");
try
{
// Determine whether the directory exists.
if (!Directory.Exists(path))
{
// Try to create the directory.
DirectoryInfo di = Directory.CreateDirectory(path);
}
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(Page, typeof(Page),
"ShowAlert",
string.Format(@"
function _showAlert() {{Sys.Application.remove_load(_showAlert);
radalert('{0}', null, 100, '{1}');}};
Sys.Application.add_load(_showAlert);", "Error occured while creating Reports directory.</br>Reason: " + ex.Message, "BMS Forecast Consolidator"), true);
}
string text = Server.MapPath("Store/Reports/PublishedReport.xml");
string text2 = Server.MapPath("Store/Reports/PublishedReport2.xml");
{
Reportxml.Load(text);
XmlNodeList elements = Reportxml.SelectNodes("//OlapReports/OlapReport");
var currentnode = ocGeneric.OlapManager.CurrentOlapReport.Name;
foreach (XmlElement element in elements)
{
string ReportName = element.GetAttribute("Name");
// int RptName = Int32.Parse(element.GetAttribute("Name"));
string xPathExpression = "/OlapReports/OlapReport[@Name=' " + ReportName + "']";
XmlElement SingleRptNode = (XmlElement)Reportxml.SelectSingleNode(xPathExpression);
string displar = xPathExpression.Trim().Clone().ToString();
// ReportName.Clone().ToString();
// Reportxml.Save("PublishedReport2");
Reportxml.Save("Store/Reports/PublishedReport2.xml");
}
}
ocGeneric.OlapManager.SaveReports(Server.MapPath("Store/Reports/PublishedReport2.xml"));
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(Page, typeof(Page),
"ShowAlert",
string.Format(@"
function _showAlert() {{Sys.Application.remove_load(_showAlert);
radalert('{0}', null, 100, '{1}');}};
Sys.Application.add_load(_showAlert);", "Error occured while publising report.</br>Reason: " + ex.Message, "test"), true);
}
}