/// <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; this.ExecQuery(sql); if (this.Reader.Read()) { //读取第一个 reportPrint = new ReportPrint(); reportPrint.ContainerDllName = this.Reader[0].ToString(); reportPrint.ContainerContorl = this.Reader[1].ToString(); reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].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.Dispose(); return(reportPrint); }
/// <summary> /// 装载数据 /// </summary> /// <returns></returns> public List <ReportPrint> LoadData() { List <ReportPrint> ret = new List <ReportPrint>(); string containerDllName = string.Empty; string containerControlName = string.Empty; string sql = "select * from COM_MAINTENANCE_REPORT_PRINT order by CONTAINERCONTROL,PRINTERCONTROL,PRINTERINDEX"; this.ExecQuery(sql); if (this.Reader.Read()) { containerDllName = this.Reader[0].ToString(); containerControlName = this.Reader[1].ToString(); //读取第一个 ReportPrint reportPrint = new ReportPrint(); reportPrint.ContainerDllName = containerDllName; reportPrint.ContainerContorl = containerControlName; reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString()); ret.Add(reportPrint); //读取后面的数据 while (this.Reader.Read()) { if (containerControlName == this.Reader[1].ToString()) { reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString()); } else { containerDllName = this.Reader[0].ToString(); containerControlName = this.Reader[1].ToString(); reportPrint = new ReportPrint(); reportPrint.ContainerDllName = containerDllName; reportPrint.ContainerContorl = containerControlName; reportPrint.Add(this.Reader[2].ToString(), this.Reader[3].ToString(), short.Parse(this.Reader[4].ToString()), this.Reader[5].ToString()); ret.Add(reportPrint); } } } this.Reader.Dispose(); return(ret); }