public void CreateLocalDateTimesTest() { var helper = new ReportDataHelper("c1"); helper.Add(new Class1 { MyTimeUtc = DateTime.UtcNow, Text1 = "aa" }); var tz = TimeZoneInfo.Local; tz.Should().NotBeNull(); var ds = helper.DataSet; ds.Should().NotBeNull(); ds.Tables.Count.Should().Be(1); ds.Tables[0].Rows.Count.Should().Be(1); ds.CreateLocalDateTimes(tz); ds.Tables[0].Columns.Cast <DataColumn>().Select(x => x.ColumnName).Should().Contain("MyTime"); }
// GET: Reports public ActionResult Surveys(int id) { Survey survey = db.Surveys.Find(id); List <ReportViewModel> reports = new ReportDataHelper().Show(survey.SurveyId); ViewBag.Reports = reports; return(View(survey)); }
private void SaveReport() { if (ReportDataCollector.GetTotal().Any()) { if (FolderPath != "") { string FileName = $"IRCS_{SelectedCardType}_{ReportDataCollector.GetTotal().First().ElementAt(0)}_" + $"{ulong.Parse(ReportDataCollector.GetTotal().Last().ElementAt(0)) - ulong.Parse(ReportDataCollector.GetTotal().First().ElementAt(0)) + 1}"; //"IRCS_"CardName"_"kezdőszám"_"hány darab kártya lett mérve".xls; ReportDataHelper.InitializeMeasure(FileName, FolderPath); if (XmlFilter.Instance.GetMeasurementsWithoutAutoMeasure(SelectedCardType).Count == 0) { //only automeasure ReportDataHelper.PassListTOReport( XmlFilter.Instance.GetMeasurements(XmlFilter.Instance.GetDefaultName()), ReportDataCollector.GetTotal(), Name, new List <string>() { }); } else { if (XmlFilter.Instance.IsCommonIncluded(SelectedCardType)) { ReportDataHelper.PassListTOReport( XmlFilter.Instance.GetMeasurementsWithoutAutoMeasure(XmlFilter.Instance.GetDefaultName()) .Concat(XmlFilter.Instance.GetMeasurementsWithoutAutoMeasure(SelectedCardType)) .ToList() , ReportDataCollector.GetTotal(), Name, ReportDataCollector.FillColumnForReport(true, SelectedCardType)); } else { ReportDataHelper.PassListTOReport(XmlFilter.Instance.GetMeasurementsWithoutAutoMeasure(SelectedCardType), ReportDataCollector.GetTotal(), Name, ReportDataCollector.FillColumnForReport(false, SelectedCardType)); } } ReportDataHelper.CreateReportFile(); // Cleaning excel temp values ReportDataCollector.ClearAll(); TopMessage("Saving File....", "File Saved!"); } } else { TopMessage("Error!", "No measurement data!"); } }
public string GetFormulaYearTemplateData(Guid id, string tableName) { ReportDataHelper dataHelper = new ReportDataHelper(); DataTable dt = dataHelper.GetFormulaYearTable(id, tableName); DataGridColumnType columnType = new DataGridColumnType { ColumnText = new string[] { "KeyID", "ID", "层次码", "工序名称", "峰期电耗", "谷期电耗", "平期电耗", "总计" }, ColumnWidth = new int[] { 80, 80, 130, 130, 130, 130, 130, 130 }, ColumnType = new string[] { "", "", "\"type\":\"text\"", "\"type\":\"text\"", "\"type\":\"numberbox\", \"options\":{\"precision\":\"0\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"0\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"0\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"0\"}" } }; return(ReportTemplateHelper.GetDataGridTemplate(dt, columnType)); }
private DataSet CreateDataSet() { var helper = new ReportDataHelper("c1"); helper.AddItems(new[] { new Class1 { MyTimeUtc = DateTime.UtcNow, Text1 = "aa" }, new Class1 { MyTimeUtc = DateTime.UtcNow.AddDays(1), Text1 = "bb" } }); var ds = helper.DataSet; return(ds); }
public string ChangeDataByGrid(string myJsonData, string tableName) { try { string m_GridJson = myJsonData; DataContractJsonSerializer m_JsonDs = new DataContractJsonSerializer(typeof(ReportDataGroup <NXJC.Model.ReportForm.FormulaYear, TZView>)); MemoryStream m_JsonStringMs = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(myJsonData)); ReportDataGroup <NXJC.Model.ReportForm.FormulaYear, TZView> m_ReportDataGroup = (ReportDataGroup <NXJC.Model.ReportForm.FormulaYear, TZView>)m_JsonDs.ReadObject(m_JsonStringMs); ReportDataHelper dataHelper = new ReportDataHelper(); string result = dataHelper.ChangeFormulaYear(tableName, m_ReportDataGroup.deleted, m_ReportDataGroup.updated, m_ReportDataGroup.inserted); return("1"); } catch { return("-1"); } }
public string SaveAnotherByGrid(string myJsonData, string tableName) { string m_GridJson = myJsonData; //DataContractJsonSerializer m_JsonDs = new DataContractJsonSerializer(typeof(ReportDataSaveAnother<FormulaYear, TZView>)); //MemoryStream m_JsonStringMs = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(myJsonData)); //ReportDataSaveAnother<FormulaYear, TZView> m_ReportDataGroup = (ReportDataSaveAnother<FormulaYear, TZView>)m_JsonDs.ReadObject(m_JsonStringMs); try { ReportDataSaveAnother <FormulaYear, TZView> saveAnotherObject = (ReportDataSaveAnother <FormulaYear, TZView>)JsonHelper.JsonToObject(m_GridJson, new ReportDataSaveAnother <FormulaYear, TZView>()); TZ tzValue = saveAnotherObject.TzValue.FirstOrDefault().ConvertToTz(); tzValue.Version = DateTime.Now; ReportDataHelper dataHelper = new ReportDataHelper(); string result = dataHelper.SaveAnotherFormulaYear(tableName, saveAnotherObject.ChildrenValue, tzValue); return(result); } catch { return("-1"); } }