コード例 #1
0
        public Boolean PrintEnvelope(Boolean isTest)
        {
            Boolean _Printed = false;

            //CardPrinterPrinterSettings.PrinterName = "IS700C";
            //CardPrinter.PrinterSettings.PrinterName = "RISO RZ 9 Series";
            // CardPrinter.PrinterSettings.PrinterName = "RICOH HQ9000 RPCS";
            //CardPrinter.PrinterSettings.PrinterName = "RISO RN2550(ADVANCE)";
            //CardPrinter.PrinterSettings.PrinterName = "Send To OneNote 2007";
            if (this.Lines.Count > 0)
            {
                String PrinterName = Global.OpenPrintDialog();
                if (PrinterName != "")
                {
                    CardTemplate oCardTemplate = new CardTemplate();
                    Card         oCard         = new Card(this.CompanyID);
                    oCard.Find(this.ProductID);
                    if (!oCardTemplate.Find(oCard.EnvTemplateID))
                    {
                        MessageBox.Show("No template found for the envelope: " + oCard.EnvTemplateID.ToString());
                        return(false);
                    }

                    CardPrinter CardPrinter = new CardPrinter();

                    CardPrinter.PrinterSettings.PrinterName = PrinterName;

                    CardPrinter.Clear();
                    foreach (Line oLine in this.LinesEnvelope)
                    {
                        CardPrinter.Add(oLine.Text);
                    }


                    CardPrinter.Point = oCardTemplate.Point;

                    CardPrinter.PaperSize = oCardTemplate.PaperSize;
                    CardPrinter.Copies    = 24;
                    CardPrinter.UpperCase = false;

                    CardPrinter.Rotation = (short)oCardTemplate.Rotation;
                    CardPrinter.TestMode = false;

                    CardPrinter.Font = new Font(oCardTemplate.FontName, oCardTemplate.FontSize, oCardTemplate.Bold ? FontStyle.Bold : FontStyle.Regular);
                    //  CardPrinter.Settings();
                    CardPrinter.Print();
                    _Printed = true;
                }
            }
            return(_Printed);
        }
            public void Load(CardSet oCardSet)
            {
                this.Clear();
                DataTable dt = oMySql.GetDataTable(String.Format("SELECT * FROM WLOT.cart_cards Where CardNumber>={0} And CardNumber<={1} And UsedCredit > 0 Order By CardNumber", oCardSet.RangeStart, oCardSet.RangeEnd));

                if (dt == null)
                {
                    return;
                }
                else
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        Card LO = new Card();
                        LO.Find((Int32)row["CardNumber"]);
                        this.Add(row["CardNumber"].ToString(), LO);
                    }
                }
            }
        public void Display()
        {
            Clear();
            txtProductID.Text   = oProduct.ID;
            txtDescription.Text = oProduct.Description;

            if (oCard.Find(txtProductID.Text))
            {
                txtTemplateID.Text    = oCard.CardTemplateID.ToString();
                txtEnvTemplateID.Text = oCard.EnvTemplateID.ToString();
                cbAsTemplate.Checked  = oCard.AsTemplate;
                DisplayCard();
            }
            else
            {
                this.Clear();
            }

            cbAsTemplate_CheckedChanged(null, EventArgs.Empty);
        }