Exemplo n.º 1
0
        public Insurance(PRINT_TYPE pType, string iaCode, EagleProtocal.MyTcpIpClient socket, EagleString.CommandPool cmdpool)
        {
            //lock (Instance)
            {
                CheckForIllegalCrossThreadCalls = false;
                if (Instance != null)
                {
                    Instance.Dispose();
                    Instance = null;
                    return;
                }
                InitializeComponent();

                m_socket           = socket;
                m_cmdpool          = cmdpool;
                Insurance.Instance = this;

                GetProductList(iaCode);

                this.cmbCardType.DataSource = Enum.GetNames(typeof(EagleWebService.IdentityType));
                cmbCardType.SelectedIndex   = 0;
                this.tsbUsername.Text       = Options.GlobalVar.IAUsername;
            }
        }
Exemplo n.º 2
0
        public void Initia(PRINT_TYPE pType, string printingXML, int productID)
        {
            //if (!File.Exists(file))
            //{
            //    File.Copy(Path.Combine(Application.StartupPath, "PrinterDesign.default"), file);
            //}

            m_hander = new XmlHandler();

            try
            {
                //if (File.Exists(file))
                //    m_hander.LoadXml(File.ReadAllText(file, Encoding.UTF8));
                //else
                {
                    string fileProduct = "Pt" + productID.ToString() + ".xml";
                    if (File.Exists(fileProduct))
                    {
                        m_hander.LoadXml(File.ReadAllText(fileProduct, Encoding.UTF8));
                    }
                    else
                    {
                        m_hander.LoadXml(printingXML);//2010.08.11 打印配置文件保存到数据库了
                    }
                }
            }
            catch
            {
                throw new Exception("打印格式信息有错误,请连续管理员!");
            }

            m_pType = pType;
            //m_iType = iType;
            switch (pType)
            {
            case PRINT_TYPE.INSURANCE:
                //if (File.Exists(file))
                //{
                //    m_root = m_hander.root.SelectSingleNode("insurrances");
                //    for (int i = 0; i < m_root.ChildNodes.Count; ++i)
                //    {
                //        if (m_hander.FindXnByNameAndValue(m_root.ChildNodes[i].ChildNodes, "code", Options.GlobalVar.IACode) != null)
                //        {
                //            m_root = m_root.ChildNodes[i];
                //            break;
                //        }
                //        if (i == m_root.ChildNodes.Count) m_root = null;
                //    }
                //}
                //else
                m_root = m_hander.root.SelectSingleNode("/insurrance");
                if (m_root == null)
                {
                    throw new Exception("打印格式信息有错误,请连续管理员!");
                }
                break;

            case PRINT_TYPE.RECEIPT:
                m_root = m_hander.root.SelectSingleNode("tickets/receipt");
                break;
            }
            m_pInfo = new PRINT_INFO();
            m_pInfo.FromXmlNode(m_root);
            int iItem = m_root.SelectSingleNode("items").ChildNodes.Count;

            m_pItem = new PRINT_ITEM[iItem];
            for (int i = 0; i < iItem; ++i)
            {
                m_pItem[i].FromXmlNode(m_root.SelectSingleNode("items").ChildNodes[i], m_pInfo.m_font);
            }
            int iFix = m_root.SelectSingleNode("fixdata").ChildNodes.Count;

            m_pFix = new PRINT_FIX[iFix];
            for (int i = 0; i < iFix; ++i)
            {
                m_pFix[i].FromXmlNode(m_root.SelectSingleNode("fixdata").ChildNodes[i], m_pInfo.m_font);
            }
            //m_pInfo.m_password = (m_pInfo.m_password);
            ptDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(ptDoc_PrintPage);
        }
Exemplo n.º 3
0
        //string file = Application.StartupPath + "\\PrinterDesign.xml";//2010.08.11 考虑到兼容性,最终将抛弃该文件

        /// <summary>
        /// 构造,从配置文件中取值->m_pItem,m_pInfo
        /// </summary>
        /// <param name="pType">打印类型:保险,行程单</param>
        /// <param name="iType">对于行程单无效</param>
        public PrintXmlHandle(PRINT_TYPE pType, string printingXML, int productID)
        {
            Initia(pType, printingXML, productID);
        }