Exemplo n.º 1
0
        static public void InitializareAmbalaje()
        {
            string sStream = null;
            const string sSeparatori1 = "@";
            const string sSeparatori2 = "#";
            WebService.PreluareDate ws;

            try
            {
                ws = new WebService.PreluareDate();
                ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy();
                sStream = ws.GetAmbalaje();
                Debug.WriteLine("sStream= " + sStream);
                if ((sStream == null) || (sStream.Trim().Length == 0)) { return; }
            }
            catch
            {
                //TODO create exception EXC_DBRemoteServerConnectionError();
                //throw new EXC_DBRemoteServerConnectionError();
            }
            finally
            {
                ws = null;
            }

            try
            {


                string[] sAtomi1 = sStream.Split(sSeparatori1.ToCharArray());
                Debug.WriteLine("sAtomi1[0]= " + sAtomi1[0]);


                int index1;
                for (index1 = 0; index1 < sAtomi1.Length; index1 = index1 + 1)
                {
                    if (sAtomi1[index1].Length <= 0) continue;

                    string[] sAtomi2 = sAtomi1[index1].Split(sSeparatori2.ToCharArray());
                    string idAmbalaj = sAtomi2[0];
                    string denumire = sAtomi2[1];
                    string greutate = sAtomi2[2];
                    //Debug.WriteLine( idAmbalaj);
                    //Debug.WriteLine(denumire);
                    //Debug.WriteLine(greutate);

                    Database.Connect();
                    TabelAmbalaje.InsertTableAmbalaje(idAmbalaj, denumire, greutate); 
                    Database.Close();
                }
                



            }
            catch
            {
                //TODO create exception EXC_FormatIncorect();
                //throw new EXC_FormatIncorect();
            }


        }