示例#1
0
 public static bool LoadFromFile(string fileName, out ephType obj, out System.Exception exception)
 {
     return LoadFromFile(fileName, Encoding.UTF8, out obj, out exception);
 }
示例#2
0
 public static bool LoadFromFile(string fileName, out ephType obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
示例#3
0
 /// <summary>
 /// Deserializes xml markup from file into an ephType object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ephType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, System.Text.Encoding encoding, out ephType obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ephType);
     try
     {
         obj = LoadFromFile(fileName, encoding);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
示例#4
0
 public static bool Deserialize(string xml, out ephType obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
示例#5
0
 /// <summary>
 /// Deserializes workflow markup into an ephType object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output ephType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out ephType obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ephType);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
示例#6
0
        private void SpracujZasielku(ephType xml, Invoice invoice, string prefix, string postfix, ref long code)
        {
            if (!IsPostaShipping(invoice))
                return;

            var zasielka = new ephTypeZasielka();

            zasielka.Adresat = new ephTypeZasielkaAdresat();
            zasielka.Adresat.Email = invoice.CustomerEmail;
            zasielka.Adresat.Krajina = invoice.ShippingCountry;
            zasielka.Adresat.Meno = invoice.ShippingName;
            zasielka.Adresat.Mesto = invoice.ShippingCity;
            zasielka.Adresat.Organizacia = "";
            zasielka.Adresat.PSC = invoice.ShippingZip;
            zasielka.Adresat.Telefon = invoice.ShippingPhoneNumber;
            zasielka.Adresat.Ulica = invoice.ShippingStreet;

            zasielka.Info = new ephTypeZasielkaInfo();
            zasielka.Info.ZasielkaID = invoice.OrderNumber;
            zasielka.Info.Hmotnost = "0.000";
            zasielka.Info.CenaDobierky = invoice.OrderGrandTotal;//VratCenuDopravy(invoice.InvoiceItems);
            //zasielka.Info.Trieda = "1";
            zasielka.Info.CisloUctu = "2800328484/8330";
            zasielka.Info.SymbolPrevodu = zasielka.Info.ZasielkaID; // VS ako zasielkaID
            zasielka.Info.Poznamka = zasielka.Info.SymbolPrevodu + "_Activestyle.sk";
            zasielka.Info.DruhPPP = "5";
            zasielka.Info.CiarovyKod = string.Format("{0}{1}{2}", prefix, code++, postfix); // "ER89069766SK";

            zasielka.PouziteSluzby = new List<string>();
            zasielka.PouziteSluzby.Add("");

            zasielka.Spat = null;
            zasielka.DalsieUdaje = null;

            xml.Zasielky.Add(zasielka);
        }
示例#7
0
        private void DoPostaExport()
        {
            var ds = GetInvoiceDS();
            if (ds == null)
                return;

            var datum = DateTime.Now.ToString("yyyyMMdd");

            var xml = new ephType();
            xml.verzia = "3";

            var props = Properties.Settings.Default;
            long code = props.CiarKod;
            // zasielky
            xml.Zasielky = new List<ephTypeZasielka>();
            foreach (var invoice in ds)
            {
                if (!invoice.Equipped || invoice.Cancelled)
                    continue;

                SpracujZasielku(xml, invoice, props.CiarKodPrefix, props.CiarKodPostfix, ref code);
            }

            xml.InfoEPH = new ephTypeInfoEPH();
            xml.InfoEPH.Datum = datum;
            xml.InfoEPH.DruhPPP = "";
            xml.InfoEPH.DruhZasielky = "8";
            xml.InfoEPH.EPHID = "";
            xml.InfoEPH.Mena = "EUR";
            xml.InfoEPH.PocetZasielok = xml.Zasielky.Count.ToString();
            xml.InfoEPH.SposobSpracovania = "";
            xml.InfoEPH.TypEPH = "1";
            xml.InfoEPH.Uhrada = new List<ephTypeInfoEPHUhrada>();
            xml.InfoEPH.Uhrada.Add(new ephTypeInfoEPHUhrada());
            xml.InfoEPH.Uhrada[0].SposobUhrady = "8";
            xml.InfoEPH.Uhrada[0].SumaUhrady = "0.00";
            xml.InfoEPH.Odosielatel = new ephTypeInfoEPHOdosielatel();
            //xml.InfoEPH.Odosielatel.CisloUctu = "*****@*****.**";
            xml.InfoEPH.Odosielatel.Email = "*****@*****.**";
            xml.InfoEPH.Odosielatel.Krajina = "";
            xml.InfoEPH.Odosielatel.Meno = "Activestyle.sk";
            xml.InfoEPH.Odosielatel.Mesto = "Rimavská Sobota 1";
            xml.InfoEPH.Odosielatel.OdosielatelID = "";
            xml.InfoEPH.Odosielatel.Organizacia = "MM Retail s.r.o.";
            xml.InfoEPH.Odosielatel.PSC = "979 01";
            xml.InfoEPH.Odosielatel.Telefon = "0948544211";
            xml.InfoEPH.Odosielatel.Ulica = "B.Bartóka 1048/24";

            var dir = txtOutDir.Text;
            if (!dir.EndsWith(@"\"))
                dir += @"\";
            dir += @"Posta\";
            if (!Directory.Exists(dir))
                Directory.CreateDirectory(dir);

            xml.SaveToFile(dir + "export_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".xml");

            // ak vsetko ok, ulozime nastavenia s novym ciarovym kodom
            props.CiarKod = code;
            props.Save();
            btnSettingsLoad.PerformClick();
        }