Exemple #1
0
        /// <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>
        /// <param name="containerType">接口容器控件名称</param>
        /// <param name="interfaceType">接口名称</param>
        /// <param name="index">接口索引</param>
        /// <returns></returns>
        public static object CreateObject(Type containerType, Type interfaceType, int index)
        {
            object      ret         = null;
            ReportPrint reportPrint = rpm.GetReportPrint(containerType.ToString(), interfaceType.ToString(), index);
            string      dllName     = reportPrint.ReportPrintControls[0].DllName;
            string      controlName = reportPrint.ReportPrintControls[0].ControlName;

            try
            {
                ret = System.Reflection.Assembly.LoadFrom(dllName).CreateInstance(controlName);
            }catch
            {
                return(null);
            }

            return(ret);
        }
Exemple #3
0
        /// <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);
        }