Esempio n. 1
0
        public void PrintFrontSideOnly(PrintParameter pParas, string drvName, out int jobID, out string msg)
        {
            PrintFormatView pfv = new PrintFormatView();

            jobID = 0;
            msg   = string.Empty;

            int         errValue; // value of 0 indicates no errors
            ZBRGraphics graphics = graphics = new ZBRGraphics();

            try
            {
                if (graphics.InitGraphics(ASCIIEncoding.ASCII.GetBytes(drvName), "job", out jobID, out errValue) == 0)
                {
                    msg = "Printing InitGraphics Error: " + errValue.ToString();
                    return;
                }

                LogHelper.WriteLog(typeof(ZBRPrinter), "InitGraphics 成功");

                //数据位置
                pfv.DrawPersonInfo(pParas, ref graphics);

                LogHelper.WriteLog(typeof(ZBRPrinter), "DrawPersonInfo 成功");

                //头像位置
                pfv.DrawPhoto(pParas, ref graphics);

                LogHelper.WriteLog(typeof(ZBRPrinter), "DrawPhoto 成功");

                if (graphics.PrintGraphics(out errValue) == 0)
                {
                    msg = "Printing PrintGraphics Error: " + errValue.ToString();
                    return;
                }
                LogHelper.WriteLog(typeof(ZBRPrinter), "PrintGraphics 成功");
            }
            catch (Exception ex)
            {
                msg += ex.ToString();
                System.Windows.Forms.MessageBox.Show(ex.ToString(), "PrintFrontSideOnly");
            }
            finally
            {
                if (graphics != null)
                {
                    // Starts the printing process and releases the Graphics Buffer
                    if (graphics.CloseGraphics(out errValue) == 0)
                    {
                        msg = "Printing CloseGraphics Error: " + errValue.ToString();
                    }
                    graphics = null;
                }
            }
        }
        private void tvCardInit_AfterSelect(object sender, TreeViewEventArgs e)
        {
            AccessOperator Accor = new AccessOperator();
            TreeNode       Node  = (TreeNode)tvCardInit.SelectedNode;

            ucFuncButton1.SetButtonEnabled(3, false);
            ucFuncButton1.SetButtonEnabled(4, false);
            if (Node.Parent == null)
            {
                pcPrintView.Image = Properties.Resources.社保正面;
            }
            else
            {
                string    strsql = "SELECT [Status01],[XM27],[SHBZHM28],[XB30],[SGRSBH37],[FullDATA59],[BY60],[BY61] FROM ProductData WHERE [SHBZHM28]='" + Node.Name + "'";
                DataTable dtread = Accor.ExecuteDataTable(strsql);
                if (dtread.Rows.Count > 0)
                {
                    GlobalClass.status     = dtread.Rows[0]["Status01"].ToString();
                    GlobalClass.name       = dtread.Rows[0]["XM27"].ToString();
                    GlobalClass.idcard     = dtread.Rows[0]["SHBZHM28"].ToString();
                    GlobalClass.sex        = dtread.Rows[0]["XB30"].ToString();
                    GlobalClass.provNo     = dtread.Rows[0]["SGRSBH37"].ToString();
                    GlobalClass.fulldata   = dtread.Rows[0]["FullDATA59"].ToString();
                    GlobalClass.idcardType = dtread.Rows[0]["BY60"].ToString();
                    GlobalClass.receipt    = dtread.Rows[0]["BY61"].ToString();

                    if (GlobalClass.status.Equals("1") || GlobalClass.status.Equals("2"))
                    {
                        ucFuncButton1.SetButtonEnabled(3, true);
                    }
                    else if (GlobalClass.status.Equals("3"))
                    {
                        ucFuncButton1.SetButtonEnabled(4, true);
                    }

                    PrintParameter  pp  = new PrintParameter();
                    PrintFormatView pfv = new PrintFormatView();
                    pfv.DrawFormat(pp);
                    pcPrintView.Image = pfv.image;
                }
            }
        }