/// <summary> /// Initializes a new instance of the <see cref="ResultsReaderJson"/> /// class. /// </summary> /// <param name="stream">The JSON stream to parse.</param> /// <param name="isInMultiReader"> /// Whether the reader is the underlying reader of a multi reader. /// </param> internal ResultsReaderJson(Stream stream, bool isInMultiReader) : base(stream, isInMultiReader) { StreamReader = new StreamReader(stream); if (this.IsExportStream || isInMultiReader) { this.exportHelper = new ExportHelper(this); } this.FinishInitialization(); }
/// <summary> /// 默认Action /// 作者:尤啸 /// 时间:2012-06-27 /// </summary> /// <param name="model">页面加载模组</param> /// <param name="export">导出帮助</param> /// <returns>视图</returns> public ActionResult Index(ModelLogsIndex model, ExportHelper export) { //设置模组的导出对象 model.ExportObject = export; //grid页面加载数据 model.RetriveData(); //返回页面视图 return View(model); }
/// <summary> /// 供应商信息列表显示 /// </summary> /// <param name="modelUTSupplierManage"></param> /// <returns></returns> public ActionResult Index(ModelSampleIndex model,ExportHelper export) { model.ExportObject = export; model.RetriveData(); return View(model); }
internal static DataGridVM QueryForm(DFDictionary queryParameters) { FormM form = null; DFDictionary entity = null; DFPub.SetDBEntity(queryParameters, ref form, ref entity); if (null == form) { throw new ArgumentException("DF_FORMNAME"); } var start = ParseHelper.ParseInt(queryParameters["start"]).GetValueOrDefault(); var limit = ParseHelper.ParseInt(queryParameters["limit"]).GetValueOrDefault(); // 如果客户端是导出,那么就设置记录数为最大值 if (queryParameters.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { start = 0; limit = int.MaxValue; } var vm = new DataGridVM(); var message = string.Empty; if (!string.IsNullOrWhiteSpace(form.DAImp)) { var da = NinjectHelper.Get <IDA>(form.DAImp); try { if (null == da) { throw new Exception("Invalid DAImp"); } da.Query(form, entity, vm, start, limit, ref message); if (vm.rows == null) { vm.rows = new List <string>(); } if (vm.rows.GetType() == typeof(DataTable)) { if (entity.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { vm.data = ExportHelper.Export(((DataTable)vm.rows), form, vm.data as List <GridColumnM>); } } else { ConvertToDisplayText((IList)vm.rows); if (entity.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { vm.data = ExportHelper.Export(((IList)vm.rows), form); } } } catch (Exception ex) { m_log.Error(ex.Message, ex); vm.hasError = true; vm.error = ex.Message; message = ex.Message; } } if (vm.rows == null) { vm.rows = new List <string>(); } return(vm); }
public ActionResult Index(MdoelOrgCompanyIndex model, ExportHelper export) { model.ExportObject = export; model.RetriveData(); return View(model); }
public dynamic ExportTopCalibratorMissedItems(AverageFilter filters, string userName) { Filter f = new Filter() { filters = filters.filters, range = filters.range }; using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString)) { if (filters.filters.badCallsOnly == false) { SqlCommand sqlComm = DashboardHelpers.GetFiltersParameters(f, "[GetTopCalibratorMissedItems]", userName, filters.comparison); sqlComm.CommandTimeout = int.MaxValue; sqlComm.Connection = sqlCon; PageFiltersData pageFiltersData = new PageFiltersData(); sqlCon.Open(); TopMissedItemsResponseData topMissed = new TopMissedItemsResponseData() { missedItems = new List <MissedItem>() }; try { SqlDataReader reader = sqlComm.ExecuteReader(); while (reader.Read()) { try { topMissed.missedItems.Add(new MissedItem() { questionId = int.Parse(reader.GetValue(reader.GetOrdinal("questionId")).ToString()), questionShortName = (reader.GetValue(reader.GetOrdinal("questionShortName")).ToString()), scorecardName = (reader.GetValue(reader.GetOrdinal("scorecardName")).ToString()), totalCalls = int.Parse(reader.GetValue(reader.GetOrdinal("totalCalls")).ToString()), missedCalls = int.Parse(reader.GetValue(reader.GetOrdinal("missedCalls")).ToString()), questionSectionName = reader.GetValue(reader.GetOrdinal("sectionName")).ToString(), isComposite = bool.Parse(reader.GetValue(reader.GetOrdinal("hasTemplate")).ToString()), isLinked = bool.Parse(reader.GetValue(reader.GetOrdinal("isLinked")).ToString()), questionType = reader.GetValue(reader.GetOrdinal("questionType")).ToString(), comparedMissedCalls = int.Parse(reader.GetValue(reader.GetOrdinal("comparedMissedCalls")).ToString()), comparedTotalCalls = int.Parse(reader.GetValue(reader.GetOrdinal("comparedTotalCalls")).ToString()), }); } catch (Exception ex) { } } reader.NextResult(); List <MissedItemAgentInfo> lst = new List <MissedItemAgentInfo>(); while (reader.Read()) { try { lst.Add(new MissedItemAgentInfo() { questionId = int.Parse(reader.GetValue(reader.GetOrdinal("questionId")).ToString()), name = reader.GetValue(reader.GetOrdinal("reviewer")).ToString(), totalCalls = int.Parse(reader.GetValue(reader.GetOrdinal("total_calls")).ToString()), missedCalls = int.Parse(reader.GetValue(reader.GetOrdinal("number_missed")).ToString()), }); } catch (Exception ex) { } } foreach (var item in topMissed.missedItems) { item.top3Agents = new List <MissedItemAgentInfo>(); item.top3Agents.AddRange((from v in lst where v.questionId == item.questionId select v).ToList()); } List <TopMissedItemsExportModel> topMissedItemsExportModel = new List <TopMissedItemsExportModel>(); var propNames = new List <PropertieName> { new PropertieName { propName = "Missed Point", propValue = "questionShortName", propPosition = 1 }, new PropertieName { propName = "Section", propValue = "questionSectionName", propPosition = 2 }, new PropertieName { propName = "Scorecard", propValue = "scorecardName", propPosition = 3 }, new PropertieName { propName = "Number missed", propValue = "missedCalls", propPosition = 4 }, new PropertieName { propName = "Total calls", propValue = "totalCalls", propPosition = 5 }, new PropertieName { propName = "Occurrence", propValue = "occurrence", propPosition = 6 }, new PropertieName { propName = "Delta", propValue = "delta", propPosition = 7 }, new PropertieName { propName = "Top 3 agents", propValue = "top3Agents", propPosition = 8 } }; //return topMissed; foreach (var item in topMissed.missedItems) { List <string> topAgents = new List <string>(); foreach (var i in item.top3Agents) { if (item.questionId == i.questionId) { topAgents.Add((new StringBuilder().Append(i.name + i.missedCalls + "/" + i.totalCalls + ";").ToString())); } } if (item.comparedTotalCalls == 0) { topMissedItemsExportModel.Add(new TopMissedItemsExportModel { questionShortName = item.questionShortName, questionSectionName = item.questionSectionName, scorecardName = item.scorecardName, missedCalls = item.missedCalls, totalCalls = item.totalCalls, occurrence = (float)Math.Round((float)((float)item.missedCalls / (float)item.totalCalls) * 100), delta = (float)Math.Round((float)((float)item.missedCalls / (float)item.totalCalls) * 100), //(item.comparedMissedCalls / item.comparedTotalCalls), top3Agents = ExportCodeHelper.GetCSVFromList(topAgents) }); } else { topMissedItemsExportModel.Add(new TopMissedItemsExportModel { questionShortName = item.questionShortName, questionSectionName = item.questionSectionName, scorecardName = item.scorecardName, missedCalls = item.missedCalls, totalCalls = item.totalCalls, occurrence = (float)Math.Round(((float)item.missedCalls / (float)item.totalCalls) * 100), delta = (float)Math.Round(((float)((float)item.missedCalls / (float)item.totalCalls) * 100) - ((float)((float)item.comparedMissedCalls / (float)item.comparedTotalCalls) * 100)),//(item.missedCalls / item.totalCalls) * 100, top3Agents = ExportCodeHelper.GetCSVFromList(topAgents) }); } } ExportHelper.Export(propNames, topMissedItemsExportModel, "TopCalibratorMissed" + DateTime.Now.ToString("MM-dd-yyyy") + DateTime.Now.Second.ToString() + ".xlsx", "TopCalibratorMissedPoints", userName); //return topMissed; } catch (Exception ex) { throw ex; } } } return("success"); }
public string CreditNoteListNoDT_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote> > aggregatorsInfo) { if (exportOptions.Range == ExportHelper.Range.TOP100) { datasourceRequest.StartRow = 0; datasourceRequest.PageSize = 100; } else if (exportOptions.Range == ExportHelper.Range.ALL) { datasourceRequest.StartRow = 0; datasourceRequest.PageSize = int.MaxValue; } if (string.IsNullOrWhiteSpace(exportOptions.Filename)) { exportOptions.Filename = "CreditNoteListNoDT"; } if (exportOptions.ColumnOptions == null) { exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions> { new ExportHelper.ColumnOptions { Column = "Transaction.Id", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "CreditNoteNumber", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Description", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "DateIssued", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Amount", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "TotalPrice", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Transaction.Supplier.Company", IsVisible = true }, }; } var queryable = Get_CreditNoteListNoDT_DatasourceQueryable(datasourceRequest); var totalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(); var items = DatasourceRetriever.Retrieve(datasourceRequest, queryable);; var dto = items.Select(i => new CreditNoteDataSet_CreditNoteDTO(i)); var formattings = new Dictionary <string, string>(); formattings.Add("DateIssued", "dd/MM/yyyy"); formattings.Add("Amount", "#,0.00;'-'#,0.00;'0'"); formattings.Add("TotalPrice", "#,0.00;'-'#,0.00;'0'"); var aggregators = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo); foreach (var a in aggregators) { var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null; a.Calculate(queryable, formatting); } var exportDataDTO = new List <ExportHelper.ExportRecordDTO>(); foreach (var record in dto) { var recordDTO = new ExportHelper.ExportRecordDTO(); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = "Transaction.Id", Value = record?.Transaction?.Id, ColumnDataType = "int", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_Transaction.Id") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.CreditNoteNumber), Value = record?.CreditNoteNumber, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_CreditNoteNumber") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.Description), Value = record?.Description, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_Description") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.DateIssued), Value = record?.DateIssued, ColumnDataType = "DateTime", Format = "dd/MM/yyyy", ExcelFormat = @"dd/MM/yyyy", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_DateIssued") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.Amount), Value = record?.Amount, ColumnDataType = "decimal", Format = "#,0.00;'-'#,0.00;'0'", ExcelFormat = @"#,##0.00;-#,##0.00;#,##0.00", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_Amount") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.TotalPrice), Value = record?.TotalPrice, ColumnDataType = "decimal", Format = "#,0.00;'-'#,0.00;'0'", ExcelFormat = @"#,##0.00;-#,##0.00;#,##0.00", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_TotalPrice") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = "Transaction.Supplier.Company", Value = record?.Transaction?.Supplier?.Company, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("AdminCreditNotesList", "RES_LIST_CreditNoteListNoDT_COLUMN_Transaction.Supplier.Company") }); exportDataDTO.Add(recordDTO); } if (aggregators.Count > 0) { foreach (AggregatorType aggregatorType in Enum.GetValues(typeof(AggregatorType))) { var emptyAggregatorRow = true; var recordDTO = new ExportHelper.ExportRecordDTO(); foreach (var columnOption in exportOptions.ColumnOptions) { var aggregatorValue = ""; switch (aggregatorType) { case AggregatorType.COUNT: if (columnOption.CountIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.COUNT); aggregatorValue = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandCount")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; case AggregatorType.SUM: if (columnOption.SumIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.SUM); aggregatorValue = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandTotal")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; case AggregatorType.AVERAGE: if (columnOption.AverageIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.AVERAGE); aggregatorValue += $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandAverage")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; } recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = columnOption.Column, Value = aggregatorValue, ColumnDataType = "string", Format = "" }); } if (!emptyAggregatorRow) { exportDataDTO.Add(recordDTO); } } } var path = ExportHelper.ExportList(exportDataDTO, exportOptions, totalRows); var content = System.IO.File.ReadAllBytes(Path.Combine(Path.GetTempPath(), path)); var fileName = Path.GetFileName(path); return(FileHelper.PendingDownloadInstance.Add("AdminCreditNotesList", content, fileName)); }
private void DrawConfigsDetails() { int selectedndex = GUILayout.Toolbar(m_CurrentSelectIndex, m_ConfigsNames.ToArray(), "LargeButton"); if (m_CurrentSelectIndex != selectedndex) { m_CurrentSelectIndex = selectedndex; //m_CurrentConfig = DeepClone<ExportXcodeConfiguration>(m_Configs[m_ConfigsNames[m_CurrentSelectIndex]]); m_CurrentConfig = m_Configs[m_ConfigsNames[m_CurrentSelectIndex]].Clone(); } m_SaveAsName = m_CurrentConfig.Name; GUILayout.Space(20); m_CurrentConfig.Platform = (PLATFOEMTYPE)EditorGUILayout.EnumPopup("Platform", m_CurrentConfig.Platform); EditorGUILayout.Space(); m_CurrentConfig.OutLine = EditorGUILayout.Toggle("OutLine", m_CurrentConfig.OutLine); EditorGUILayout.Space(); m_CurrentConfig.EnableGuest = EditorGUILayout.Toggle("EnableGuest", m_CurrentConfig.EnableGuest); EditorGUILayout.Space(); m_CurrentConfig.CompanyName = EditorGUILayout.TextField("CompanyName", m_CurrentConfig.CompanyName); EditorGUILayout.Space(); m_CurrentConfig.ProductName = EditorGUILayout.TextField("ProductName", m_CurrentConfig.ProductName); EditorGUILayout.Space(); m_CurrentConfig.ApplicationIdentifier = EditorGUILayout.TextField("App-Identifier", m_CurrentConfig.ApplicationIdentifier); EditorGUILayout.Space(); m_CurrentConfig.ClientVersion = EditorGUILayout.TextField("ClientVersion", m_CurrentConfig.ClientVersion); EditorGUILayout.Space(); m_CurrentConfig.VersionCode = EditorGUILayout.TextField("VersionCode", m_CurrentConfig.VersionCode); EditorGUILayout.Space(); m_CurrentConfig.DefualtLanguage = (LanguageType)EditorGUILayout.EnumPopup("DefualtLanguage", m_CurrentConfig.DefualtLanguage); EditorGUILayout.Space(); m_CurrentConfig.Splash = (Texture2D)EditorGUILayout.ObjectField("Splash", m_CurrentConfig.Splash, typeof(Texture2D), false); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Configuration")) { SaveConfig(m_SaveAsName); ReloadConfigs(); } GUILayout.Space(3); if (GUILayout.Button("Save As ...")) { m_ShowSaveAsView = true; } GUILayout.Space(3); if (GUILayout.Button("Delete Configuration")) { List <ExportXcodeConfiguration> configs = ExportXcodeParam.Instance.Configs; int count = configs.Count; if (count <= 1) { EditorUtility.DisplayDialog("Warning", "至少保留一个配置方案", "OK"); return; } for (int i = 0; i < count; i++) { if (configs[i].Name.Equals(m_ConfigsNames[m_CurrentSelectIndex])) { configs.RemoveAt(i); break; } } m_CurrentSelectIndex = 0; ReloadConfigs(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(20); Color temp = GUI.color; GUI.color = Color.cyan; if (GUILayout.Button("Start Export", GUILayout.MinHeight(50))) { SaveConfig(m_SaveAsName); ReloadConfigs(); ExportHelper.ExportXCodeProject(m_CurrentConfig); //this.Close(); } GUI.color = temp; }
public string ExportLoadForecast() { var inputValue = _ntsPage.Request.Form["Inputs"]; var query = Newtonsoft.Json.JsonConvert.DeserializeObject <QueryLoadForecast>(inputValue); ResultLoadForecastMap dtRef = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.ILoadForecastService>("LoadForecastService").GetLoadForecastChart(query); try { if ((dtRef != null) && (dtRef.LoadForecast.Count > 0)) { DataTable dtReport = TableView.CreateFee_ForecastDataTable(); List <ResultLoadForecastList> listNew = dtRef.LoadForecast; for (var r = 0; r < listNew.Count; r++) { DataRow dr = dtReport.NewRow(); dr[1] = listNew[r].TimeArea.ToString(); dr[2] = listNew[r].ForeCast.ToString(); if (listNew[r].History == -9999) { dr[3] = "--"; dr[4] = "--"; dr[5] = "--"; } else { dr[3] = listNew[r].History.ToString(); dr[4] = listNew[r].Deviation.ToString(); dr[5] = listNew[r].Pecent.ToString(); } dtReport.Rows.Add(dr); } string temp_path = AppDomain.CurrentDomain.BaseDirectory + "temp_file\\"; if (!Directory.Exists(temp_path)) { Directory.CreateDirectory(temp_path); string[] files = Directory.GetFiles(temp_path); foreach (string fn in files) { File.Delete(temp_path + fn); } } string save_path = DateTime.Now.Ticks + ".xls"; string templatePath = AppDomain.CurrentDomain.BaseDirectory + "template\\负荷预测表.xls"; TemplateParam param = new TemplateParam("负荷预测表", new CellParam(0, 0), "", new CellParam(3, 0), false, new CellParam(4, 0)); //TemplateParam param = new TemplateParam("itemCodeName", new CellParam(1, 1),"",null, false, new CellParam(5, 0)); param.DataColumn = new[] { 0, 1, 2, 3, 4, 5 }; //param.ItemUnit = "(单位:元"; //param.ItemUnitCell = new CellParam(3, 5); dtReport.TableName = "负荷预测表"; ExportHelper.ExportExcel(dtReport, temp_path + save_path, templatePath, param); return("{\"status\":\"success\",\"msg\":\"" + "/temp_file/" + save_path + "\"}"); } else { return("{\"status\":\"error\",\"msg\":\"导出失败:当前无任何数据\"}"); } } catch (Exception ex) { return("{\"status\":\"error\",\"msg\":\"导出失败:由于当前无数据或其他原因导致" + ex.Message + "\"}"); } }
protected void btnExportWord_Click(object sender, EventArgs e) { string isim = "Kişi ve Firmalar-" + DateTime.Now.ToString(); ExportHelper.ToWord(GridView1, isim); }
public NPOIExcelExpoter(string RootFolderName) { this.RootPathName = RootFolderName; mExportHelper = new ExportHelper(); }
private void ExportBtn_Click(Object sender, EventArgs e) { dynamic expando = SuperFlexiHelpers.GetExpandoForModuleItems(module, config, false); ExportHelper.ExportDynamicListToCSV(HttpContext.Current, expando.Items, String.Format("export-{0}.csv", config.MarkupDefinitionName)); }
private void InitCommand() { PrintConfigurationSaveBaseCommand = new DelegateCommand((obj) => { string msg = PrintHelper.VerifyPrintConfiguration(PrintConfiguration); if (string.IsNullOrEmpty(msg)) { int id = CommonService.SaveBarTenderPrintConfigXX(PrintConfiguration); if (id > 0) { PrintConfiguration.Id = id; MessageBox.Show("保存成功"); } else { MessageBox.Show("保存失败,请联系管理员"); } } else { MessageBox.Show(msg); } }); TemplateSelectBaseCommand = new DelegateCommand((obj) => { System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { PirntTemplates = PrintHelper.GetTenderPrintA4Templates(fbd.SelectedPath); } }); DirectorySelectBaseCommand = new DelegateCommand((obj) => { // 导出目录选择 System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { HostConfig.HostValue = fbd.SelectedPath; var result = CommonService.SaveHostConfig(HostConfig); if (result) { HostConfig = CommonService.GetHostConfig(DataGridId, HostName, User.ID); } } }); ExportBaseCommand = new DelegateCommand((obj) => { if (Directory.Exists(HostConfig.HostValue)) { ExportView view = new ExportView(DataGridId, 1); (view.DataContext as ExportViewModel).Export((type, outputEntity, checkBoxValue, orderedColumns) => { view.Close(); if (type == 1) { DataTable datatable = new DataTable(); if (outputEntity == 1) { datatable = _service.GetExportData1("DGPrintA4", User.ID, CommonService.GetSqlWhereString(QueryParameter)); ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(QueryParameter)); MessageBox.Show("导出成功"); } //else if (outputEntity == 2) //{ // datatable = _shippingService.GetShippingBillExprotDataTable2(UserDataId); // new Helper.DataTableImportExportHelper().ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption); // MessageBox.Show("导出成功"); //} //else if (outputEntity == 3) //{ // datatable = _shippingService.GetShippingBillExprotDataTable3(UserDataId, string.Join(",", orderedColumns)); // new Helper.DataTableImportExportHelper().ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption, checkBoxValue, 1, orderedColumns); // MessageBox.Show("导出成功"); //} } }); view.ShowDialog(); } else { MessageBox.Show("目录不存在,请先选择导出的目录"); DirectorySelectBaseCommand.Execute(null); } CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "ExportBaseCommand", ActionDesc = HostConfig.TypeDesciption + HostConfig.TypeId.ToString(), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); }); DataGridSaveCommand = new DelegateCommand((obj) => { DataGridManagementService.SaveColumnConfigurationInUserInterface(obj as DataGrid, User.ID); MessageBox.Show("参数保存成功"); }); PrintBaseCommand = new DelegateCommand((obj) => { string msg = PrintHelper.VerifyPrintConfiguration(PrintConfiguration); if (string.IsNullOrEmpty(msg)) { var selectedLists = ((obj as DataGrid).SelectedItems).Cast <LabelPrintHistoryModel>().ToList(); if (selectedLists.Count > 0) { string result = _print.BarTenderPrintA4(selectedLists, PrintConfiguration, selectedLists.Sum(x => x.PrintCount)); MessageBox.Show(result); QueryCommand.Execute(null); } else { MessageBox.Show("先选择行数据,【CTRL】或【SHFIT】 多选行"); } } else { MessageBox.Show(msg); } }); QueryCommand = new DelegateCommand((obj) => { PrintHistoryLists.Clear(); _service.GetHistoryLists(CommonService.GetSqlWhereString(QueryParameter)).ForEach(x => PrintHistoryLists.Add(x)); }); DataGridManageCommand = new DelegateCommand((obj) => { var grid = obj as DataGrid; UserDataGridFormatConfigurationView view = new UserDataGridFormatConfigurationView("DGPrintA4"); (view.DataContext as UserDataGridFormatConfigurationViewModel).WithParam(null, (type, outputEntity) => { view.Close(); if (type == 1) { // 重新加载DataGrid格式 grid.Columns.Clear(); CommonService.GetUserDataGridColumn(User.ID, grid, 0); } }); view.ShowDialog(); }); }
private void btnExportReport_Click(object sender, EventArgs e) { string timeString = dtpStart.Value.Date.ToString("yyyy_MM_") + dtpEnd.Value.Date.ToString("yyyy_MM"); ExportHelper.ExportEx(dgvData, "门禁统计_" + timeString + ".xls", "门禁统计_" + timeString); }
private void pageDataGridView1_PageControl_ExportCurrent(object sender, Li.Controls.PageEventArgs args) { ExportHelper.ExportEx(dgvData, "操作日志" + pageDataGridView.PageControl.CurrentPage + ".xls", "操作日志" + pageDataGridView.PageControl.CurrentPage); }
public void ProcessRequest(HttpContext context) { string action = context.Request.Params["action"] ?? ""; string proGuid = context.Request.Params["proguid"] ?? ""; if (action == "zjzfsubmit") { // xmguid:'<%=strProjGuid%>', zfje:$("#zfje").val(),zfsj:$("#zfsj").val(),skdw:$("#skdw").val() ZjzfSubmit(context); } else if (action == "zfjhsubmit") { Zfjhsubmit(context); } else if (action == "zjzfdel") { string guid = context.Request.Params["guid"] ?? ""; context.Response.Write(db.ExecuteNonQuery("delete from tz_zjzf where guid='" + guid + "'")); } else if (action == "zftj") { string dataJson = ""; string yzf = "{"; string jhzf = ""; int curYear = DateTime.Now.Year; DataSet ds = db.ExecuteDataSet("select xmguid,zfsj,case when cast(zfje as float) is null then 0 else cast(zfje as float) end as zfje from tz_zjzf where xmguid='" + proGuid + "' and sysstatus!=-1"); dataJson += "[{"; int title = 0; for (int i = curYear - 2; i <= curYear + 1; i++) { //string condition = "zfsj>=#" + i + "-01-01#"; string condition = "zfsj>=#" + i + "-01-01# AND zfsj<=#" + i + "-12-31#"; if (ds.Tables[0].Select(condition).Count() == 0) { dataJson += "\"" + "data" + title + "\":0"; } else { Object obj = ds.Tables[0].Compute("Sum(zfje)", condition); if (obj == null) { dataJson += "\"" + "data" + title + "\":0"; } else { double total = Convert.ToDouble(ds.Tables[0].Compute("Sum(zfje)", condition)); dataJson += "\"" + "data" + title + "\":" + total + ""; } } if (i != curYear + 1) { dataJson += ","; } title++; } dataJson += "},{"; DataSet ds2 = db.ExecuteDataSet("select xmguid,nd,case when cast(zfje as float) is null then 0 else cast(zfje as float) end as zfje from tz_zjzfjh where xmguid='" + proGuid + "' and sysstatus!=-1"); title = 0; for (int i = curYear - 2; i <= curYear + 1; i++) { //string condition = "zfsj>=#" + i + "-01-01#"; string condition = "nd='" + i + "'"; if (ds2.Tables[0].Select(condition).Count() == 0) { dataJson += "\"" + "data" + title + "\":0"; } else { Object obj = ds2.Tables[0].Compute("Sum(zfje)", condition); if (obj == null) { dataJson += "\"" + "data" + title + "\":0"; } else { double total = Convert.ToDouble(ds2.Tables[0].Compute("Sum(zfje)", condition)); dataJson += "\"" + "data" + title + "\":" + total + ""; } } if (i != curYear + 1) { dataJson += ","; } title++; } dataJson += "},{"; DataSet ds3 = db.ExecuteDataSet("select * from V_TZ_ProjectOverview where ProGuid='" + proGuid + "'"); dataJson += "\"yzf\":" + Convert.ToDouble(ds3.Tables[0].Rows[0]["zfje"]) + ","; double dzf = Convert.ToDouble(ds3.Tables[0].Rows[0]["htje"]) - Convert.ToDouble(ds3.Tables[0].Rows[0]["zfje"]); if (dzf < 0) { dzf = 0; } dataJson += "\"dzf\":" + dzf; dataJson += "}]"; context.Response.Write(dataJson); } else if (action == "zfjhdel") { string guid = context.Request.Params["guid"] ?? ""; context.Response.Write(db.ExecuteNonQuery("delete from tz_zjzfjh where guid='" + guid + "'")); } else if (action == "export") { string roletype = context.Request.Params["roletype"] ?? ""; string year = context.Request.Params["year"] ?? ""; //string querysql = "select a.*,case when cast(b.zfje as float) is not null then cast(b.zfje as float) else 0 end as zfje,case when cast(c.jhzfje as float) is not null then cast(c.jhzfje as float) else 0 end as jhzfje,c.beizhu,d.SortNum,CASE WHEN CAST(l.htje_gkzb AS FLOAT) IS NOT NULL THEN CAST(l.htje_gkzb AS FLOAT) ELSE 0 END + CASE WHEN CAST(m.htje_xj AS FLOAT) IS NOT NULL THEN CAST(m.htje_xj AS FLOAT) ELSE 0 END + CASE WHEN CAST(n.htje_jzxcs AS FLOAT) IS NOT NULL THEN CAST(n.htje_jzxcs AS FLOAT) ELSE 0 END + CASE WHEN CAST(o.htje_dyly AS FLOAT) IS NOT NULL THEN CAST(o.htje_dyly AS FLOAT) ELSE 0 END + CASE WHEN CAST(p.htje_zjcg AS FLOAT) IS NOT NULL THEN CAST(p.htje_zjcg AS FLOAT) ELSE 0 END as htje from tz_Project a left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_gkzb,xmguid from tz_gkzb where sysstatus!=-1 group by xmguid ) as l on a.ProGuid=l.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_xj,xmguid from tz_xj where sysstatus!=-1 group by xmguid ) as m on a.ProGuid=m.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_jzxcs,xmguid from tz_jzxcs where sysstatus!=-1 group by xmguid ) as n on a.ProGuid=n.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_dyly,xmguid from tz_dyly where sysstatus!=-1 group by xmguid ) as o on a.ProGuid=o.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_zjcg,xmguid from tz_zjcg where sysstatus!=-1 group by xmguid ) as p on a.ProGuid=p.xmguid left join (select sum(case when cast(zfje as float) is null then 0 else cast(zfje as float) end) as zfje,xmguid from [dbo].[tz_zjzf] where year(zfsj)=" + year + " and sysstatus!=-1 group by xmguid) b on a.ProGuid=b.xmguid left join (select sum(case when cast(zfje as float) is null then 0 else cast(zfje as float) end) as jhzfje,xmguid,dbo.MergeCharField(xmguid,'"+year+"') as beizhu from tz_zjzfjh where sysstatus!=-1 and nd='" + year + "' group by xmguid) c on a.ProGuid=c.xmguid left join Sys_UserGroups d on a.StartDeptGuid=d.Guid where a.ProState!='' and a.ProState is not null and a.sysstatus!=-1 "; string querysql = "select a.*,case when cast(h.ndzfje as float) is null then 0 else cast(h.ndzfje as float) end as ndzfje,case when cast(b.zfje as float) is not null then cast(b.zfje as float) else 0 end as zfje,case when cast(c.jhzfje as float) is not null then cast(c.jhzfje as float) else 0 end as jhzfje,c.beizhu,d.SortNum,CASE WHEN CAST(l.htje_gkzb AS FLOAT) IS NOT NULL THEN CAST(l.htje_gkzb AS FLOAT) ELSE 0 END + CASE WHEN CAST(m.htje_xj AS FLOAT) IS NOT NULL THEN CAST(m.htje_xj AS FLOAT) ELSE 0 END + CASE WHEN CAST(n.htje_jzxcs AS FLOAT) IS NOT NULL THEN CAST(n.htje_jzxcs AS FLOAT) ELSE 0 END + CASE WHEN CAST(o.htje_dyly AS FLOAT) IS NOT NULL THEN CAST(o.htje_dyly AS FLOAT) ELSE 0 END + CASE WHEN CAST(p.htje_zjcg AS FLOAT) IS NOT NULL THEN CAST(p.htje_zjcg AS FLOAT) ELSE 0 END + CASE WHEN CAST(x.htje_yqzb AS FLOAT) IS NOT NULL THEN CAST(x.htje_yqzb AS FLOAT) ELSE 0 END + CASE WHEN CAST(y.htje_jzxtp AS FLOAT) IS NOT NULL THEN CAST(y.htje_jzxtp AS FLOAT) ELSE 0 END as htje from tz_Project a left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_gkzb,xmguid from tz_gkzb where sysstatus!=-1 group by xmguid ) as l on a.ProGuid=l.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_xj,xmguid from tz_xj where sysstatus!=-1 group by xmguid ) as m on a.ProGuid=m.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_jzxcs,xmguid from tz_jzxcs where sysstatus!=-1 group by xmguid ) as n on a.ProGuid=n.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_yqzb,xmguid from tz_yqzb where sysstatus!=-1 group by xmguid ) as x on a.ProGuid=x.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_jzxtp,xmguid from tz_jzxtp where sysstatus!=-1 group by xmguid ) as y on a.ProGuid=y.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_dyly,xmguid from tz_dyly where sysstatus!=-1 group by xmguid ) as o on a.ProGuid=o.xmguid left outer join (select sum(CASE WHEN CAST(htje AS FLOAT) IS NOT NULL THEN CAST(htje AS FLOAT) ELSE 0 END) as htje_zjcg,xmguid from tz_zjcg where sysstatus!=-1 group by xmguid ) as p on a.ProGuid=p.xmguid left join (select sum(case when cast(zfje as float) is null then 0 else cast(zfje as float) end) as zfje,xmguid from [dbo].[tz_zjzf] where sysstatus!=-1 group by xmguid) b on a.ProGuid=b.xmguid left join (select sum(case when cast(zfje as float) is null then 0 else cast(zfje as float) end) as ndzfje,xmguid from [dbo].[tz_zjzf] where sysstatus!=-1 and year(zfsj)=" + year + " group by xmguid) h on a.ProGuid=h.xmguid left join (select sum(case when cast(zfje as float) is null then 0 else cast(zfje as float) end) as jhzfje,xmguid,dbo.MergeCharField(xmguid,'" + year + "') as beizhu from tz_zjzfjh where sysstatus!=-1 and nd='" + year + "' group by xmguid) c on a.ProGuid=c.xmguid left join Sys_UserGroups d on a.StartDeptGuid=d.Guid where a.ProState!='' and a.ProState is not null and a.sysstatus!=-1 "; string ordersql = " order by cast(SortNum as int),StartDate"; //导出所有部门报表 if (roletype == "0") { } //导出部门报表 else { string startdeptguid = context.Request.Params["bmguid"] ?? ""; querysql += " and startdeptguid='" + startdeptguid + "' "; } DataSet ds = db.ExecuteDataSet(querysql + ordersql); ExportHelper e; string path = ConfigurationManager.AppSettings["excelpath"]; context.Response.Write(ExportHelper.ExportToExcel2(ds, year, path)); } }
protected void btnExportWord_Click(object sender, EventArgs e) { string isim = "Extre-" + DateTime.Now.ToString(); ExportHelper.ToWord(GridView2, isim); }
public void WriteIntoFile() { string filePathX = fileFolderPath + saveFileName + "_dataX"; string filePathY = fileFolderPath + saveFileName + "_dataY"; string filePathZ = fileFolderPath + saveFileName + "_dataZ"; StreamWriter dataWriterX = new StreamWriter(filePathX); StreamWriter dataWriterY = new StreamWriter(filePathY); StreamWriter dataWriterZ = new StreamWriter(filePathZ); // write positions if (recordTranslation) { dataWriterX.Write(getMayaCurveHeadContent("animCurveTL", "translateX", tracker.posDataList.Count)); dataWriterY.Write(getMayaCurveHeadContent("animCurveTL", "translateY", tracker.posDataList.Count)); dataWriterZ.Write(getMayaCurveHeadContent("animCurveTL", "translateZ", tracker.posDataList.Count)); Vector3 mayaPos = Vector3.zero; // write datas for (int i = 0; i < tracker.posDataList.Count; i++) { mayaPos = ExportHelper.UnityToMayaPosition(tracker.posDataList [i]); dataWriterX.Write(" " + i + " " + mayaPos.x); dataWriterY.Write(" " + i + " " + mayaPos.y); dataWriterZ.Write(" " + i + " " + mayaPos.z); } // end file data dataWriterX.Write(";\n"); dataWriterY.Write(";\n"); dataWriterZ.Write(";\n"); // write ending content dataWriterX.Write(getMayaCurveFootContent("translateX", "tx")); dataWriterY.Write(getMayaCurveFootContent("translateY", "ty")); dataWriterZ.Write(getMayaCurveFootContent("translateZ", "tz")); } // write rotations if (recordRotation) { dataWriterX.Write(getMayaCurveHeadContent("animCurveTA", "rotateX", tracker.rotDataList.Count)); dataWriterY.Write(getMayaCurveHeadContent("animCurveTA", "rotateY", tracker.rotDataList.Count)); dataWriterZ.Write(getMayaCurveHeadContent("animCurveTA", "rotateZ", tracker.rotDataList.Count)); Vector3 mayaRot = Vector3.zero; // write datas for (int i = 0; i < tracker.rotDataList.Count; i++) { mayaRot = ExportHelper.UnityToMayaRotation(tracker.rotDataList [i]); dataWriterX.Write(" " + i + " " + mayaRot.x); dataWriterY.Write(" " + i + " " + mayaRot.y); dataWriterZ.Write(" " + i + " " + mayaRot.z); } // end file data dataWriterX.Write(";\n"); dataWriterY.Write(";\n"); dataWriterZ.Write(";\n"); // write ending content dataWriterX.Write(getMayaCurveFootContent("rotateX", "rx")); dataWriterY.Write(getMayaCurveFootContent("rotateY", "ry")); dataWriterZ.Write(getMayaCurveFootContent("rotateZ", "rz")); } // write scales if (recordScale) { dataWriterX.Write(getMayaCurveHeadContent("animCurveTU", "scaleX", tracker.scaleDataList.Count)); dataWriterY.Write(getMayaCurveHeadContent("animCurveTU", "scaleY", tracker.scaleDataList.Count)); dataWriterZ.Write(getMayaCurveHeadContent("animCurveTU", "scaleZ", tracker.scaleDataList.Count)); Vector3 mayaScale = Vector3.zero; // write datas for (int i = 0; i < tracker.rotDataList.Count; i++) { mayaScale = tracker.scaleDataList [i]; dataWriterX.Write(" " + i + " " + mayaScale.x); dataWriterY.Write(" " + i + " " + mayaScale.y); dataWriterZ.Write(" " + i + " " + mayaScale.z); } // end file data dataWriterX.Write(";\n"); dataWriterY.Write(";\n"); dataWriterZ.Write(";\n"); // write ending content dataWriterX.Write(getMayaCurveFootContent("scaleX", "sx")); dataWriterY.Write(getMayaCurveFootContent("scaleY", "sy")); dataWriterZ.Write(getMayaCurveFootContent("scaleZ", "sz")); } // end writing dataWriterX.Close(); dataWriterY.Close(); dataWriterZ.Close(); // process final file objFinalFilePath = fileFolderPath + saveFileName + "_all"; File.AppendAllText(objFinalFilePath, File.ReadAllText(filePathX)); File.AppendAllText(objFinalFilePath, File.ReadAllText(filePathY)); File.AppendAllText(objFinalFilePath, File.ReadAllText(filePathZ)); // clean x y z files File.Delete(filePathX); File.Delete(filePathY); File.Delete(filePathZ); }
void btnExportStyles_Click(object sender, EventArgs e) { string fileName = "ContentStyles-" + siteSettings.SiteName + "-" + DateTimeHelper.GetDateTimeStringForFileName() + ".xml"; ExportHelper.ExportStringAsFile(HttpContext.Current, Encoding.Unicode, "text/xml", SkinHelper.GetStyleExportString(siteSettings.SiteGuid), fileName); }
protected void btnExportWord_Click(object sender, EventArgs e) { string isim = "Müşteri Ödemeleri-" + DateTime.Now.ToString(); ExportHelper.ToWord(GridView1, isim); }
// // GET: /ModuleWF/WorkFlow/ public ActionResult Index(ModelWorkFlowIndex model, ExportHelper export) { model.RetriveData(); return View(model); }
private void AsyncExportWord(GridColumnCollection Columns, GridDataItemCollection Items) { Table table = ExportHelper.TableFromGrid(Columns, Items); ExportHelper.ExportToWord(table, Page, string.Format("{0}{1}", ExportSettings.FileName, FileHelper.DOC)); }
protected void btnExportExcel_Click(object sender, EventArgs e) { string isim = "Fatura Listesi-" + DateTime.Now.ToString(); ExportHelper.ToExcell(grdAlimlar, isim); }
private void InitCommand() { QueryBaseCommand = new DelegateCommand((obj) => { SalesRebateSummaryLists.Clear(); ListsCount = 0; ListsSum = 0; SalesRebateLists.Clear(); RebatePctValueString = string.Empty; _salesRebateService.GetSalesRebateSummaryLists(UserDataId, CommonService.GetSqlWhereString(QueryParameter)).ForEach(x => { SalesRebateSummaryLists.Add(x); ListsSum += x.OrgAmount; ListsCount++; }); }); DirectorySelectBaseCommand = new DelegateCommand((obj) => { // 导出目录选择 System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { HostConfig.HostValue = fbd.SelectedPath; var result = CommonService.SaveHostConfig(HostConfig); if (result) { HostConfig = CommonService.GetHostConfig(DataGridId, HostName, User.ID); } } }); ExportBaseCommand = new DelegateCommand((obj) => { if (Directory.Exists(HostConfig.HostValue)) { ExportView view = new ExportView(DataGridId, 1); (view.DataContext as ExportViewModel).Export((type, outputEntity, checkBoxValue, orderedColumns) => { view.Close(); if (type == 1) { DataTable datatable = new DataTable(); if (outputEntity == 1) { // 获取导出数据名称 string viewName = CommonService.GetExportViewName(DataGridId, 1); if (!string.IsNullOrEmpty(viewName)) { datatable = viewName.EndsWith("Proc")? _salesRebateService.GetExportDataProc(viewName, ReportQueryParameter): CommonService.GetExportDataView(viewName, CommonService.GetSqlWhereString(ReportQueryParameter)); ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(ReportQueryParameter)); MessageBox.Show("导出成功"); } } else if (outputEntity == 2) { // 获取导出数据名称 string viewName = CommonService.GetExportViewName(DataGridId, 2); if (!string.IsNullOrEmpty(viewName)) { datatable = viewName.EndsWith("Proc") ? _salesRebateService.GetExportDataProc(viewName, ReportQueryParameter) : CommonService.GetExportDataView(viewName, CommonService.GetSqlWhereString(ReportQueryParameter)); ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(ReportQueryParameter)); MessageBox.Show("导出成功"); } } else if (outputEntity == 3) { // 获取导出数据名称 string procName = CommonService.GetExportViewName(DataGridId, 3); if (!string.IsNullOrEmpty(procName)) { datatable = CommonService.GetExportDataProcedure(procName, UserDataId, string.Join(",", orderedColumns), CommonService.GetSqlWhereString(ReportQueryParameter)); ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(ReportQueryParameter), checkBoxValue, orderedColumns, false, "", false); MessageBox.Show("导出成功"); } } } }); view.ShowDialog(); } else { MessageBox.Show("目录不存在,请先选择导出的目录"); DirectorySelectBaseCommand.Execute(null); } CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "ExportBaseCommand", ActionDesc = HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(QueryParameter), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); }); SalesRebateRecentParameterConfigCommand = new DelegateCommand((obj) => { if (BatchParameter.OrganizationSearchedItem != null && BatchParameter.RebateClassSeletedItem != null) { if (BatchParameterVerification(out DateTime maxDate)) { if (_salesRebateService.IfExistsOrgICSaleBill(BatchParameter)) { SalesRebateRecentParameterView view = new SalesRebateRecentParameterView(BatchParameter); (view.DataContext as SalesRebateRecentParameterViewModel).WithParam(null, (type, outputEntity, isChanged) => { view.Close(); if (isChanged) { // 计算刚才配置的参数 _salesRebateService.CalculateAmount(BatchParameter, User.ID, true); // 查询出刚生成的数据 QueryBaseCommand.Execute(null); } }); view.Show(); CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "SalesRebateRecentParameterConfigCommand", ActionDesc = CommonService.GetSqlWhereString(BatchParameter), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); } else { MessageBox.Show($"【{BatchParameter.SettleDateBegin}】至【{BatchParameter.SettleDateEnd}】 ,客户【{BatchParameter.OrganizationSearchedItem.Name}】 没有K3销售单据"); } } else { MessageBox.Show($"【{maxDate}】 该类型【{BatchParameter.RebateClassSeletedItem.ItemValue} 】已经返利,同时间点不能多次返利"); } } else { MessageBox.Show("请先输入客户和返利类别"); } }); SalesRebateK3ApiInsertCommand = new DelegateCommand((obj) => { StringBuilder stringBuilder = new StringBuilder(); if (SalesRebateSummarySelectedItem != null && string.IsNullOrEmpty(SalesRebateSummarySelectedItem.K3BillNo) && SalesRebateLists.Count > 0) { var maxDate = _salesRebateService.GetMaxSettleDateByOrgId(BatchParameter.OrganizationSearchedItem.Id, BatchParameter.RebateClassSeletedItem.ItemSeq); if (SalesRebateSummarySelectedItem.SettleDateBegin > maxDate && SalesRebateSummarySelectedItem.SettleDateEnd > maxDate) { SalesInvoiceVATMainModel main = new SalesInvoiceVATMainModel { Fdate = SalesRebateSummarySelectedItem.SettleDateEnd.AddDays(5).ToString("yyyy-MM-dd"), FCustID = K3ApiFKService.GetOrganizationById(SalesRebateSummarySelectedItem.OrgId), FBillerID = new BaseNumberNameModelX { FNumber = User.UserName, FName = User.UserName }, FNote = "结算日期:" + SalesRebateSummarySelectedItem.SettleDateBegin.Date.ToString("yyyy-MM-dd") + "至" + SalesRebateSummarySelectedItem.SettleDateEnd.Date.ToString("yyyy-MM-dd") }; var son = new SalesInvoiceVATSonModel { Fauxprice = SalesRebateSummarySelectedItem.OrgAmount, Famount = SalesRebateSummarySelectedItem.OrgAmount * main.FROB, FStdAmount = SalesRebateSummarySelectedItem.OrgAmount * main.FROB, FTaxRate = SalesRebateSummarySelectedItem.OrgAmount * 0.13, FTaxAmount = SalesRebateSummarySelectedItem.OrgAmount * 0.13 * main.FROB, FStdTaxAmount = SalesRebateSummarySelectedItem.OrgAmount * 0.13 * main.FROB, FAllAmount = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13), FAuxTaxPrice = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13), FAuxPriceDiscount = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13), FAmountincludetax = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13) * main.FROB, FStdAmountincludetax = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13) * main.FROB, FRemainAmount = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13) * main.FROB, FRemainAmountFor = SalesRebateSummarySelectedItem.OrgAmount * (1 + 0.13) * main.FROB, }; var requestModel = new K3ApiInsertRequestModel <SalesInvoiceVATMainModel, SalesInvoiceVATSonModel>() { Data = new K3ApiInsertDataRequestModel <SalesInvoiceVATMainModel, SalesInvoiceVATSonModel>() { Page1 = new List <SalesInvoiceVATMainModel> { main }, Page2 = new List <SalesInvoiceVATSonModel> { son } } }; string postJson = JsonHelper.ObjectToJson(requestModel); K3ApiInsertResponseModel response = K3ApiXService.Insert(Token, "Sales_Invoice_VAT", postJson); if (response.StatusCode == 200) { // 更新后台数据 _salesRebateService.UpdateK3BillNo(SalesRebateSummarySelectedItem.Id, response.Data.BillNo, SalesRebateSummarySelectedItem.SettleDateEnd.AddDays(5)); stringBuilder.Append($"成功 BillNo:{response.Data.BillNo}, SettleDateBegin:{SalesRebateSummarySelectedItem.SettleDateBegin}, SettleDateEnd:{SalesRebateSummarySelectedItem.SettleDateEnd},OrgId: {SalesRebateSummarySelectedItem.OrgId}, RebateClass:{SalesRebateSummarySelectedItem.RebateClass}"); } else { MessageBox.Show(response.Message); stringBuilder.Append($"{response.Message}"); CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "SalesRebateRecentParameterConfigCommand", ActionDesc = stringBuilder.ToString(), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); return; } } else { MessageBox.Show($"【{maxDate}】 该类型【{BatchParameter.RebateClassSeletedItem.ItemValue} 】已经返利,同时间点不能多次返利"); } } //重新加载数据 QueryBaseCommand.Execute(null); CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "SalesRebateK3ApiInsertCommand", ActionDesc = stringBuilder.ToString(), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); }); SalesRebateK3ApiRemoveCommand = new DelegateCommand((obj) => { // 弹出删除提示 if (MessageBox.Show($"此操作会将K3单据和本条记录同时删除", "温馨提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (SalesRebateSummarySelectedItem != null && !string.IsNullOrEmpty(SalesRebateSummarySelectedItem.K3BillNo)) { string k3BillNo = SalesRebateSummarySelectedItem.K3BillNo; // 可选参数FInterID,当FBillNo重复时传入,【只删除明细行】 string postJson = @"{""Data"": {""FBillNo"":""" + k3BillNo + @"""}}"; var response = K3ApiXService.Delete(Token, "Sales_Invoice_VAT", postJson); // 如果Token过期则重新加载 if (response.StatusCode == 200) { if (_salesRebateService.SummaryDelete(SalesRebateSummarySelectedItem.Id, SalesRebateSummarySelectedItem.Guid)) { MessageBox.Show("删除K3单据成功"); } else { MessageBox.Show("后台删除失败,单据不存在"); } } else if (response.Message.IndexOf("token", StringComparison.OrdinalIgnoreCase) > 0) { Token = K3ApiXService.GetToken(); response = K3ApiXService.Delete(Token, "Sales_Invoice_VAT", postJson); MessageBox.Show(response.Message); } else { MessageBox.Show(response.Message); } CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "SalesRebateK3ApiRemoveCommand", ActionDesc = k3BillNo, UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName }); QueryBaseCommand.Execute(null); } else { MessageBox.Show("一次只能选择一个K3单据且已经生成过K3单据"); } } }); DetailSelectionChangedCommand = new DelegateCommand((obj) => { if (SalesRebateSelectedItem != null) { var lists = _salesRebateAmountRangeService.GetSalesRebateAmountRangeRecentParameterLists(SalesRebateSelectedItem.PGuid); if (lists.Count > 0) { StringBuilder result = new StringBuilder(); foreach (var item in lists) { result.Append($"金额区间:{item.AmountLower}-{item.AmountUpper} 万元 比例:{item.SalesRebatePctValue}% \t\t"); } RebatePctValueString = result.ToString(); } else { RebatePctValueString = string.Empty; } } }); SummarySelectionChangedCommand = new DelegateCommand((obj) => { if (SalesRebateSummarySelectedItem != null) { RebatePctValueString = string.Empty; SalesRebateLists.Clear(); _salesRebateService.GetSalesRebateListsByGuid(SalesRebateSummarySelectedItem.Guid).ForEach(x => SalesRebateLists.Add(x)); } }); SalesRebateSummaryDeleteCommand = new DelegateCommand((obj) => { if (SalesRebateSummarySelectedItem != null && string.IsNullOrEmpty(SalesRebateSummarySelectedItem.K3BillNo)) { _salesRebateService.SummaryDelete(SalesRebateSummarySelectedItem.Id, SalesRebateSummarySelectedItem.Guid); QueryBaseCommand.Execute(null); } }); ReportQueryCommand = new DelegateCommand((obj) => { ReportLists.Clear(); _salesRebateService.GetCaseAmountReport(ReportQueryParameter).ForEach(x => ReportLists.Add(x)); }); AmountCalculateCommand = new DelegateCommand((obj) => { if (BatchParameterVerification(out DateTime maxDate)) { // 计算刚才配置的参数 _salesRebateService.CalculateAmount(BatchParameter, User.ID, false); // 查询出刚生成的数据 QueryBaseCommand.Execute(null); } else { MessageBox.Show($"【{maxDate}】 该类型【{BatchParameter.RebateClassSeletedItem.ItemValue} 】已经返利,同时间点不能多次返利"); } }); }
public async void ExportChannels() { // Get last used token var token = _settingsService.LastToken !; // Create dialog var dialog = _viewModelFactory.CreateExportSetupViewModel(SelectedGuild !, SelectedChannels !); // Show dialog, if canceled - return if (await _dialogManager.ShowDialogAsync(dialog) != true) { return; } // Create a progress operation for each channel to export var operations = ProgressManager.CreateOperations(dialog.Channels.Count); // Export channels var successfulExportCount = 0; for (var i = 0; i < dialog.Channels.Count; i++) { // Get operation and channel var operation = operations[i]; var channel = dialog.Channels[i]; try { // Generate file path if necessary var filePath = dialog.OutputPath !; if (ExportHelper.IsDirectoryPath(filePath)) { // Generate default file name var fileName = ExportHelper.GetDefaultExportFileName(dialog.SelectedFormat, dialog.Guild, channel, dialog.After, dialog.Before); // Combine paths filePath = Path.Combine(filePath, fileName); } // Get chat log var chatLog = await _dataService.GetChatLogAsync(token, dialog.Guild, channel, dialog.After, dialog.Before, operation); // Export await _exportService.ExportChatLogAsync(chatLog, filePath, dialog.SelectedFormat, dialog.PartitionLimit); // Report successful export successfulExportCount++; } catch (HttpErrorStatusCodeException ex) when(ex.StatusCode == HttpStatusCode.Forbidden) { Notifications.Enqueue($"You don't have access to channel [{channel.Model.Name}]"); } catch (HttpErrorStatusCodeException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { Notifications.Enqueue($"Channel [{channel.Model.Name}] doesn't exist"); } finally { // Dispose progress operation operation.Dispose(); } } // Notify of overall completion Notifications.Enqueue($"Successfully exported {successfulExportCount} channel(s)"); }
public string OrderProposalList_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails> > aggregatorsInfo) { if (exportOptions.Range == ExportHelper.Range.TOP100) { datasourceRequest.StartRow = 0; datasourceRequest.PageSize = 100; } else if (exportOptions.Range == ExportHelper.Range.ALL) { datasourceRequest.StartRow = 0; datasourceRequest.PageSize = int.MaxValue; } if (string.IsNullOrWhiteSpace(exportOptions.Filename)) { exportOptions.Filename = "OrderProposalList"; } if (exportOptions.ColumnOptions == null) { exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions> { new ExportHelper.ColumnOptions { Column = "Item.SKU", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Item.Description", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Warehouse.Description", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "Quantity", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "RecommendedOrderDate", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "SalesForecastDate", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "SupplierCanDeliver", IsVisible = true }, new ExportHelper.ColumnOptions { Column = "SupplierMaxQuantity", IsVisible = true }, }; } var queryable = Get_OrderProposalList_DatasourceQueryable(datasourceRequest); var totalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(); var items = DatasourceRetriever.Retrieve(datasourceRequest, queryable);; var dto = items.Select(i => new OrderProposalDataSet_OrderForecastDetailsDTO(i)); var formattings = new Dictionary <string, string>(); formattings.Add("RecommendedOrderDate", "dd/MM/yyyy"); formattings.Add("SalesForecastDate", "dd/MM/yyyy"); var aggregators = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo); foreach (var a in aggregators) { var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null; a.Calculate(queryable, formatting); } var exportDataDTO = new List <ExportHelper.ExportRecordDTO>(); foreach (var record in dto) { var recordDTO = new ExportHelper.ExportRecordDTO(); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = "Item.SKU", Value = record?.Item?.SKU, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Item.SKU") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = "Item.Description", Value = record?.Item?.Description, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Item.Description") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = "Warehouse.Description", Value = record?.Warehouse?.Description, ColumnDataType = "string", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Warehouse.Description") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.Quantity), Value = record?.Quantity, ColumnDataType = "decimal", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Quantity") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.RecommendedOrderDate), Value = record?.RecommendedOrderDate, ColumnDataType = "DateTime", Format = "dd/MM/yyyy", ExcelFormat = @"dd/MM/yyyy", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_RecommendedOrderDate") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.SalesForecastDate), Value = record?.SalesForecastDate, ColumnDataType = "DateTime", Format = "dd/MM/yyyy", ExcelFormat = @"dd/MM/yyyy", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SalesForecastDate") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.SupplierCanDeliver), Value = record?.SupplierCanDeliver, ColumnDataType = "bool", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SupplierCanDeliver") }); recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = nameof(record.SupplierMaxQuantity), Value = record?.SupplierMaxQuantity, ColumnDataType = "decimal", Format = "", ExcelFormat = @"", Caption = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SupplierMaxQuantity") }); exportDataDTO.Add(recordDTO); } if (aggregators.Count > 0) { foreach (AggregatorType aggregatorType in Enum.GetValues(typeof(AggregatorType))) { var emptyAggregatorRow = true; var recordDTO = new ExportHelper.ExportRecordDTO(); foreach (var columnOption in exportOptions.ColumnOptions) { var aggregatorValue = ""; switch (aggregatorType) { case AggregatorType.COUNT: if (columnOption.CountIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.COUNT); aggregatorValue = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandCount")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; case AggregatorType.SUM: if (columnOption.SumIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.SUM); aggregatorValue = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandTotal")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; case AggregatorType.AVERAGE: if (columnOption.AverageIsVisible) { var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.AVERAGE); aggregatorValue += $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandAverage")} {averageAggregator?.ValueFormatted}"; emptyAggregatorRow = false; } break; } recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO { ColumnName = columnOption.Column, Value = aggregatorValue, ColumnDataType = "string", Format = "" }); } if (!emptyAggregatorRow) { exportDataDTO.Add(recordDTO); } } } var path = ExportHelper.ExportList(exportDataDTO, exportOptions, totalRows); var content = System.IO.File.ReadAllBytes(Path.Combine(Path.GetTempPath(), path)); var fileName = Path.GetFileName(path); return(FileHelper.PendingDownloadInstance.Add("SupplierOrderForecast", content, fileName)); }
protected void btnExportWord_Click(object sender, EventArgs e) { string isim = "Stok Listesi-" + DateTime.Now.ToString(); ExportHelper.ToWord(grdAlimlar, isim); }
static void SaveNetwork() { ExportHelper.ExportNetwork(network, learnedNetworkFilename, new XmlSerializer()); }
private void btnXuatBanHopDong_Click(object sender, EventArgs e) { if (txtHo.Text == "") { clsMessage.MessageWarning("Chưa có thông tin tập huấn viên chính. Vui lòng kiểm tra lại."); return; } var bThoiGian = string.Format("{0} ({1} ngày)", FunctionHelper.formatFromDateToDate(tapHuanData.TH_THOIGIAN_BATDAU, tapHuanData.TH_THOIGIAN_KETTHUC), tapHuanData.TH_TONGSO_NGAY); var bDoiTuong = tapHuanData.TH_DOITUONG_HV_TEN != "" ? "Hội viên" : ""; if (tapHuanNguoiKhongKT.Count() > 0) { bDoiTuong += (bDoiTuong != "" ? " - " : "") + "Người không khuyết tật"; } var dataPrint = new Dictionary <string, string>() { { "bDiaChi", txtDiaChi.Text }, { "bDienThoai", txtSoDienThoai.Text }, { "bChucVu", txtChucVu.Text }, { "bTenTaiKhoan", txtHo.Text + " " + txtTen.Text }, { "bSoTaiKhoan", txtSTK.Text }, { "bNganHang", txtTenNganHang.Text }, { "bDiaChiNganHang", txtDiaChiNganHang.Text }, { "bMaSoThue", txtMaSoThue.Text }, { "bTenTapHuan", tapHuanData.TH_TEN }, { "bThoiGian", bThoiGian }, { "bDiaDiem", tapHuan_DiaDiemData.TH_DD_TEN }, { "bDoiTuong", bDoiTuong }, { "bSoLuongThamDu", tapHuanData.TH_DOITUONG_TONGSO.ToString() } }; string fileName = ""; int tongTien = 0; switch ((CategoryTapHuanChiTietLoai)_loai_id) { case CategoryTapHuanChiTietLoai.NGUOI_THUC_HIEN: break; case CategoryTapHuanChiTietLoai.TAP_HUAN_VIEN_CHINH: case CategoryTapHuanChiTietLoai.TAP_HUAN_VIEN_PHU: dataPrint.Add("bThanhTien_1", (seThuLao_1.Ex_EditValueToInt() ?? 0).ToString("#,#")); dataPrint.Add("bThanhTien_2", (seThuLao_2.Ex_EditValueToInt() ?? 0).ToString("#,#")); dataPrint.Add("bThanhTien_3", (seThuLao_3.Ex_EditValueToInt() ?? 0).ToString("#,#")); dataPrint.Add("bThanhTien_4", (seThuLao_4.Ex_EditValueToInt() ?? 0).ToString("#,#")); tongTien = (seThuLao_1.Ex_EditValueToInt() ?? 0) + (seThuLao_2.Ex_EditValueToInt() ?? 0) + (seThuLao_3.Ex_EditValueToInt() ?? 0) + (seThuLao_4.Ex_EditValueToInt() ?? 0); dataPrint.Add("bThanhTien_TongTien", tongTien.ToString("#,#")); fileName = "THV_hop_dong_thue.doc"; break; case CategoryTapHuanChiTietLoai.PHIEN_DICH_VIEN: dataPrint.Add("bThanhTien_1", (seThuLao_1.Ex_EditValueToInt() ?? 0).ToString("#,#")); dataPrint.Add("bThanhTien_2", (seThuLao_2.Ex_EditValueToInt() ?? 0).ToString("#,#")); tongTien = (seThuLao_1.Ex_EditValueToInt() ?? 0) + (seThuLao_2.Ex_EditValueToInt() ?? 0); dataPrint.Add("bThanhTien_TongTien", tongTien.ToString("#,#")); fileName = "PDV_hop_dong_thue.doc"; break; case CategoryTapHuanChiTietLoai.DOITUONG_KHONG_KHUYETTAT: layGroupVanBan.Visibility = layGroupThuLao.Visibility = LayoutVisibility.Never; break; default: break; } if (fileName == "") { clsMessage.MessageInfo("Biểu mẫu chưa được cấu hình. Vui lòng kiểm tra lại"); return; } ExportHelper.exportWord(dataPrint, fileName); }
public void LoadExportedScene(string vsceneFile) { EditorApp.EngineManager.DisableRendering(); ExportHelper.LoadExportedScene(vsceneFile); EditorApp.EngineManager.EnableRendering(); }
public dynamic ExportGroupPerformance(Filter filters, string userName) { using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString)) { Filter f = new Filter() { filters = filters.filters, range = filters.range }; SqlCommand sqlComm = DashboardHelpers.GetFiltersParameters(f, "getGroupPerfAPI", userName); sqlComm.Connection = sqlCon; var gpl = new List <GroupPerformance>(); try { sqlCon.Open(); SqlDataReader reader = sqlComm.ExecuteReader(); while (reader.Read()) { try { PeriodPerformance period = new PeriodPerformance() { callsCount = int.Parse(reader.GetValue(reader.GetOrdinal("num_calls")).ToString()), score = float.Parse(reader.GetValue(reader.GetOrdinal("avg_score")).ToString()) }; PeriodPerformance prviousPeriod = new PeriodPerformance() { callsCount = int.Parse(reader.GetValue(reader.GetOrdinal("prev_num_calls")).ToString()), score = float.Parse(reader.GetValue(reader.GetOrdinal("prev_avg_score")).ToString()) }; GroupInfo groupInfo = new GroupInfo() { id = reader.GetValue(reader.GetOrdinal("agent_group")).ToString(), name = reader.GetValue(reader.GetOrdinal("agent_group")).ToString() }; gpl.Add(new GroupPerformance { groupInfo = groupInfo, scorecardName = reader.GetValue(reader.GetOrdinal("scorecard_name")).ToString(), currentPeriod = period, previousPeriod = prviousPeriod }); } catch { } } ; //return gpl; var propNames = new List <PropertieName> { new PropertieName { propName = "Group name", propValue = "name", propPosition = 1 }, new PropertieName { propName = "Scorecard name", propValue = "scorecardName", propPosition = 2 }, new PropertieName { propName = "Score current period", propValue = "currentScore", propPosition = 3 }, new PropertieName { propName = "Calls current period", propValue = "currentCalls", propPosition = 4 }, new PropertieName { propName = "Score previous period", propValue = "previousScore", propPosition = 5 }, new PropertieName { propName = "Calls previous period", propValue = "previousCalls", propPosition = 6 }, new PropertieName { propName = "Delta score", propValue = "delta", propPosition = 7 } }; List <ExportGroupPerformanceModel> exportGroupPerformanceModels = new List <ExportGroupPerformanceModel>(); foreach (var item in gpl) { exportGroupPerformanceModels.Add(new ExportGroupPerformanceModel { name = item.groupInfo.name, scorecardName = item.scorecardName, currentScore = item.currentPeriod.score, currentCalls = item.currentPeriod.callsCount, previousCalls = item.previousPeriod.callsCount, previousScore = item.previousPeriod.score, delta = (item.currentPeriod.score - item.previousPeriod.score) + "%" }); } ExportHelper.Export(propNames, exportGroupPerformanceModels, "GroupPerformance" + DateTime.Now.ToString("MM-dd-yyyy") + DateTime.Now.Second.ToString() + ".xlsx", "GroupPerformance", userName); } catch (Exception ex) { throw ex; } } return("success"); }
public void CloseExportedScene() { ExportHelper.LoadExportedScene(null); }
/// <summary> /// 生成excel /// </summary> /// <returns></returns> public void exporttoexcel(string[] _dataValue, string[,] SpeedTestData, string[,] _UnitTesting_data, string _fimeName, string[] TCUtemperature, string[,] StepTest_data, string[,] StepTest_Instruction, string[,] solenoid1Data, string[,] solenoid2Data) { CreateDirectory("D:/产品档案/自动测试/" + ((App)Application.Current)._TestInformation[2]); //判断目录是否存在,不存在则创建 _fimeName = "D:/产品档案/自动测试/" + ((App)Application.Current)._TestInformation[2] + "/" + _fimeName + ".xls"; DeleteFile(_fimeName); //判断是否已经存在该文件,存在则删除 _TestInformation = ((App)Application.Current)._TestInformation; ParameterCollection collection = new ParameterCollection(); collection.Load(Directory.GetCurrentDirectory() + "/Excel_File/档案模板.xml"); List <ElementFormatter> sheet1Formatters = new List <ElementFormatter>(); List <ElementFormatter> sheet2Formatters = new List <ElementFormatter>(); //单体测试 List <ElementFormatter> sheet3Formatters = new List <ElementFormatter>(); //阶跃测试 List <ElementFormatter> sheet4Formatters = new List <ElementFormatter>(); //换挡性能测试 for (int i = 0; i < _TestInformation.Length; i++) { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "Infor" + i], _TestInformation[i])); } for (int j = 0; j < _dataValue.Length; j++) { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "dataValue" + j], _dataValue[j])); } for (int n = 0; n < SpeedTestData.Length / 4; n++) { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "TCUInputSpeed" + n], SpeedTestData[0, n])); sheet1Formatters.Add(new CellFormatter(collection["测试报告", "TCUOnputSpeed" + n], SpeedTestData[2, n])); } //单体测试 for (int j = 0; j < _UnitTesting_data.Length / 14; j++) { sheet2Formatters.Add(new CellFormatter(collection["数据表", "EPC_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[0, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "EPC_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[1, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "TCC_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[2, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "TCC_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[3, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C1234_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[4, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C1234_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[5, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "CB26_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[6, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "CB26_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[7, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C35R_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[8, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C35R_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[9, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C456_RealPressureL_H" + j], Convert.ToDouble(_UnitTesting_data[10, j]))); sheet2Formatters.Add(new CellFormatter(collection["数据表", "C456_RealPressureH_L" + j], Convert.ToDouble(_UnitTesting_data[11, j]))); } //换挡电磁阀测试结果 sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureL_H_L"], Convert.ToDouble(_UnitTesting_data[12, 0]))); sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureL_H_H"], Convert.ToDouble(_UnitTesting_data[12, 2]))); if (_UnitTesting_data[12, 3] == "合格" && _UnitTesting_data[12, 1] == "合格") { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureL_H"], "合格")); } else { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureL_H"], "不合格")); } sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureH_L_L"], Convert.ToDouble(_UnitTesting_data[13, 0]))); sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureH_L_H"], Convert.ToDouble(_UnitTesting_data[13, 2]))); if (_UnitTesting_data[13, 3] == "合格" && _UnitTesting_data[13, 1] == "合格") { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureH_L"], "合格")); } else { sheet1Formatters.Add(new CellFormatter(collection["测试报告", "shift_RealPressureH_L"], "不合格")); } //温度测试结果 sheet1Formatters.Add(new CellFormatter(collection["测试报告", "TCUtemperature"], TCUtemperature[0] + "°C~" + TCUtemperature[1] + "°C")); //阶跃测试 for (int t = 0; t < StepTest_data.Length / 12; t++) { sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "EPC_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[0, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "EPC_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[1, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "TCC_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[2, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "TCC_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[3, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C1234_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[4, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C1234_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[5, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "CB26_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[6, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "CB26_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[7, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C35R_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[8, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C35R_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[9, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C456_StepTest_dataL_H" + t], Convert.ToDouble(StepTest_data[10, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C456_StepTest_dataH_L" + t], Convert.ToDouble(StepTest_data[11, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "EPC_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[0, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "EPC_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[1, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "TCC_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[2, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "TCC_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[3, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C1234_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[4, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C1234_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[5, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "CB26_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[6, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "CB26_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[7, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C35R_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[8, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C35R_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[9, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C456_StepTest_InstructionL_H" + t], Convert.ToDouble(StepTest_Instruction[10, t]))); sheet3Formatters.Add(new CellFormatter(collection["阶跃测试", "C456_StepTest_InstructionH_L" + t], Convert.ToDouble(StepTest_Instruction[11, t]))); } for (int t = 0; t < solenoid1Data.Length / 10; t++) { for (int k = 0; k < 10; k++) { if (solenoid1Data[0, t] != "null") { sheet4Formatters.Add(new CellFormatter(collection["性能测试", "solenoid1Data" + k + "H_L" + t], Convert.ToDouble(solenoid1Data[k, t]))); } else { sheet4Formatters.Add(new CellFormatter(collection["性能测试", "solenoid1Data" + k + "H_L" + t], "")); } } } for (int t = 0; t < solenoid2Data.Length / 10; t++) { for (int k = 0; k < 10; k++) { if (solenoid2Data[0, t] != "null") { sheet4Formatters.Add(new CellFormatter(collection["性能测试", "solenoid2Data" + k + "L_H" + t], Convert.ToDouble(solenoid2Data[k, t]))); } else { sheet4Formatters.Add(new CellFormatter(collection["性能测试", "solenoid2Data" + k + "L_H" + t], "")); } } } try { //导出文件到本地 ExportHelper.ExportToLocal(Directory.GetCurrentDirectory() + "/Excel_File/档案模板.xls", _fimeName, new SheetFormatterContainer("测试报告", sheet1Formatters), //new SheetFormatterContainer("数据源30009", sheet2Formatters), // new SheetFormatterContainer("数据源30010", sheet3Formatters), // new SheetFormatterContainer("数据源30018", sheet4Formatters), new SheetFormatterContainer("数据表", sheet2Formatters), new SheetFormatterContainer("阶跃测试", sheet3Formatters), new SheetFormatterContainer("性能测试", sheet4Formatters) ); Isexporttoexcel = true; } catch (Exception t) { Isexporttoexcel = false; } }
public void Download() { ExportHelper.ExportToWeb(TemplateFilePath, TargetFilePath, Formatter, Formatter1, Formatter2); }
public void CreatePDFOrXPS(string pageFormat, string pageOrientation, string exportType, int pageSize, int pageNumber) { //make the currentPageNumber start from 1 pageNumber++; List<Order> newOrders = Orders.ToList(); bool exportAllPages = false; if (exportType == "currentPage") { newOrders = newOrders .Skip<Order>(pageSize * (pageNumber - 1)) .Take<Order>(pageSize) .Select(c => new Order { OrderID = c.OrderID, ContactName = c.ContactName, ShipAddress = c.ShipAddress, OrderDate = c.OrderDate }) .ToList(); } else { newOrders = newOrders .Select(c => new Order { OrderID = c.OrderID, ContactName = c.ContactName, ShipAddress = c.ShipAddress, OrderDate = c.OrderDate }) .ToList(); exportAllPages = true; } ExportHelper exporter = new ExportHelper(newOrders, pageOrientation, pageNumber, exportAllPages); Report igReport = exporter.Report(); SendForDownload(igReport, pageFormat); }
public void FormatJSON() { var tmpNewText = ExportHelper.CreateJsonFromClassList(ImportHelper.ImportClasses(JavaLangClassJson.JavaLang)); Assert.AreEqual(true, true); }