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); }
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"; } }