try
{
if (System.Web.HttpContext.Current.Session[“UserId”] != null && System.Web.HttpContext.Current.Session[“EventId”] != null && System.Web.HttpContext.Current.Session[“EventConfiguration”] != null)
{

Logger.Write(LogType.INFO, ModuleToLog.EventInformation, “WriteEventHistory”, “EventHistory”, HttpContext.Current.Session[“UserName”].ToString());
string pageName = System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.ServerVariables[“SCRIPT_NAME”]);
UserService.UserClient proxyFind = new ePlannerPro2Client.UserService.UserClient();

epp2ClientPL.UsersProperties result = proxyFind.LoadById(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])), new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”])));

if (result == null)
{
return;
}
//epp2ClientPL.UsersProperties result = proxyFind.LoadUsersByEventId(new Guid(Convert.ToString(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”])))).Where(u => u.UserId.Equals(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])))).SingleOrDefault();

epp2ClientPL.EventConfigurationProperties files = (epp2ClientPL.EventConfigurationProperties)System.Web.HttpContext.Current.Session[“EventConfiguration”];

string FilePath = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath + “/XML”);
DirectoryInfo ObjDirectoryInfo = new DirectoryInfo(FilePath);

string strFileName = FilePath + “/” + files.EventTitle.ToString() + “_History.xml”;

XmlDocument XmlFile = new XmlDocument();

if (ObjDirectoryInfo.Exists == false)
{
ObjDirectoryInfo.Create();
}

FileInfo fi = new FileInfo(strFileName);

if (fi.Exists)
{
XmlFile.Load(strFileName);
}
else
{
XmlNode Declaration = XmlFile.CreateNode(XmlNodeType.XmlDeclaration, “”, “”);
XmlFile.AppendChild(Declaration);
XmlElement OperationElement;
OperationElement = XmlFile.CreateElement(“Operations”);
XmlFile.AppendChild(OperationElement);
XmlFile.Save(strFileName);
}

XmlNode Operations = XmlFile.SelectSingleNode(“Operations”);

XmlNode Operation1;
Operation1 = XmlFile.CreateNode(XmlNodeType.Element, “Operation”, “”);
Operations.AppendChild(Operation1);

XmlNode EventAttendeeId;
EventAttendeeId = XmlFile.CreateNode(XmlNodeType.Element, “EventAttendeeId”, “”);
EventAttendeeId.InnerText = Convert.ToString(result.EventAttendeeId);
Operation1.AppendChild(EventAttendeeId);

XmlNode FullName;
FullName = XmlFile.CreateNode(XmlNodeType.Element, “FullName”, “”);
FullName.InnerText = result.FullName;
Operation1.AppendChild(FullName);

MenusService.MenusClient proxyPage = new ePlannerPro2Client.MenusService.MenusClient();

#region “Get Page Id”
ePlannerPro2Client.MenusService.MenusClient proxyMenus = new ePlannerPro2Client.MenusService.MenusClient();
epp2ClientPL.MenusProperties[] data = proxyMenus.LoadPageMasterNameId(pageName).ToArray();
if (data == null)
return;
if (data.Count() == 0)
return;
#endregion

XmlNode PageId;
PageId = XmlFile.CreateNode(XmlNodeType.Element, “PageId”, “”);
PageId.InnerText = data[0].Id.ToString();
Operation1.AppendChild(PageId);

XmlNode OT;
OT = XmlFile.CreateNode(XmlNodeType.Element, “OperationType”, “”);
OT.InnerText = OperationType;
Operation1.AppendChild(OT);

XmlNode OperationMessage;
OperationMessage = XmlFile.CreateNode(XmlNodeType.Element, “OperationMessage”, “”);

// string strOperation = result.FullName + ” ” + Operation;

string strOperation = Operation;
OperationMessage.InnerText = strOperation;
Operation1.AppendChild(OperationMessage);

#region “Get Time Zone Name”
ePlannerPro2Client.TimeZoneService.TimeZone timeZone = LoadTimeZonesById(new Guid(files.TimeZoneId.ToString()));
#endregion

XmlNode OperationDate;
OperationDate = XmlFile.CreateNode(XmlNodeType.Element, “OperationDate”, “”);
// OperationDate.InnerText = DateTime.Now.ToString(“MMM dd yyyy, hh:mm:ss tt”);
OperationDate.InnerText = DateTime.Now.ToString(“MM/dd/yyyy, hh:mm:ss tt”);
Operation1.AppendChild(OperationDate);

XmlFile.Save(strFileName);
}
}
catch (Exception ex)
{
Logger.Write(LogType.EXCEPTION, ModuleToLog.EventInformation, “WriteEventHistory”, ex.StackTrace, HttpContext.Current.Session[“UserName”].ToString());
}

Advertisements