public ActionResult GetContent(string form, string id) { var dictionary = Request.QueryString.AllKeys.ToDictionary(key => key, key => Request.QueryString[key]); var query = (dictionary.Count > 0 ? "?" + Request.QueryString : ""); if (id != null) { if (!dictionary.Keys.Any(k => k.Equals("id", StringComparison.InvariantCultureIgnoreCase))) { dictionary.Add("id", id); } } if (CommonSettings.CurrentEmployee == null) { form = "AccessDenied"; } var wsForm = WsFactory.CreateModel(form, dictionary, query, Request.Url.PathAndQuery); EventsLogHelper.WorkspaceEvent(wsForm.Name, wsForm.Caption, Request); return(Content(wsForm.Body)); }
//public ActionResult Clean() //{ // EventsLogHelper.DropEventsLog(); // return Content(MessageHelper.FormedMessageSuccess("Журнал очищен!"), ""); //} public ActionResult Archive() { string path = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EventsLogFolder"]); if (path.Length > 0 && path[path.Length - 1] != '\\') { path += '\\'; } string fileName = string.Format("eventlogs_{0}.log", DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss")); string fileZipName = string.Format("eventlogs_{0}.zip", DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss")); Dictionary <string, string> columns = new Dictionary <string, string>(); columns.Add("UserName", "Пользователь"); columns.Add("UserIP", "IP"); columns.Add("ActionType", "Тип события"); columns.Add("ObjectType", "Тип объекта"); columns.Add("ObjectName", "Объект"); columns.Add("ObjectId", "Id объекта"); columns.Add("Comment", "Комментарий"); EventsLogHelper.ArchiveEventsLog(path + fileName, columns); using (ZipFile zip = new ZipFile()) { zip.AddFile(path + fileName, string.Empty); zip.Save(path + fileZipName); } System.IO.File.Delete(path + fileName); return(Content(MessageHelper.FormedMessageSuccess(string.Format("Журнал заархивирован! Имя файла: {0}", fileZipName)), "")); }
public ActionResult ExportCSV(string metaViewName, string entityIds) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } EventsLogHelper.ExportData("CSV", metaViewName, Request); EntityContainer data; if (string.IsNullOrEmpty(entityIds)) { data = GetDataFromRequest(metaViewName); } else { data = GetDataFromRequest(metaViewName, entityIds); } return(File(data.ToCsv(DynamicEntityJSONDataSource.GetFieldColumns(Request.QueryString)), "application/CSV", string.Format("{0}.csv", metaViewName))); }
public ActionResult ExportXls(string metaViewName, string entityIds) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } EventsLogHelper.ExportData("Xls", metaViewName, Request); EntityContainer data; if (string.IsNullOrEmpty(entityIds)) { data = GetDataFromRequest(metaViewName); } else { data = GetDataFromRequest(metaViewName, entityIds); } var dt = data.ToDataTable(DynamicEntityJSONDataSource.GetFieldColumns(Request.QueryString)); return(GridExportHelper.ExportToXls(metaViewName, dt)); }
// // GET: /Account/LogOff public ActionResult LogOff() { EventsLogHelper.UserSignOut(Request); FormsAuthentication.SignOut(); return(RedirectToAction("Index", "Home")); }