public FunctionTemplateViewModel(Agencys agencys, Patients patients) { Agencys = agencys; Patients = patients; SetTemplateLayout(agencys); //載入樣板 Templates = new TableTemplates().QueryAllTemplates(); }
/// <summary> /// 获取模板设置xml数据 /// </summary> /// <returns></returns> public TableTemplates GetTableTemplates() { TableTemplates result = null; if (ConfigurationManager.AppSettings["TableTemplateXmlUrl"] != null) { string url = ConfigurationManager.AppSettings["TableTemplateXmlUrl"].ToString().Trim(); string str = Common.DirFile.ReadFile(url); result = TableTemplates.XmlCovertObj(str); } return(result); }
public NoDbTable New(string tableName, string template = "") { if (string.IsNullOrEmpty(tableName)) { throw new Exception("Tablename can not be empty!"); } if (Tables.Any(x => x.Detail.Name.ToLower() == tableName.ToLower())) { throw new Exception("Table already exist!"); } var table = TableTemplates.Get(tableName, template); Tables.Add(table); WriteToFile(); return(table); }
/// <summary> /// 导出模板信息设置(根据输入格式设置) /// </summary> /// <returns></returns> public Dictionary <string, TableTemplateExt> TableTemplateDic() { Dictionary <string, TableTemplateExt> result = new Dictionary <string, TableTemplateExt>(); TableTemplates temp = GetTableTemplates(); if (temp != null && temp.TableTemplateList != null && temp.TableTemplateList.Count > 0) { TableTemplateExt tExt = null; foreach (TableTemplate t in temp.TableTemplateList) { tExt = new shiyanshi.TableTemplateExt(); tExt.Cells = t.Cells; tExt.ConclusionRowIndex = t.ConclusionRowIndex; tExt.DataRowIndex = t.DataRowIndex; //tExt.InpputState = t.InpputState; tExt.InpputStateStr = t.InpputStateStr; tExt.Remark = t.Remark; tExt.RemarkRowIndex = t.RemarkRowIndex; tExt.TitleRowCount = t.TitleRowCount; tExt.TitleRowIndex = t.TitleRowIndex; if (!result.ContainsKey(tExt.InpputStateStr)) { Dictionary <string, int> CellList = null; if (tExt.Cells != null && tExt.Cells.Count > 0) { CellList = new Dictionary <string, int>(); foreach (Cell c in tExt.Cells) { if (!CellList.ContainsKey(c.Code)) { CellList.Add(c.Code, c.ColIndex); } } tExt.CellList = CellList; } result.Add(t.InpputStateStr, tExt); } } } return(result); }