示例#1
0
        public PrintAllDialog(int[] docIDs, PrintAllFoldersType folderType)
        {
            switch (folderType)
            {
            case PrintAllFoldersType.WorkFolder:
            case PrintAllFoldersType.SearchFolder:
            case PrintAllFoldersType.InquiryFolder:
                values = new int[docIDs.Length];
                docIDs.CopyTo(values, 0);
                break;

            case PrintAllFoldersType.ArchivFolder:
                break;
            }

            using (
                var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), 0,
                                                Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1")))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printImage  = dialog.PrintImage;
                    mainOnly    = dialog.PrintOnlyMain;
                    eForm       = dialog.PrintEForm;
                    orientation = dialog.Orientation;
                    scaleMode   = dialog.ScaleMode;
                    annotations = dialog.Annotations;
                    copiescount = dialog.CopiesCount;
                    prn         = new PrinterOp(DocPrintDialog.Printer, this);
                    printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo();
                }
            }

            if (printImage || eForm)
            {
                InitializeComponent();
            }
            else
            {
                Load  += PrintAllDialog_Load;
                values = null;
                return;
            }

            InitLayoutProperties();
        }
示例#2
0
        public PrintAllDialog(int folderID, int empID, PrintAllFoldersType folderType)
        {
            switch (folderType)
            {
            case PrintAllFoldersType.WorkFolder:
                using (
                    var dt = Environment.DocData.GetWorkFolderDocs(folderID, empID,
                                                                   Environment.CurCultureInfo.
                                                                   TwoLetterISOLanguageName))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;

            case PrintAllFoldersType.ArchivFolder:
                break;

            case PrintAllFoldersType.SearchFolder:
                using (
                    var dt = Environment.DocData.GetFoundDocs(Environment.CurCultureInfo.Name, empID,
                                                              Environment.UserSettings.PersonID))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;

            case PrintAllFoldersType.InquiryFolder:
                string xml = Environment.QueryData.GetField(Environment.QueryData.XMLField, folderID).ToString();
                string sql = Data.DALC.Documents.Search.Options.GetSQL(xml);
                using (
                    DataTable dt = Environment.DocData.GetQueryDocs(sql,
                                                                    Environment.CurCultureInfo.
                                                                    TwoLetterISOLanguageName, empID,
                                                                    Environment.UserSettings.PersonID))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;
            }

            using (
                var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), values,
                                                Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1")))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printImage  = dialog.PrintImage;
                    mainOnly    = dialog.PrintOnlyMain;
                    eForm       = dialog.PrintEForm;
                    orientation = dialog.Orientation;
                    scaleMode   = dialog.ScaleMode;
                    annotations = dialog.Annotations;
                    copiescount = dialog.CopiesCount;
                    prn         = new PrinterOp(DocPrintDialog.Printer, this);
                    printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo();
                }
            }

            if (printImage || eForm)
            {
                InitializeComponent();
            }
            else
            {
                Load  += PrintAllDialog_Load;
                values = null;
                return;
            }

            InitLayoutProperties();
        }