public ActionResult DownloadData(string type, int?id) { var asset = assets.GetById(id); if (id == null || asset == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FileDataBase fileData = new FileDataHandler(); byte[] downFile = new byte[0]; if (type == "xml") { downFile = fileData.GetXmlFile(asset); } if (type == "txt") { downFile = fileData.GetTXTFile(asset); } var filename = Regex.Replace(asset.Title, @"[^a-zA-z0-9]+", String.Empty) + "." + type; return(File(downFile, System.Net.Mime.MediaTypeNames.Application.Octet, filename)); }
public CourtsForm(FileDataHandler fileDataHandler) { InitializeComponent(); gbCaseFiledDate.BackColor = Color.Azure; gbCaseFiledDate.ForeColor = Color.Azure; _fileDataHandler = fileDataHandler; }
public HttpResponseMessage DownloadSelected([FromBody] DownloadSelectedModel selectedItems) { if (selectedItems == null || selectedItems.Id.Length == 0) { throw new HttpResponseException(HttpStatusCode.BadRequest); } if (selectedItems.Id.Length == 1) { return(DownloadData(new DownloadFileModel { Id = selectedItems.Id[0], Type = selectedItems.Type })); } var tmpAssets = assets.GetSelected(selectedItems.Id); FileDataBase fileData = new FileDataHandler(); var downFile = new byte[0]; downFile = fileData.TryGetListDataFile(tmpAssets, selectedItems.Type); if (downFile == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var filename = "ListData." + selectedItems.Type; return(GetFile(downFile, filename)); }
public static string Read(string file, int?project = null, bool sortbystartdate = false) { try { int noOfValueRows; //Read the .txt file into data columns. var fileDataColumns = FileReader.ReadFileData(file, out noOfValueRows); //Create objects out of input data. var productData = FileDataHandler.DataToObjects <ProductData>(fileDataColumns, noOfValueRows); //Filter data. if (project.HasValue) { productData = FileDataHandler.FilterBy(productData, project.Value, pd => pd.Project); } //Sort data. if (sortbystartdate) { productData = FileDataHandler.SortBy(productData, pd => pd.StartDate, false); } return(CreateProductDataOutput(productData, fileDataColumns)); } catch (InputException ex) { throw ex; } }
/** * Create model and set all event handlers */ public MainPresenter(IMainView view, FileDataHandler fileDataHandler) { _model = new MainModel(fileDataHandler); _view = view; _model.CountyFileUpdated += OnCountyUpdated; _model.DocketYearRead += OnDocketYearRead; _model.Error += OnError; _model.FileCountiesRead += OnCountiesRead; _model.ProcessStarted += OnProcessStarted; _model.ProcessStopped += OnProcessStopped; _model.StoppingProcess += OnStoppingProcess; _model.Warning += OnWarning; }
public HttpResponseMessage DownloadData([FromBody] DownloadFileModel Dfile) { var asset = assets.GetById(Dfile.Id); if (asset == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } FileDataBase fileData = new FileDataHandler(); byte[] downFile = fileData.TryGetFile(asset, Dfile.Type); if (downFile == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var filename = Regex.Replace(asset.Title, @"[^a-zA-z0-9]+", String.Empty) + "." + Dfile.Type; return(GetFile(downFile, filename)); }
public ActionResult DownLoadSelected(string type, int[] selectedItems) { if (type == null || selectedItems == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (selectedItems.Length == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (selectedItems.Length == 1) { return(DownloadData(type, selectedItems[0])); } var tmpAssets = assets.GetSelected(selectedItems); FileDataBase fileData = new FileDataHandler(); var downFile = new byte[0]; if (type == "xml" && tmpAssets.Count() > 0) { downFile = fileData.GetXmlListFile(tmpAssets); } if (type == "txt" && tmpAssets.Count() > 0) { downFile = fileData.GetTXTListFile(tmpAssets); } var filename = type.ToUpper() + "DataList." + type; return(File(downFile, System.Net.Mime.MediaTypeNames.Application.Octet, filename)); }
private static int HandleString(FileDataHandler fileDataHandler, string s) // Метод принимающий метод, в зависимости от типа обрабатываемых данных. { return(fileDataHandler(s)); }
public CourtsPresenter(ICourtsView view, FileDataHandler fileDataHandler) { _view = view; _model = new CourtsModel(fileDataHandler); _model.CourtsDataRead += OnCourtsDataRead; }