/// <summary> /// 添加文件导出记录 /// </summary> /// <param name="args"></param> /// <returns></returns> public byte Create(OT_ExportHis args) { byte num; using (DataSubmittedEntities db = new DataSubmittedEntities()) { using (TransactionScope transaction = new TransactionScope()) { db.OT_ExportHis.Add(args); num = (byte)db.SaveChanges(); transaction.Complete(); } } return(num); }
/// <summary> /// 保存文件 /// </summary> /// <param name="hssfworkbook"></param> /// <param name="filename"></param> /// <returns>返回文件保存路径</returns> private string SaveFile(IWorkbook hssfworkbook, string filename, QueryParameters para) { try { string pPath = config; if (pPath.Substring(pPath.Length - 1) != "\\") { pPath = pPath + "\\"; } var tmpPath = pPath + DateTime.Now.ToString("yyyyMMdd") + "\\" + para.ReportType; //创建存储目录 if (!Directory.Exists(tmpPath)) { Directory.CreateDirectory(tmpPath); } //创建文件 string path = tmpPath + "\\" + filename; FileStream files = new FileStream(path, FileMode.Create); hssfworkbook.Write(files); files.Close(); //添加数据导出记录 ContactInfo pContactinfo = new ContactInfo(); OT_ExportHis contactinfo = new OT_ExportHis(); contactinfo.Id = Guid.NewGuid(); contactinfo.DataDate = para.StartTime; contactinfo.HDayId = para.HolidayId; contactinfo.CalcuTime = DateTime.Now; contactinfo.SavePath = path; contactinfo.TableType = para.ReportType; pContactinfo.Create(contactinfo); return(filename); } catch (Exception e) { SystemLog.GetInstance().Error(e); } return(null); }
/// <summary> /// 添加报表存储记录 /// </summary> /// <param name="args"></param> /// <returns></returns> public byte Create(OT_ExportHis args) { throw new NotImplementedException(); }