Example #1
0
        public void naljepnice_po_nosiocu()
        {
            LOKACIJESelectionListWorkItem item = this.Controller.WorkItem.Items.AddNew <LOKACIJESelectionListWorkItem>("test");
            DataRow row2 = item.ShowModal(true, "", null);

            item.Terminate();
            if (row2 != null)
            {
                IEnumerator enumerator = null;
                S_OS_STANJE_LOKACIJA_ISPIS_NALJEPNICADataAdapter adapter2 = new S_OS_STANJE_LOKACIJA_ISPIS_NALJEPNICADataAdapter();
                S_OS_STANJE_LOKACIJA_ISPIS_NALJEPNICADataSet     dataSet  = new S_OS_STANJE_LOKACIJA_ISPIS_NALJEPNICADataSet();
                adapter2.Fill(dataSet, Conversions.ToInteger(row2["idlokacije"]));
                KORISNIKDataSet set = new KORISNIKDataSet();
                new KORISNIKDataAdapter().Fill(set);
                string       str      = Conversions.ToString(set.KORISNIK.Rows[0]["KORISNIK1NAZIVZANALJEPNICE"]);
                Encoding     encoding = Encoding.GetEncoding(0x4e2);
                StreamWriter writer   = new StreamWriter("maleN.txt", false, encoding);
                try
                {
                    enumerator = dataSet.S_OS_STANJE_LOKACIJA_ISPIS_NALJEPNICA.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow current = (DataRow)enumerator.Current;
                        int     num2    = Conversions.ToInteger(current["stanje"]);
                        int     num4    = num2;
                        for (int i = 1; i <= num4; i++)
                        {
                            string str3 = "\"" + str + "\"";
                            string str4 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current["NAZIVOS"]), "\""));
                            string str2 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current["INVBROJ"]), "\""));
                            writer.WriteLine("");
                            writer.WriteLine("N");
                            writer.WriteLine("I8,B,001");
                            writer.WriteLine("Q152,32");
                            writer.WriteLine("q100");
                            writer.WriteLine("rN");
                            writer.WriteLine("S2");
                            writer.WriteLine("D7");
                            writer.WriteLine("ZB");
                            writer.WriteLine("JF");
                            writer.WriteLine("OD");
                            writer.WriteLine("R60,0");
                            writer.WriteLine("A210,26,0,1,1,1,N," + str3);
                            writer.WriteLine("A210,46,0,1,1,1,N," + str4);
                            writer.WriteLine("B210,65,0,1,2,2,60,B," + str2);
                            writer.WriteLine("P1");
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                writer.Close();
                if (Interaction.MsgBox("Izrada naljepnica završena. Želite li ispisati naljepnice na ZEBRA printer?", MsgBoxStyle.YesNo, "OS-Ispis naljepnica") == MsgBoxResult.Yes)
                {
                    PrintDialog dialog = new PrintDialog {
                        PrinterSettings = new PrinterSettings()
                    };
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        DOSPrinter.SendFileToPrinter(dialog.PrinterSettings.PrinterName, "maleN.txt");
                    }
                    else
                    {
                        Interaction.MsgBox("Odustali ste od ispisa naljepnica!", MsgBoxStyle.OkOnly, "OS-Ispis naljepnica");
                    }
                }
            }
        }
Example #2
0
        public void Ispis_Naljepnica_MaliFORMAT()
        {
            KORISNIKDataSet dataSet = new KORISNIKDataSet();

            new KORISNIKDataAdapter().Fill(dataSet);
            string        str        = Conversions.ToString(dataSet.KORISNIK.Rows[0]["KORISNIK1NAZIVZANALJEPNICE"]);
            Encoding      encoding   = Encoding.GetEncoding(0x4e2);
            StreamWriter  writer     = new StreamWriter("maleN.txt", false, encoding);
            RowEnumerator enumerator = this.userControlDataGridOS.DataGrid.Selected.Rows.GetEnumerator();

            while (enumerator.MoveNext())
            {
                int          num3    = 0;
                int          num4    = 0;
                UltraGridRow current = enumerator.Current;
                foreach (DataRow row2 in this.userControlDataGridOS.DataGrid.DataSet.OSTEMELJNICA.Select(Conversions.ToString(Operators.ConcatenateObject("INVBROJ = ", current.Cells["INVBROJ"].Value))))
                {
                    if (Conversions.ToBoolean(Operators.OrObject(Operators.CompareObjectEqual(row2["idosdokument"], 1, false), Operators.CompareObjectEqual(row2["idosdokument"], 6, false))))
                    {
                        num4 = Conversions.ToInteger(Operators.AddObject(num4, row2["OSKOLICINA"]));
                    }
                    if (Conversions.ToBoolean(Operators.OrObject(Operators.CompareObjectEqual(row2["idosdokument"], 3, false), Operators.CompareObjectEqual(row2["idosdokument"], 7, false))))
                    {
                        num3 = Conversions.ToInteger(Operators.AddObject(num3, row2["OSKOLICINA"]));
                    }
                }
                int num2 = num4 + num3;
                num4 = 0;
                num3 = 0;
                int num7 = num2;
                for (int i = 1; i <= num7; i++)
                {
                    string str3 = "\"" + str + "\"";
                    string str4 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current.Cells["NAZIVOS"].Value), "\""));
                    string str2 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current.Cells["INVBROJ"].Value), "\""));
                    writer.WriteLine("");
                    writer.WriteLine("N");
                    writer.WriteLine("I8,B,001");
                    writer.WriteLine("Q152,32");
                    writer.WriteLine("q100");
                    writer.WriteLine("rN");
                    writer.WriteLine("S2");
                    writer.WriteLine("D7");
                    writer.WriteLine("ZB");
                    writer.WriteLine("JF");
                    writer.WriteLine("OD");
                    writer.WriteLine("R60,0");
                    writer.WriteLine("A210,26,0,1,1,1,N," + str3);
                    writer.WriteLine("A210,46,0,1,1,1,N," + str4);
                    writer.WriteLine("B210,65,0,1,2,2,60,B," + str2);
                    writer.WriteLine("P1");
                }
            }
            writer.Close();
            if (Interaction.MsgBox("Izrada naljepnica završena. Želite li ispisati naljepnice na ZEBRA printer?", MsgBoxStyle.YesNo, "OS-Ispis naljepnica") == MsgBoxResult.Yes)
            {
                PrintDialog dialog = new PrintDialog {
                    PrinterSettings = new PrinterSettings()
                };
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    DOSPrinter.SendFileToPrinter(dialog.PrinterSettings.PrinterName, "maleN.txt");
                }
                else
                {
                    Interaction.MsgBox("Odustali ste od ispisa naljepnica!", MsgBoxStyle.OkOnly, "OS-Ispis naljepnica");
                }
            }
        }