/// <summary> /// 得到实现接口控件信息 /// </summary> /// <param name="sql">sql语句</param> /// <returns></returns> private ReportPrint GetReportPrintObject(string sql) { ReportPrint reportPrint = null; string containerDllName = string.Empty; string containerControlName = string.Empty; int ret = this.ExecQuery(sql); if (ret == -1) { System.Windows.Forms.MessageBox.Show(this.Err); return(null); } if (this.Reader.Read()) { //读取第一个 reportPrint = new ReportPrint(); reportPrint.ContainerDllName = this.Reader[0].ToString(); reportPrint.ContainerContorl = this.Reader[1].ToString(); reportPrint.ContainerType = this.Reader[7].ToString(); reportPrint.Name = this.Reader[8].ToString(); reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString(), this.Reader[6].ToString(), this.Reader[9].ToString()); while (this.Reader.Read()) { reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString(), this.Reader[6].ToString(), this.Reader[9].ToString()); } } this.Reader.Dispose(); return(reportPrint); }
/// <summary> /// 装载数据 /// </summary> /// <returns></returns> public List <ReportPrint> LoadData() { List <ReportPrint> ret = new List <ReportPrint>(); List <string> retjudge = new List <string>(); Dictionary <string, ReportPrint> dic = new Dictionary <string, ReportPrint>(); string containerDllName = string.Empty; string containerControlName = string.Empty; string containerType = string.Empty; string name = string.Empty; string sql = "select * from " + this.CurrenInterfaceProfileTable + " order by CONTAINERCONTROL,PRINTERINDEX,PRINTERCONTROL "; this.ExecQuery(sql); while (this.Reader.Read()) { if (dic.Count == 0) { ReportPrint reportPrint = new ReportPrint(); reportPrint.ContainerDllName = this.Reader[0].ToString(); reportPrint.ContainerContorl = this.Reader[1].ToString(); reportPrint.ContainerType = this.Reader[7].ToString(); reportPrint.Name = this.Reader[8].ToString(); reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString(), this.Reader[6].ToString(), this.Reader[9].ToString()); dic.Add(reportPrint.ContainerContorl, reportPrint); } else { if (dic.ContainsKey(this.Reader[1].ToString())) { dic[this.Reader[1].ToString()].Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString(), this.Reader[6].ToString(), this.Reader[9].ToString()); } else { ReportPrint reportPrint = new ReportPrint(); reportPrint.ContainerDllName = this.Reader[0].ToString(); reportPrint.ContainerContorl = this.Reader[1].ToString(); reportPrint.ContainerType = this.Reader[7].ToString(); reportPrint.Name = this.Reader[8].ToString(); reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString(), this.Reader[6].ToString(), this.Reader[9].ToString()); dic.Add(reportPrint.ContainerContorl, reportPrint); } } } this.Reader.Dispose(); foreach (string a in dic.Keys) { ret.Add(dic[a]); } return(ret); }