public List <ExportFile> GetExportFiles(CommaFormatter fileFormatter, List <Facility> facilities, Client client) { var exportFiles = new List <ExportFile>(); var exportDate = DateTime.Now; var accountsAboveThreshold = new List <Account>(); foreach (var facility in facilities) { var accounts = accountService.GetAllAccountsByFacilityForClient(facility, client); foreach (var account in accounts) { if (account.Balance > account.Client.BalanceThreshold) { accountsAboveThreshold.Add(account); } } var exportFile = new ExportFile { FileName = fileFormatter.FormatFileName(exportDate, facility), Content = fileFormatter.FormatContent(accountsAboveThreshold) }; exportFiles.Add(exportFile); } return(exportFiles); }
public ActionResult downloadData() { string FolderPath = Server.MapPath("~/Orders"); DirectoryInfo dir = new DirectoryInfo(FolderPath); FileInfo[] files = dir.GetFiles(); List <ExportFile> exportFiles = new List <ExportFile>(); ExportFile exportfile = null; foreach (FileInfo file in files) { exportfile = new ExportFile(); exportfile.CreatedDate = file.CreationTime.ToShortDateString(); exportfile.FileName = file.Name; if (file.Length > 0) { exportfile.Files = "1"; } else { exportfile.Files = "0"; } exportFiles.Add(exportfile); } return(Json(exportFiles, JsonRequestBehavior.AllowGet)); }
public ExportFile SetFileInfo(ExportFile file, string fileName) { file.ContentType = "text/json"; file.FileName = fileName + ".json"; return(file); }
public ActionResult DaYins(string orderId) { var url1 = HKSJ.Common.ConfigHelper.GetConfigString("htmlPath") + "/AC_User/SelectDaYin?orderId=" + orderId;// System.Web.HttpContext.Current.Server.MapPath(HKSJ.Common.ConfigHelper.GetConfigString("htmlPath")); string fileName = orderId; try { //ObjesToPdf.CreatPdf(url1, orderId); 如果下面的插件打印失败,请放开此方法,并且修改SelectDaYin.cshtml的注释1注释,注释2放开 wuyf 2015-9-23 ExportFile.HtmlToPdf(fileName, url1); } catch (Exception ex) { var opera = string.Format("插件打印出问题开始调用另外打印方法:{0},操作结果:{1}", "打印页面再AC_User,调用在order控制器" + url1, ex.Message); LogPackage.InserAC_OperateLog(opera, "打印页面"); try { //调用非插件打印方法 ObjesToPdf.CreatPdf(url1, orderId); } catch (Exception ex1) { opera = string.Format("非插件打印出问题:{0},操作结果:{1}", "打印页面再AC_User,调用在order控制器" + url1, ex1.Message); LogPackage.InserAC_OperateLog(opera, "打印页面"); string path = System.Web.HttpContext.Current.Server.MapPath(HKSJ.Common.ConfigHelper.GetConfigString("PdfPath")) + "dayin.pdf"; return(File(path, "application/pdf", "pdf print download")); } } return(View()); }
private IdxContent FillIdx(ExportFile exportFile) { IdxContent content = new IdxContent(); content.Lines = new List <string>(); XmlNode indexRoot = _idxIndexSpecification.GetIndexListNode(); XmlNode account = _accountConfig.GetAccountNode(exportFile.Data.RoutingID); if (indexRoot == null) { throw new XmlException($"IdxIndexSpecification invalid!"); } if (account == null) { throw new XmlException($"IdxIndexSpecification invalid!"); } //iterating through all entries in the zip file foreach (ZipArchiveEntry entry in _fileHandler.getZipArchiveEntries(exportFile.File)) { content.Lines.Add(CreateIdxLine(entry.Name, indexRoot, account, exportFile)); } return(content); }
public ExportFile SetFileInfo(ExportFile file, string fileName) { file.ContentType = "application/excel"; file.FileName = fileName + ".xlsx"; return(file); }
private void btnExportRecords_Click(object sender, EventArgs e) { #region Batch generate .txt file var fileSelector = new FolderBrowserDialog(); var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.SelectedPath = defaultPath; } var timeStamp = DateTime.Now.Date.ToString("ddMMyyyy"); if (fileSelector.ShowDialog() == DialogResult.OK) { ExportFile.SetFolderPath("dircPath", fileSelector.SelectedPath); lbFolder.Text = string.Format(" Selected Directory: {0}", fileSelector.SelectedPath); prbImport.Maximum = new OrderManage().GetMaxOrderNo() - 1; prbImport.Step = 1; prbImport.Value = 0; if (bkgWorkForExportingRecords.IsBusy != true) { bkgWorkForExportingRecords.RunWorkerAsync(fileSelector.SelectedPath); } btnExportRecords.Enabled = false; } #endregion }
private void bkgWorkForExportingRecords_DoWork(object sender, DoWorkEventArgs e) { var bkgWorker = sender as BackgroundWorker; var counter = 0; var lstOrderNo = new OrderManage().GetAllOrderNoAndPurchaser(); foreach (var orderInfo in lstOrderNo) { var objItems = new ItemManage().GetItemListByOrderNo(orderInfo.Key); var objUserInfo = new UserInfoManage().GetUserByOrderNo(orderInfo.Key); var orderContent = ExportFile.GenerateOrderContent(objItems, objUserInfo, true); var path = string.Format((string)e.Argument + @"\{0}{1}.txt", orderInfo.Key, orderInfo.Value); ExportFile.CreateOrderFile(path, orderContent); try { bkgWorker.ReportProgress(counter++); } catch (NullReferenceException exception) { Console.WriteLine(exception); throw; } } MessageBox.Show("Exporting all .txt files sucessfully!"); }
private void btnExportTransaction_Click(object sender, EventArgs e) { #region Generate .xls file var fileSelector = new FolderBrowserDialog(); var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.SelectedPath = defaultPath; } var timeStamp = DateTime.Now.Date.ToString("ddMMyyyy"); if (fileSelector.ShowDialog() == DialogResult.OK) { ExportFile.SetFolderPath("dircPath", fileSelector.SelectedPath); var path = string.Format(fileSelector.SelectedPath + @"\销售记录{0}.xls", timeStamp); lbFolder.Text = string.Format(" Selected Directory: {0}", path); var parameters = new string[2]; parameters[0] = timeStamp; parameters[1] = path; if (bkgWorkForExporting.IsBusy != true) { bkgWorkForExporting.RunWorkerAsync(parameters); } btnExportTransaction.Enabled = false; } #endregion }
/// <summary> /// Import the transaction records /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnImportTransaction_Click(object sender, EventArgs e) { FileDialog fileSelector = new OpenFileDialog(); fileSelector.Filter = "Text files (*.xls)|*.xls"; var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.InitialDirectory = defaultPath; } if (fileSelector.ShowDialog() == DialogResult.OK) { var pos = fileSelector.FileName.LastIndexOf(@"\", StringComparison.Ordinal); var path = fileSelector.FileName.Substring(0, pos); ExportFile.SetFolderPath("dircPath", path); lbFolder.Text = string.Format(" Selected Directory: {0}", path); prbImport.Step = 1; prbImport.Value = 0; objTransactions = FormatParsing.ParseContentIntoTransaction(fileSelector.FileName, objTransactions); prbImport.Maximum = objTransactions.Count; if (bkgWorkForTransaction.IsBusy != true) { bkgWorkForTransaction.RunWorkerAsync(); } btnImportTransaction.Enabled = false; } }
public ExportPayload ProcessFile(string Folder, ExportFile exportFile) { //Get options form The json file string Institution = GetParamaterData(exportFile, "Institution").ToString(); string TeacherPassword = GetParamaterData(exportFile, "TeacherPassword").ToString(); string StudentPassword = GetParamaterData(exportFile, "StudentPassword").ToString(); bool FilterStudents = GetParamaterData(exportFile, "FilterStudents") != null ? (bool)GetParamaterData(exportFile, "FilterStudents") : false; bool FilterClasses = GetParamaterData(exportFile, "FilterClasses") != null ? (bool)GetParamaterData(exportFile, "FilterClasses") : false;; bool FilterTeachers = GetParamaterData(exportFile, "FilterTeachers") != null ? (bool)GetParamaterData(exportFile, "FilterTeachers") : false;; bool Modifyclassesflag = GetParamaterData(exportFile, "ModifyClassCodes") != null ? true : false;; bool NotThisClassName = GetParamaterData(exportFile, "NotThisClassName") != null ? true : false;; if (Modifyclassesflag == true) { string json = GetParamaterData(exportFile, "ModifyClassCodes").ToString(); this._ModifyClassDetails = JObject.Parse(json); } if (NotThisClassName == true) { this._NotByName = GetParamaterData(exportFile, "NotThisClassName").ToString(); } if (string.IsNullOrWhiteSpace(Institution)) { throw new Exception("Paramater <Instituion> Must Be Set"); } List <object> Data = new List <object>(); Data.Add(new { Title = "Institution,\"" + Institution + "\"" }); /*---- Get Data ---*/ List <User> VaildUsers = GenerateUsers(FilterTeachers, 2).ToList(); VaildUsers.AddRange(GenerateUsers(FilterStudents, 1)); var VaildClasses = GenerateClasses(FilterClasses); /*-----------------*/ /*---- Format Data ---*/ Data.AddRange(FormatData(VaildUsers)); Data.AddRange(FormatData(VaildClasses)); Data.AddRange(FormatMemberships(VaildUsers, VaildClasses)); /*--------------------*/ return(new ExportPayload() { FilePath = Folder + "\\" + exportFile.FileName, ShowHeader = exportFile.ShowHeader, QuoteField = exportFile.QuoteNoFields, Data = Data }); }
public ExportPayload ProcessFile(string Folder, ExportFile exportcontext) { this.ExportContext = exportcontext; List <object> Data = null; ExportParamater queryType = (from type in exportcontext.Paramaters where type.Name == "User_Type" select type).FirstOrDefault(); if (queryType == null) { throw new Exception("Paramater User_Type must be set"); } if (queryType.Data == null || string.IsNullOrWhiteSpace(queryType.Data.ToString())) { throw new Exception("User_Type Data set incorrectly\r\nData: " + queryType); } Data = RunQuery(queryType.Data.ToString()); if (Data == null) { throw new Exception("User_Type Data set incorrectly\r\nData: " + queryType); } return(new ExportPayload() { FilePath = Folder + "\\" + this._ExportContext.FileName, ShowHeader = exportcontext.ShowHeader, Data = Data }); }
private void btnExport_Click(object sender, EventArgs e) { DataSet dataSet = ServicesProvider.GetInstance().GetAccountingServices(). GetAllAccountBalances(exportDateTimePicker.Value, (exportCmbBranches.SelectedItem as Branch).Id); ExportFile.SaveToFile(dataSet, string.Empty, @","); }
public ActionResult ImportNrCadGen(ExportFile file) { if (!file.ClassName.Contains("dxf", StringComparison.InvariantCultureIgnoreCase)) { return(new NotFoundResult()); } var dxfFullPath = dXFRepo.GetFullPath(file.Display); foreach (var p in DXF.Exporter.GetPolys(dxfFullPath)) { var imobil = context.Imobile.FirstOrDefault(x => x.Parcele.Any(y => y.Index == p.index)); if (imobil == null) { continue; } imobil.NumarCadGeneral = p.nrCadGeneral; imobil.SectorCadastral = p.sector; imobil.NumarCadastral = p.nrCadastral; context.Update(imobil); } context.SaveChanges(); return(new RedirectToActionResult("Download", "Home", null)); }
private void btnTxtFile_Click(object sender, EventArgs e) { #region Generate .txt file var fileSelector = new FolderBrowserDialog(); var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.SelectedPath = defaultPath; } if (fileSelector.ShowDialog() == DialogResult.OK) { ExportFile.SetFolderPath("dircPath", fileSelector.SelectedPath); var path = string.Format(fileSelector.SelectedPath + @"\{0}{1}.txt", crtOrderNo, purchaserName); var objItems = new ItemManage().GetItemListByOrderNo(crtOrderNo); var objUserInfo = new UserInfo { UserName = tbTo.Text.Trim(), PhoneNumber = tbToPhone.Text.Trim(), Address = tbAddress.Text.Trim(), CardNo = tbIdentityCard.Text.Trim() }; var orderContent = ExportFile.GenerateOrderContent(objItems, objUserInfo, true); ExportFile.CreateOrderFile(path, tbOrderContent.Text.Trim()); MessageBox.Show((zh?"生成 ":"Generating ") + crtOrderNo + purchaserName + (zh?".txt 成功! ":".txt Sucessfully!")); } #endregion }
private void buttonExport_Click(object sender, EventArgs e) { if (listViewTransactionsList.Items.Count == 0) { Notify("PrepareTransactionBeforeExport.Text"); return; } if (listViewTransactionsList.Items.Count > 0) { progressBarExport.Maximum = listViewTransactionsList.Items.Count; progressBarExport.Step = 1; progressBarExport.Minimum = 0; progressBarExport.Value = 0; string fileName = ExportFile.SaveTextToNewPath(); if (string.IsNullOrEmpty(fileName)) { btnSelectAll.Enabled = true; btnDeselectAll.Enabled = true; return; } _bwExportToFile = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; _bwExportToFile.DoWork += BwExportToFile_DoWork; _bwExportToFile.RunWorkerCompleted += BwExportToFile_WorkCompleted; _bwExportToFile.RunWorkerAsync(fileName); } }
void OutputFile() { List <int> printcols = new List <int>(); BackgroundWorker worker = new BackgroundWorker(); worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("File output complete"); }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { printcols = GetPrintCols(LiveCollection); IExportFile file = new ExportFile(_sessionColumnCollection, data.AsDataView(), printcols); file.OutputFile(OutputFileLocation); List <StationSummarySheetType> runSheets = new List <StationSummarySheetType>(); foreach (SelectionItem <StationSummarySheetType> Item in SummarySheets.selectedItems) { runSheets.Add(Item.SelectedItem); } XbyYShearStationSummary summary = new XbyYShearStationSummary(_sessionColumnCollection, data.AsDataView(), 30, 10, 2, _ogrid, runSheets); summary.CreateReport(OutputSummaryFileLocation); }; worker.RunWorkerAsync(); }
private void btnOrderText_Click(object sender, EventArgs e) { if (dgvTransaction.RowCount == 0) { return; } var fileSelector = new FolderBrowserDialog(); fileSelector.Description = zh?"请选择存有订单文本的文件夹:":@"Please choose the folder that stores order text:"; var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.SelectedPath = defaultPath; } if (fileSelector.ShowDialog() == DialogResult.OK) { var filename = string.Format(fileSelector.SelectedPath + @"\{0}{1}.txt", dgvTransaction.CurrentRow.Cells["OrderNo"].Value, dgvTransaction.CurrentRow.Cells["Purchaser"].Value); // Get the file name _frmOrderText = new FrmOrderText(); EvtSetOrderText += _frmOrderText.Receiver; EvtSetOrderText(ExportFile.ReadOrderFile(filename), dgvTransaction.CurrentRow.Cells["OrderNo"].Value.ToString()); DisplayMainFrm(false); OpenNewForm(_frmOrderText); } }
/// <summary> /// Import Orders /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnImport_Click(object sender, EventArgs e) { var fileSelector = new FolderBrowserDialog(); var defaultPath = ExportFile.GetDefaultPath("dircPath"); if (defaultPath != "") { fileSelector.SelectedPath = defaultPath; } if (fileSelector.ShowDialog() == DialogResult.OK) { ExportFile.SetFolderPath("dircPath", fileSelector.SelectedPath); lbFolder.Text = string.Format(" Selected Directory: {0}", fileSelector.SelectedPath); var files = Directory.GetFiles(fileSelector.SelectedPath).Where(name => name.EndsWith(".txt")); prbImport.Maximum = files.ToList().Count; prbImport.Step = 1; prbImport.Value = 0; foreach (var file in files.ToList()) { var objOrder = FormatParsing.ParsePathToFileName(file); objOrder = FormatParsing.ParseContentIntoOrder(file, objOrder); objOrders.Add(objOrder); } objOrders.Sort(); if (bkgWorkForImporting.IsBusy != true) { bkgWorkForImporting.RunWorkerAsync(); } btnImportRecords.Enabled = false; } }
/// <summary> /// Generates the export files. /// </summary> /// <param name="relatedTable">The related table.</param> /// <param name="relatedId">The related identifier.</param> /// <param name="userId">The user identifier.</param> public void GenerateExportFiles(string relatedTable, int relatedId, int userId) { int deletedExpotFileStatusCodeId = Utils.GetCodeByValue("ExportFileStatus", "DELETED").CodeId; // check if a record already exisit Data.ExportFile exportFile = DataContext.ExportFiles.Where(ef => ef.RelatedId == relatedId && ef.RelatedTable == relatedTable && ef.IsActive && ef.ExportFileStatusCodeId != deletedExpotFileStatusCodeId).FirstOrDefault(); if (exportFile == null) { exportFile = new ExportFile { RelatedTable = relatedTable, RelatedId = relatedId, ExportFileStatusCodeId = Utils.GetCodeByValue("ExportFileStatus", "QUEUED").CodeId, CreatedByUserId = userId, LastUpdatedByUserId = userId, CreatedDate = Utils.Now, LastUpdatedDate = Utils.Now, IsActive = true }; DataContext.ExportFiles.AddObject(exportFile); DataContext.SaveChanges(); } }
private void ExportToolStripMenuItem_Click(object sender, EventArgs e) { //ToolTipText is the full filename var menuItem = (ToolStripMenuItem)sender; var fileName = menuItem.ToolTipText; ExportFile.Export(fileName, menuItem.Tag as ExportData); }
public ExportFile Create(ExportFile file) { _fileId = file.Id.ToString(); base.Create(file.FileData); file.FileName = _fileName; return(file); }
public void Execute(IJobExecutionContext context) { // string path = System.Environment.CurrentDirectory; // MapPath("/App_Data/selfsetting.xml"); HttpContext http = HttpContext.Current; string path = System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "App_Data/selfsetting.xml"); XmlDocument xmldoc = new XmlDocument(); // string path = System.AppDomain.CurrentDomain.BaseDirectory.ToString()+ "App_Data/selfsetting.xml"; xmldoc.Load(path); string time = xmldoc.SelectSingleNode("root").SelectSingleNode("daorutime").Attributes[0].Value; string daorupath = xmldoc.SelectSingleNode("root").SelectSingleNode("daorudir").Attributes[0].Value; string daorunowdate = xmldoc.SelectSingleNode("root").SelectSingleNode("daorunowdate").Attributes[0].Value; var files = DirFileHelper.GetFileNames(daorupath); if (files.Length > 0) { DataSet ds = ExportFile.ExcelSqlConnection(files[0], "Info"); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); int successcount = 0; int failcount = 0; M_HitchInfoBll M_HitchInfoBll = new M_HitchInfoBll(); for (int i = 0; i < dr.Length; i++) { try { M_HitchInfo model = new M_HitchInfo(); model.AreaName = dr[0][0].ToString(); model.FactorySation = dr[i][1].ToString(); model.Signal = dr[i][2].ToString(); model.HappenTimes = int.Parse(dr[i][3].ToString()); model.SignalType = dr[i][4].ToString(); model.HappenTimes1 = int.Parse(dr[i][5].ToString()); model.MessageType = dr[i][6].ToString(); model.CreateUserId = 1; model.CreateUserName = "******"; model.CreateTime = DateTime.Now.AddDays(int.Parse(daorunowdate)); if (M_HitchInfoBll.M_HitchInfoAdd(model) > 0) { successcount++; } else { failcount++; } } catch (Exception) { failcount++; } } for (int i = 0; i < files.Length; i++) { File.Delete(files[i]); } } }
static void Main(string[] args) { Options options = new Options(); int option = options.getOptions(); bool flag = true; ExportFactory exportFactory = new ExportFactory(); while (flag) { switch (option) { case 1: Console.Clear(); Console.WriteLine("Exporting Customer Data in customer.csv file"); Console.WriteLine("Your file will be avaliable at desktop"); ExportFile customerFile = exportFactory.exportToFile("Customer"); customerFile.export(); if (options.doYouWantToContinue()) { option = options.getOptions(); } else { Console.WriteLine("Your file will be avaliable at desktop"); Console.WriteLine("Bye Bye"); flag = false; } break; case 2: Console.Clear(); Console.WriteLine("Exporting Employee Data in employee.csv file"); Console.WriteLine("Your file will be avaliable at desktop"); ExportFile employeeFile = exportFactory.exportToFile("Employee"); employeeFile.export(); if (options.doYouWantToContinue()) { option = options.getOptions(); } else { Console.WriteLine("Your file will be avaliable at desktop"); Console.WriteLine("Bye Bye"); flag = false; } break; case 3: Console.Clear(); Console.WriteLine("Bye Bye"); flag = false; break; } } }
//------------------------------------------------------------------------------ //Callback Name: apply_cb //------------------------------------------------------------------------------ public int apply_cb() { int errorCode = 0; try { //---- Enter your callback code here ----- List <string> newFileName = new List <string>(); if (file.Path == "") { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请指定文件位置"); return(1); } foreach (Node node in treeElectrode.GetSelectedNodes()) { ElectrodeModel model = assemble.Electrodes.Find(a => node.Equals(a.Node)); if (model != null) { ExportFile path = new ExportFile(model); string temp = path.NewFile(file.Path); newFileName.Add(temp); model.PartTag.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.CloseModified, null); Part newPart = PartUtils.OpenPartFile(temp); PartUtils.SetPartDisplay(newPart); if (this.toggleShops.Value && IsPartProgram(newPart)) { PartPost elePost = new PartPost(newPart); List <NCGroup> groups = elePost.GetGroup(); CreatePostExcel excel = new CreatePostExcel(groups, newPart); excel.CreateExcel(); string[] name = elePost.GetElectrodePostName(groups); foreach (string str in name) { elePost.Post(str, groups.ToArray()); } } newPart.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.False); } } foreach (Part part in theSession.Parts)//关闭其他 { string type = AttributeUtils.GetAttrForString(part, "PartType"); if (!type.Equals("Electrode", StringComparison.CurrentCultureIgnoreCase)) { part.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.CloseModified, null); } } } catch (Exception ex) { //---- Enter your exception handling code here ----- errorCode = 1; theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(errorCode); }
public async Task <ExportFile> FormatData <T>(IEnumerable <T> data, string fileName) { var json = await Task.Run(() => JsonConvert.SerializeObject(data, Formatting.Indented)); var file = new ExportFile(await Task.Run(() => Encoding.UTF8.GetBytes(json))); SetFileInfo(file, fileName); return(file); }
public void Handle(ExportFile message) { Data.BatchId = message.BatchId; MarkOrdersToExport(); Bus.SendLocal(new ExportFileContents { BatchId = Data.BatchId }); }
public void button_exportAll() { popup.displayBlock("Please wait ..."); ExportFile ef = new ExportFile(); ef.settings = settings; ef.filesExport = files.mainCopy; ef.LoadFiles(); List <AudioFiles> afDelete = ef.exportAll(); //bool isDelete = false; bool isDeleteOnlyProgram = false; if (isDelete) { foreach (AudioFiles element in afDelete)//listSelectId { File.Delete(element.path); } foreach (AudioFiles element in afDelete) { files.mainCopy.Remove(element); files.main.Remove(element); } int i = 0; foreach (AudioFiles element in files.main) { element.id = i; i++; } list_name_main.ItemsSource = files.mainCopy; list_name_main.Items.Refresh(); } if (isDeleteOnlyProgram && isDelete != true) { foreach (AudioFiles element in afDelete) { files.mainCopy.Remove(element); files.main.Remove(element); } int i = 0; foreach (AudioFiles element in files.main) { element.id = i; i++; } list_name_main.ItemsSource = files.mainCopy; list_name_main.Items.Refresh(); } popup.displayNan(); checkBox_name_deleteAfterOnly.IsChecked = false; checkBox_name_deleteAfter.IsChecked = false; isDelete = false; isDeleteOnlyProgram = false; }
public Dictionary <string, object> IntoSalActivity() { T_SaleActivityBll bll = new T_SaleActivityBll(); string url = HttpContext.Current.Request.Form["url"].ToString(); string filename = HttpContext.Current.Request.Form["filename"].ToString(); DataSet ds = ExportFile.ExcelSqlConnection(HttpContext.Current.Server.MapPath(url), "Info"); //调用自定义方法 DataRow[] dr = ds.Tables[0].Select(); int successcount = 0; int failcount = 0; for (int i = 0; i < dr.Length; i++) { try { T_SaleActivity model = new T_SaleActivity(); model.AgencyId = int.Parse(dr[0][0].ToString()); model.AreaId = int.Parse(dr[i][1].ToString()); model.ActivityDate = DateTime.Parse(dr[i][2].ToString()); model.SaleActivityTypeId = int.Parse(dr[i][3].ToString()); model.PassengerFlow = int.Parse(dr[i][4].ToString()); model.LatentPassengerFlow = int.Parse(dr[i][5].ToString()); model.CarOwner = int.Parse(dr[i][6].ToString()); model.OrderQuantity = int.Parse(dr[i][7].ToString()); model.PrimeCost = int.Parse(dr[i][8].ToString()); model.LaterOrderQuantity = int.Parse(dr[i][9].ToString()); model.PublishWay = dr[i][10].ToString(); model.CreateUserId = ManageProvider.Provider.Current().UserId; model.CreateUserName = ManageProvider.Provider.Current().Account; model.CreateTime = DateTime.Now; model.IsDelete = 0; model.IsShow = 1; if (bll.Add(model) > 0) { successcount++; } else { failcount++; } } catch (Exception) { failcount++; } } return(new Dictionary <string, object> { { "code", "1" }, { "successcount", successcount }, { "failcount", failcount }, { "filename", filename }, { "count", dr.Length } }); }
public async Task <ExportFile> FormatData <T>(IEnumerable <T> data, string fileName) { var type = data.GetType().GetGenericArguments()[0]; using (var package = new ExcelPackage()) { var file = new ExportFile(await CreatePackage(package, data, type)); SetFileInfo(file, fileName); return(file); } }
public static void Main(string[] args) { string filename = FileName(args); Access acc = new Access(filename); // Lists tables = acc.Tables(); displayList(tables); string itemString = inputListNumbers("選択Table ==> "); Console.WriteLine("選択された値 ===>> {0}", itemString); Lists ll = selectedList(tables, itemString); // if(ll.Count == 0) return; Dictionary<string, Lists> dicColumns = new Dictionary<string, Lists>(); Dictionary<string, string> dicSelectedItem = new Dictionary<string, string>(); // foreach(string table in ll){ acc.TableName = table; List<string> items = acc.Columns(); displayList(items); dicColumns[table] = items; dicSelectedItem[table] = inputListNumbers("選択するItems ==> "); Console.WriteLine(dicSelectedItem[table]); } foreach(string table in dicColumns.Keys){ ConvertCSV csv = new ConvertCSV(); Lists list = csv.ConvertTable2CsvString( acc.getDataTable(filename, table, selectedList(dicColumns[table], dicSelectedItem[table]))); selectedList(dicColumns[table], dicSelectedItem[table]).ForEach( delegate(string name){ Console.WriteLine(name); } ); ExportFile file = new ExportFile(table+".csv", list); Thread th = new Thread(new ThreadStart(file.ExportList)); th.Start(); } }
public static string ReadLeicaDNA03(string[] files, string prjName, int RecNo, double iAngle) { ReadFile read = new ReadFile(); OberveSheet sheet = new ReadDataFile.Model.OberveSheet(); sheet.Lines = read.ReadTxtList(files); string exportname = string.Format("{0}工程水准观测记录{1}次", prjName, RecNo); string templateUrl = HttpContext.Current.Request.ApplicationPath + "/Template/DNA03_Template.xls"; string exportUrl = HttpContext.Current.Request.ApplicationPath + "/Export/" + exportname + ".xls"; string templetepath = HttpContext.Current.Server.MapPath(templateUrl); string exportpath =HttpContext.Current.Server.MapPath(exportUrl); OberveSheet.IAngle = iAngle; OberveSheet.PrjName = exportname; OberveSheet.RecordNo = RecNo; ExportFile ex = new ExportFile(); ex.TemplateFilePath = templetepath; ex.ExportFilePath = exportpath; ex.Export(sheet); return exportname + ".xls"; }
private void button2_Click(object sender, EventArgs e) { op.ShowDialog(); ex = new ExportFile(); ex.TemplateFilePath = op.FileName; }