Example #1
0
        /// <summary>
        /// 创建控件对象
        /// </summary>
        /// <param name="containerType">接口容器控件名称</param>
        /// <param name="interfaceType">接口名称</param>
        /// <returns></returns>
        public static object CreateObject(Type containerType, Type interfaceType)
        {
            object      ret         = null;
            ReportPrint reportPrint = rpm.GetReportPrint(containerType.ToString(), interfaceType.ToString());

            if (reportPrint == null || reportPrint.ReportPrintControls.Count <= 0 || reportPrint.ReportPrintControls[0].DllName == "")
            {
                //System.Windows.Forms.MessageBox.Show("没有对接口进行维护!");
                //需要调用维护界面
                return(null);
            }
            string dllName = reportPrint.ReportPrintControls[0].DllName;

            if (!dllName.ToLower().EndsWith(".dll"))
            {
                dllName = string.Concat(dllName, ".dll");
            }

            string controlName = reportPrint.ReportPrintControls[0].ControlName;

            try
            {
                ret = System.Reflection.Assembly.LoadFrom(Application.StartupPath + "\\" + dllName).CreateInstance(controlName);
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(ret);
        }
Example #2
0
        /// <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, Neusoft.FrameWork.Management.Transaction trans)
        {
            rpm.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            object      ret         = null;
            ReportPrint reportPrint = rpm.GetReportPrint(containerType.ToString(), interfaceType.ToString(), index);

            if (reportPrint == null || reportPrint.ReportPrintControls.Count <= 0 || reportPrint.ReportPrintControls[0].DllName == "")
            {
                //("没有对接口进行维护!");
                //需要调用维护界面
                return(null);
            }
            string dllName     = reportPrint.ReportPrintControls[0].DllName;
            string controlName = reportPrint.ReportPrintControls[0].ControlName;

            try
            {
                ret = System.Reflection.Assembly.LoadFrom(Application.StartupPath + "\\" + dllName).CreateInstance(controlName);
            }
            catch (Exception ex)
            {
                return(null);
            }

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

            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);
        }
Example #4
0
        public int DeleteData(ReportPrint reportPrint)
        {
            string sql = string.Format("delete  " + this.CurrenInterfaceProfileTable + "  where CONTAINERDLLNAME='{0}' and CONTAINERCONTROL='{1}' ",
                                       reportPrint.ContainerDllName, reportPrint.ContainerContorl);

            return(this.ExecNoQuery(sql));
        }
Example #5
0
        /// <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);
        }
Example #6
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="reportPrint"></param>
        /// <returns></returns>
        public int InsertData(ReportPrint reportPrint)
        {
            int ret;
            int i = 0;

            foreach (ReportPrintControl reportPrintControl in reportPrint.ReportPrintControls)
            {
                string sql = string.Format("insert into  " + this.CurrenInterfaceProfileTable + "  (CONTAINERDLLNAME,CONTAINERCONTROL,PRINTERDLLNAME,PRINTERCONTROL,PRINTERINDEX,MEMO,INTERFACE,CONTAINERTYPE,NAME,STATE) values('{0}','{1}','{2}','{3}',{4},'{5}','{6}','{7}','{8}','{9}')",
                                           reportPrint.ContainerDllName, reportPrint.ContainerContorl, reportPrintControl.DllName, reportPrintControl.ControlName, i.ToString(), reportPrintControl.Memo, reportPrintControl.InterfaceName, reportPrint.ContainerType, reportPrint.Name, reportPrintControl.State);
                ret = this.ExecNoQuery(sql);

                i++;
                if (ret == -1)
                {
                    return(-1);
                }
            }

            return(0);
        }