/// <summary> /// 提取报表 /// </summary> /// <returns></returns> private _List ExtractReport() { _Files files = new _Files(); files.ExtName = _Files.报表格式扩展名; files.DirName = string.Format("{0}库文件\\系统库", AppFolder.FullName); files.FileName = "报表格式"; try { FileInfo info = new FileInfo(files.FullName); if (info.Exists) { //文件存在的时候读取 this.m_BaseReport = new _List(); object ywj = CFiles.Deserialize(files.FullName); ArrayList dsd = ywj as ArrayList; if (dsd != null) { this.m_BaseReport.AddRange(dsd.ToArray()); if (this.m_BaseReport.Count <= 0) { this.m_BaseReport = null; } } } return(this.m_BaseReport); } catch (Exception ex) { this.m_BaseReport = null; return(this.m_BaseReport); } }
public void init() { if (this.IsInit) { if (this.m_Parent.ProType.Contains("安装专业")) { string fs = _Common.Application.Global.AppFolder + "库文件\\子目增加费\\" + getFileName(this.m_Parent.PrfType); DataSet ds = CFiles.BinaryDeserializeForLib(fs); if (ds.Tables.Count > 0) { this.m_DataSource = ds.Tables[0].Copy(); if (!this.m_DataSource.Columns.Contains("Check")) { this.m_DataSource.Columns.Add("Check", typeof(bool)); for (int i = 0; i < this.m_DataSource.Rows.Count; i++) { if (this.m_DataSource.Rows[i]["IsCheck"].ToString() == "1") { this.m_DataSource.Rows[i]["Check"] = true; } else { this.m_DataSource.Rows[i]["Check"] = false; } } } this.m_IsInit = false; } } else { this.m_DataSource = new DataTable(); } } }
/// <summary> /// 获取或设置 /// </summary> public static _Configuration CreateInstance(string p_FileName, DirectoryInfo p_AppFolder) { _Configuration cfg = null; FileInfo info = new FileInfo(p_FileName); if (info.Exists) { //存对象文件 try { cfg = CFiles.Deserialize(p_FileName) as _Configuration; } catch (Exception ex) { cfg = new _Configuration(); } } else { cfg = new _Configuration(); cfg.AppFolder = p_AppFolder; } cfg.ConfigPath = p_FileName; return(cfg); }
/// <summary> /// 读取汇总分析文件 /// </summary> public void LoadMetaanalysis() { //默认加载四种汇总分析模板2012扣劳保与2012不扣劳保 this.m_Metaanalysis = new DataSet("汇总分析"); string fs0 = this.AppFolder + "模板文件\\汇总分析模板\\" + "2012汇总分析表【扣劳保】.hzfx"; string fs1 = this.AppFolder + "模板文件\\汇总分析模板\\" + "2012汇总分析表【不扣劳保】.hzfx"; string fs2 = this.AppFolder + "模板文件\\汇总分析模板\\" + "2009汇总分析表【扣劳保】.hzfx"; string fs3 = this.AppFolder + "模板文件\\汇总分析模板\\" + "2009汇总分析表【不扣劳保】.hzfx"; DataTable t0 = CFiles.Deserialize(fs0) as DataTable; DataTable t1 = CFiles.Deserialize(fs1) as DataTable; DataTable t2 = CFiles.Deserialize(fs2) as DataTable; DataTable t3 = CFiles.Deserialize(fs3) as DataTable; t0.TableName = "2012扣劳保"; t1.TableName = "2012不扣劳保"; t2.TableName = "2009扣劳保"; t3.TableName = "2009不扣劳保"; this.m_Metaanalysis.Tables.Add(t0); this.m_Metaanalysis.Tables.Add(t1); this.m_Metaanalysis.Tables.Add(t2); this.m_Metaanalysis.Tables.Add(t3); this.m_Metaanalysis.AcceptChanges(); //为模板添加自增长列 /*foreach (DataTable table in this.m_TempList.Tables) * { * table.Columns["ID"].AutoIncrement = true; * table.Columns["ID"].AutoIncrementSeed = 0; * table.Columns["ID"].AutoIncrementStep = 1; * } */ }
/// <summary> /// 读取模板数据 /// </summary> /// <param name="FilePath"></param> /// <returns></returns> public void Load(string FilePath) { DataTable dt = CFiles.Deserialize(FilePath) as DataTable; if (dt == null) { dt = (CFiles.Deserialize(FilePath) as DataSet).Tables[0]; } m_DataSource = dt; if (!this.m_DataSource.Columns.Contains("Check")) { this.m_DataSource.Columns.Add("Check", typeof(bool)); for (int i = 0; i < this.m_DataSource.Rows.Count; i++) { if (this.m_DataSource.Rows[i]["IsCheck"].ToString() == "1") { this.m_DataSource.Rows[i]["Check"] = true; } else { this.m_DataSource.Rows[i]["Check"] = false; } } } }
/// <summary> /// 读取管理费利润表 /// </summary> public void LoadCostSelectList() { this.m_CostSelectList = new DataSet("管理费利润表"); string fs0 = this.AppFolder + "库文件\\系统库\\管理费利润表.qtsx"; this.m_CostSelectList = CFiles.Deserialize(fs0) as DataSet; this.m_CostSelectList.AcceptChanges(); }
/// <summary> /// 保存措施项目 /// </summary> /// <param name="path"></param> public void MeasuresProjectSave(string path) { //SetTYQD(); _UnitProject u = this.MeasuresProject.Parent; this.MeasuresProject.Parent = null; CFiles.BinarySerialize(this.MeasuresProject, path); this.MeasuresProject.Parent = u; }
/// <summary> /// 保存模板文件 /// </summary> /// <param name="p_FileName"></param> public void Save(string p_FileName) { //保存模板的时候重新设置列 //this.m_Source.Columns.Remove(this.m_Source.Columns["Price"]); //this.m_Source.Columns.Add("Price", typeof(decimal)); CFiles.BinarySerialize(this.m_Source, p_FileName); }
/// <summary> /// 读取模板文件 /// </summary> /// <param name="p_FileName"></param> public void Load(string p_FileName) { //if (this.IsInit) { this.m_Source = CFiles.Deserialize(p_FileName) as DataTable; //this.Calculate(); this.m_Parent.BeginEdit(this); //this.m_IsInit = false; } }
/// <summary> ///从指定文件初始化数据集 /// </summary> public void MeasuresProjectLoad(string Path) { if (this.MeasuresProject != null) { object obj = CFiles.Deserialize(Path); this.MeasuresProject = null; this.MeasuresProject = obj as _MeasuresProject; this.MeasuresProject.Parent = this.Parent as _UnitProject; this.MeasuresProject.InSerializable(this.Parent); } }
/// <summary> ///从指定文件初始化数据集 /// </summary> public void Load(string Path) { if (this.m_Source != null) { object obj = CFiles.Deserialize(Path); this.m_Source = obj as DataTable; this.m_FilePath = Path; FileInfo info = new FileInfo(Path); this.m_FileName = info.Name.Replace(info.Extension, ""); } }
/// <summary> /// 加载配置文件 /// </summary> /// <param name="p_dir"></param> /// <returns></returns> public static _DataObjects Load(DirectoryInfo p_dir) { string str = string.Format("{0}config\\options.cfg", p_dir.FullName); object obj = CFiles.Deserialize(str); _DataObjects _data = obj as _DataObjects; _data.m_Path = str; /* _data.m_Columns = new _Columns();*/ //_data.m_GColor = new GlobalStyle(); return(_data); }
public DataTable LoadOtherProject(string GCDD) { switch (GCDD) { case "汉中": string fs0 = this.AppFolder + "模板文件\\其他项目\\" + "其他项目【汉中】.qtsx"; DataTable t0 = CFiles.Deserialize(fs0) as DataTable; //FilePath = fs0; return(t0); default: string fs1 = this.AppFolder + "模板文件\\其他项目\\" + "其他项目【通用】.qtsx"; DataTable t1 = CFiles.Deserialize(fs1) as DataTable; //FilePath = fs1; return(t1); } }
/// <summary> /// 读取系统使用的模板文件 /// </summary> public void LoadFiles() { string fs = this.AppFolder + "config\\" + "模板.qtsx"; this.m_TempList = CFiles.BinaryDeserializeForLib(fs); //为模板添加自增长列 foreach (DataTable table in this.m_TempList.Tables) { table.Columns["ID"].AutoIncrement = true; table.Columns["ID"].AutoIncrementSeed = 0; table.Columns["ID"].AutoIncrementStep = 1; } //措施项目模板的读取 this.m_MeasuresList = CFiles.BinaryDeserializeForLib(this.AppFolder + "config\\" + "措施项目模板.qtsx"); this.m_变量对应表 = CFiles.BinaryDeserializeForLib(this.AppFolder + "config\\" + "变量对应表.qtsx"); this.m_自动报价 = CFiles.BinaryDeserializeForLib(this.AppFolder + "config\\" + "自动报价.qtsx"); this.m_工程设置 = CFiles.BinaryDeserializeForLib(this.AppFolder + "config\\" + "工程说明.qtsx"); }
/// <summary> /// 若读取配置文件失败返回新的配置文件 /// </summary> /// <returns></returns> public static _HistoryCache CreateInstance(DirectoryInfo p_CacheFolder) { //若读取文件成功则直接返回否则返回空对象 try { string filename = p_CacheFolder.FullName + "\\" + _HistoryCache.FileName; _HistoryCache info = CFiles.Deserialize(filename) as _HistoryCache; if (info == null) { info = new _HistoryCache(); } info.SaveName = filename; return(info); } catch { _HistoryCache info = new _HistoryCache(); info.SaveName = p_CacheFolder.FullName + "\\" + _HistoryCache.FileName; return(info); } }
public void Save(string path) { CFiles.BinarySerialize(this.m_Source, path); }
/// <summary> /// 保存当前配置信息 /// </summary> public void Save(string p_FileName) { CFiles.BinarySerialize(this, p_FileName); this.OnConfigSave(); }
/// <summary> /// 保存当前配置对象 /// </summary> public void Save() { CFiles.BinarySerialize(this, this.m_Path); }
/// <summary> /// 保存当前配置对象 /// </summary> public void Save(string p_Path) { CFiles.BinarySerialize(this, p_Path); }
/// <summary> /// 保存配置文件 /// </summary> public void Save() { //保存当前缓存对象 CFiles.BinarySerialize(this, this.SaveName); }
/// <summary> /// 保存模板 /// </summary> /// <param name="obj"></param> /// <param name="FilePath"></param> public void Save(string FilePath) { CFiles.BinarySerialize(m_DataSource, FilePath); }