示例#1
0
        private void method_1()
        {
            string str3;

            if ((pageSetupDialog == null) || (this.comboBox_DefaultPrinter.SelectedItem == null))
            {
                this.loger.Error("SetCurPrinter函数:当前pageSetupDialog为空");
                return;
            }
            pageSetupDialog.Document.PrinterSettings             = new PrinterSettings();
            pageSetupDialog.Document.PrinterSettings.PrinterName = this.comboBox_DefaultPrinter.SelectedItem.ToString();
            PrinterSettings.PaperSizeCollection paperSizes = pageSetupDialog.Document.PrinterSettings.PaperSizes;
            this.CurrentPrinterName = pageSetupDialog.Document.PrinterSettings.PrinterName;
            if (((this.object_0 != null) && (this.object_0.Length > 0)) && ((str3 = this.object_0[0].ToString()) != null))
            {
                if ((str3 == "c") || (str3 == "s"))
                {
                    pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_0;
                }
                else if ((str3 == "j") || (str3 == "f"))
                {
                    pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_1;
                }
                else if ((str3 == "q") && (this.object_0.Length >= 5))
                {
                    int    num  = Common.ObjectToInt(this.object_0[4].ToString());
                    string str2 = "NEW76mmX177mm";
                    Dictionary <string, int> jsPrintTemplate = ToolUtil.GetJsPrintTemplate();
                    if (jsPrintTemplate.Count > 0)
                    {
                        foreach (string str in jsPrintTemplate.Keys)
                        {
                            if (jsPrintTemplate[str] == num)
                            {
                                str2 = str;
                            }
                        }
                        if (str2.IndexOf("76mmX177mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_2;
                        }
                        else if (str2.IndexOf("76mmX152mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_3;
                        }
                        else if (str2.IndexOf("76mmX127mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_4;
                        }
                        else if (str2.IndexOf("57mmX177mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_5;
                        }
                        else if (str2.IndexOf("57mmX152mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_6;
                        }
                        else if (str2.IndexOf("57mmX127mm") != -1)
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_7;
                        }
                        else
                        {
                            pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_2;
                        }
                    }
                    else
                    {
                        pageSetupDialog.Document.PrinterSettings.DefaultPageSettings.PaperSize = this.paperSize_2;
                    }
                }
            }
            this.bool_0 = false;
            IEnumerator enumerator2 = pageSetupDialog.Document.PrinterSettings.PrinterResolutions.GetEnumerator();

            {
                PrinterResolution current;
                while (enumerator2.MoveNext())
                {
                    current = (PrinterResolution)enumerator2.Current;
                    if ((current.X == 180) && (current.Y == 180))
                    {
                        goto Label_038B;
                    }
                }
                goto Label_03BF;
Label_038B:
                pageSetupDialog.Document.DefaultPageSettings.PrinterResolution = current;
                this.bool_0 = true;
            }
Label_03BF:
            if ((this.printer_0 != null) && !IPrint.IsZjFlag)
            {
                PrinterEventArgs args = new PrinterEventArgs {
                    Name        = ((this.object_0 == null) || (this.object_0.Length <= 0)) ? "user" : this.object_0[0].ToString(),
                    Left        = Common.ObjectToFloat(this.txt_left.Text),
                    Top         = Common.ObjectToFloat(this.txt_top.Text),
                    System      = "1",
                    PageLenght  = 0,
                    PrinterName = this.comboBox_DefaultPrinter.SelectedItem.ToString(),
                    IsQuanDa    = this.r1.Checked
                };
                this.printer_0.SaveUserPrinterEdge(args);
            }
        }
示例#2
0
        public static DataTable GetFormatTable(out string key, out string value)
        {
            string    columnName = "key";
            string    str2       = "value";
            DataTable table      = new DataTable();

            table.Columns.Add(columnName);
            table.Columns.Add(str2);
            table.PrimaryKey = new DataColumn[] { table.Columns["value"] };
            key   = columnName;
            value = str2;
            DataRow row = table.NewRow();

            row[columnName] = "76mm * 177mm";
            row[str2]       = "NEW76mmX177mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 152mm";
            row[str2]       = "NEW76mmX152mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 127mm";
            row[str2]       = "NEW76mmX127mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "57mm * 177mm";
            row[str2]       = "NEW57mmX177mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "57mm * 152mm";
            row[str2]       = "NEW57mmX152mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "57mm * 127mm";
            row[str2]       = "NEW57mmX127mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 177mm(北京)";
            row[str2]       = "BJ76mmX177mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 177mm(上海)";
            row[str2]       = "SH76mmX177mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 177mm(黑龙江)";
            row[str2]       = "HLJ76mmX177mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 127mm(云南)";
            row[str2]       = "YN76mmX127mm";
            table.Rows.Add(row);
            row             = table.NewRow();
            row[columnName] = "76mm * 177mm(云南)";
            row[str2]       = "YN76mmX177mm";
            table.Rows.Add(row);
            Dictionary <string, int> jsPrintTemplate = ToolUtil.GetJsPrintTemplate();

            if (jsPrintTemplate.Count > 0)
            {
                foreach (string str3 in jsPrintTemplate.Keys)
                {
                    if (table.Rows.Find(str3) == null)
                    {
                        row             = table.NewRow();
                        row[columnName] = str3;
                        row[str2]       = str3;
                        table.Rows.Add(row);
                    }
                }
            }
            return(table);
        }
示例#3
0
        private ReadXml()
        {
            this.string_0 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"..\Config\Print\PrintConfig.xml");
            this.dict     = new Dictionary <string, PrintFileModel>();
            this.ZheHang  = new Dictionary <string, PrintZheHangModel>();
            if (File.Exists(this.string_0))
            {
                XmlDocument document         = new XmlDocument();
                byte[]      sourceArray      = Convert.FromBase64String("FZoo0+wH8AgXWEjMAFRnOVt+ZImrQik1jiVirx3SQzoTTc8H/D9o32mIm2Fb6CnC");
                byte[]      destinationArray = new byte[0x20];
                Array.Copy(sourceArray, 0, destinationArray, 0, 0x20);
                byte[] buffer3 = new byte[0x10];
                Array.Copy(sourceArray, 0x20, buffer3, 0, 0x10);
                byte[] buffer4 = AES_Crypt.Decrypt(Convert.FromBase64String("FkC25FGxr7ANG8kSXdMQ1dc1q5h2nMtkTSy90S2NQks6FTRmwMwaGUhrgVdlpMrhTSdJ9l7s5jbUyGMhyCd26w=="), destinationArray, buffer3, null);
                byte[] buffer5 = new byte[0x20];
                Array.Copy(buffer4, 0, buffer5, 0, 0x20);
                byte[] buffer6 = new byte[0x10];
                Array.Copy(buffer4, 0x20, buffer6, 0, 0x10);
                FileStream stream = new FileStream(this.string_0, FileMode.Open);
                byte[]     buffer = new byte[stream.Length];
                stream.Read(buffer, 0, buffer.Length);
                stream.Close();
                byte[] buffer8 = AES_Crypt.Decrypt(buffer, buffer5, buffer6, null);
                if (buffer8 == null)
                {
                    return;
                }
                document.Load(new XmlTextReader(new MemoryStream(buffer8)));
                foreach (XmlNode node in document.DocumentElement.ChildNodes)
                {
                    XmlElement element = node as XmlElement;
                    if ((element != null) && (element.Name == "Print"))
                    {
                        string attribute = element.GetAttribute("Id");
                        if (!this.ContainsKey(attribute))
                        {
                            PrintFileModel model = new PrintFileModel {
                                Id           = attribute,
                                CanvasName   = element.GetAttribute("Canvas"),
                                AssemblyName = element.GetAttribute("Assembly"),
                                ClassName    = element.GetAttribute("Class")
                            };
                            this.Add(new KeyValuePair <string, PrintFileModel>(attribute, model));
                        }
                    }
                    if ((element != null) && (element.Name == "Zh"))
                    {
                        foreach (XmlNode node2 in element.ChildNodes)
                        {
                            XmlElement element2 = node2 as XmlElement;
                            if ((element2 != null) && (element2.Name == "Item"))
                            {
                                string key  = element2.GetAttribute("Id");
                                string str3 = element2.GetAttribute("ConfigId");
                                string str4 = element2.GetAttribute("TempId");
                                if (!this.ZheHang.ContainsKey(key))
                                {
                                    PrintZheHangModel model2 = new PrintZheHangModel {
                                        Id       = key,
                                        ConfigId = str3,
                                        TempId   = str4
                                    };
                                    this.ZheHang.Add(key, model2);
                                }
                            }
                        }
                    }
                    if ((element != null) && (element.Name == "QRM"))
                    {
                        XmlNodeList childNodes = element.ChildNodes;
                        int_0 = Common.ObjectToInt(element.GetAttribute("IsPrint"));
                    }
                }
            }
            Dictionary <string, int> jsPrintTemplate = ToolUtil.GetJsPrintTemplate();

            if (jsPrintTemplate.Count > 0)
            {
                foreach (string str6 in jsPrintTemplate.Keys)
                {
                    if (!this.ContainsKey(str6))
                    {
                        PrintFileModel model3 = new PrintFileModel {
                            Id           = str6,
                            CanvasName   = str6 + ".xml",
                            AssemblyName = "",
                            ClassName    = ""
                        };
                        this.Add(new KeyValuePair <string, PrintFileModel>(str6, model3));
                    }
                }
            }
        }
示例#4
0
        protected DataDict DictCreate_JP(params object[] args)
        {
            Fpxx dyfp = base.dyfp;

            dyfp         = new InvoiceHandler().ConvertInvoiceToZH(dyfp);
            base._isZYPT = true;
            if (dyfp != null)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("fpdm", dyfp.fpdm);
                dict.Add("fphm", dyfp.fphm);
                dict.Add("xfmc", dyfp.xfmc);
                dict.Add("xfsh", dyfp.xfsh);
                dict.Add("jqbh", dyfp.jqbh);
                string str3 = ToolUtil.FormatDateTimeEx(dyfp.kprq);
                dyfp.kprq = Aisino.Fwkp.Print.Common.ObjectToDateTime(str3).Date.ToString("yyyy-MM-dd");
                dict.Add("kprq", dyfp.kprq);
                dict.Add("skr", dyfp.skr);
                dict.Add("gfmc", dyfp.gfmc);
                dict.Add("gfsh", dyfp.gfsh);
                dict.Add("hjje", ((char)0xffe5) + dyfp.je);
                dict.Add("hjse", ((char)0xffe5) + dyfp.se);
                decimal num2 = Convert.ToDecimal(dyfp.je) + Convert.ToDecimal(dyfp.se);
                dict.Add("jshjxx", ((char)0xffe5) + num2.ToString());
                dict.Add("jshjdx", ToolUtil.RMBToDaXie(num2));
                dict.Add("jym", dyfp.jym);
                base.Id = "";
                int    num  = Convert.ToInt32(dyfp.yysbz.Substring(6, 2), 0x10) - 1;
                string str2 = "NEW76mmX177mm";
                Dictionary <string, int> jsPrintTemplate = ToolUtil.GetJsPrintTemplate();
                if (jsPrintTemplate.Count > 0)
                {
                    foreach (string str in jsPrintTemplate.Keys)
                    {
                        if (jsPrintTemplate[str] == num)
                        {
                            str2 = str;
                        }
                    }
                    if ((num >= 0) && (num <= 10))
                    {
                        string    str5   = this.method_9(dyfp);
                        DataTable table3 = this.method_8(dyfp, 0);
                        if (str5 == "H")
                        {
                            dict.Add("list", table3);
                            base.Id = str2 + "H";
                        }
                        else
                        {
                            dict.Add("hwmc", table3.Rows[0]["hwmc"]);
                            dict.Add("dj", table3.Rows[0]["dj"]);
                            dict.Add("sl", table3.Rows[0]["sl"]);
                            dict.Add("je", table3.Rows[0]["je"]);
                            base.Id = str2 + "V";
                        }
                    }
                    else
                    {
                        DataTable table2 = this.method_8(dyfp, 0);
                        dict.Add("list", table2);
                        base.Id = str2;
                    }
                }
                else
                {
                    string    str6  = this.method_9(dyfp);
                    DataTable table = this.method_8(dyfp, 0);
                    if (str6 == "H")
                    {
                        dict.Add("list", table);
                        base.Id = PrintTemplate.NEW76mmX177mm.ToString() + "H";
                    }
                    else
                    {
                        dict.Add("hwmc", table.Rows[0]["hwmc"]);
                        dict.Add("dj", table.Rows[0]["dj"]);
                        dict.Add("sl", table.Rows[0]["sl"]);
                        dict.Add("je", table.Rows[0]["je"]);
                        base.Id = PrintTemplate.NEW76mmX177mm.ToString() + "V";
                    }
                }
                return(new DataDict(dict));
            }
            base._isPrint = "0006";
            return(null);
        }