/// <summary> /// 客户端下载数据 /// </summary> /// <param name="rndPrefix"></param> /// <param name="yljgbm"></param> /// <param name="czList"></param> /// <param name="dataType"></param> /// <returns></returns> public string DoDownLoadInfo_create(string rndPrefix, string yljgbm, string czList, string dataType) { DownloadInfoModel model = new DownloadInfoModel() { RndPrefix = rndPrefix, Yljgbm = yljgbm, CzList = czList, DataType = dataType }; try { clientDoWebService.Download.Download download = new clientDoWebService.Download.Download(); download._model = model; //删除临时文件夹下的所有文件 clientDoWebService.Download.Common.dropFileAll(download.GetFilePath_delete("")); //将要下载的文件转移到临时文件夹 FileHelper.CopyDirectory(download.GetFilePath_end(""), download.GetFilePath_delete("")); return(string.Format("1-{0}-{1}-{2}", clientDoWebService.Download.Common.GetFileDowLoadUrl(model), getfilenameList(download.GetFilePath_delete("")), getCreateFileStatue(model, download.GetFilePath()))); } catch (Exception ex) { return(string.Format("0-{0}", ex.Message)); } }
private Stream Download(DownloadInfoModel info) { var httpWebRequest = (HttpWebRequest)WebRequest.Create(info.url); httpWebRequest.UserAgent = UserAgent; httpWebRequest.Method = "GET"; httpWebRequest.CookieContainer = Cookies; var httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); return(httpWebResponse.GetResponseStream()); }
public string DoDownLoadInfo(string rndPrefix, string yljgbm, string czList, string dataType) { DownloadInfoModel model = new DownloadInfoModel() { RndPrefix = rndPrefix, Yljgbm = yljgbm, CzList = czList, DataType = dataType }; try { return(string.Format("1-{0}-{1}", clientDoWebService.Download.Common.GetFileDowLoadUrl(model), Operation(model))); } catch (Exception ex) { return(string.Format("0-{0}", ex.Message)); } }
private string Operation(DownloadInfoModel model) { switch (model.DataType) { case "1": BaseData basedata = new BaseData(model); return(basedata.Init(model).Get()); case "2": ArchivesData archivesdata = new ArchivesData(model); return(archivesdata.Init(model).Get()); case "3": HealthExamResult healthexamresult = new HealthExamResult(model); return(healthexamresult.Get()); } return(""); }
/// <summary> /// 返回文件的生成状态 1:全部生成完成 2:正在生成中 /// </summary> /// <param name="model"></param> /// <param name="filepath"></param> /// <returns></returns> public string getCreateFileStatue(DownloadInfoModel model, string filepath) { string strfileText = clientDoWebService.Download.Common.RedFileTxt(model, filepath); if (strfileText.Equals("end")) { clientDoWebService.Download.Common.WritFileTxt(model, filepath, "endend"); return("2"); } if (strfileText.Equals("endend")) { return("1"); } else if (strfileText.ToLower().IndexOf("error") > 0) { return("3"); } else { return("2"); } }