예제 #1
0
        /// <summary>
        /// Print and Export
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printPreviewBarExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                switch (this.repotPrint.Report.ToString())
                {
                case "HTN.BITS.UIL.PLASESS.Reports.RPT_PRODUCT_CARD":
                    if (this.logPrintTime)
                    {
                        UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                    }
                    break;

                case "HTN.BITS.UIL.PLASESS.Reports.RPT_PRODUCT_CARD_8545":
                    if (this.logPrintTime)
                    {
                        UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                    }
                    break;

                default:
                    //nothing
                    break;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error printPreviewBarItem9_ItemClick", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
예제 #2
0
        public void HandleCommand(PrintingSystemCommand command, object[] args, IPrintControl printControl, ref bool handled)
        {
            ReportPrintTool printTool = new ReportPrintTool(this.repotPrint);

            switch (command)
            {
            case PrintingSystemCommand.Print:
                try
                {
                    DialogResult result = this.GetLogPrintTime();
                    if (result == DialogResult.OK)
                    {
                        if (printTool.PrintDialog() ?? false)
                        {
                            //if click print
                            if (this.logPrintTime)
                            {
                                UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                            }

                            if (this.autoCloseAfterPrint)
                            {
                                this.tmrClosePreview.Enabled = true;
                            }
                        }
                    }
                }
                catch (Exception ex) { }

                handled = true;
                break;

            case PrintingSystemCommand.PrintDirect:
                try
                {
                    //DialogResult result = XtraMessageBox.Show(this, "Do you want to print?", "Please Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    DialogResult result = this.GetLogPrintTime();
                    if (result == DialogResult.OK)
                    {
                        printTool.Print();

                        if (this.logPrintTime)
                        {
                            UiUtility.UpdatePrintTime(this.seqNo, this.repotPrint.Parameters["paramUserPrint"].Value.ToString());
                        }

                        if (this.autoCloseAfterPrint)
                        {
                            this.tmrClosePreview.Enabled = true;
                        }
                    }
                }
                catch (Exception ex) { }

                handled = true;
                break;

            default:
                break;
            }
            //if (command == PrintingSystemCommand.Print || command == PrintingSystemCommand.PrintDirect)
            //{
            //    try
            //    {
            //        DialogResult result = XtraMessageBox.Show(this, "Do you want to print?", "Please Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //        if (result == DialogResult.Yes)
            //        {

            //        }
            //        else
            //        {

            //        }

            //        //ReportPrintTool printTool = new ReportPrintTool(this.repotPrint);
            //        //if (printTool.PrintDialog() ?? false)
            //        //{
            //        //    result = DialogResult.OK;
            //        //}
            //        //else
            //        //    result = DialogResult.Cancel;

            //        //result =printTool.PreviewForm.ShowDialog();

            //    }
            //    catch (Exception) { }
            //    finally
            //    {
            //        // Actually printed?
            //        //this.PrintResult = result;
            //    };

            //    // Set handled to true to avoid the standard procedure to be called.
            //    handled = true;
            //};
            //throw new NotImplementedException();
        }