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(); } }
static public string [] InitializareSefID(string cod) { string sStream = null; const string sSeparatori2 = "#"; WebService.PreluareDate ws; string[] returnString= new string[3]; try { ws = new WebService.PreluareDate(); ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy(); sStream = ws.Initializare(cod); // Initializare SefID Debug.WriteLine("sStream= " + sStream); if ((sStream == null) || (sStream.Trim().Length == 0)) { return null; } if (sStream == "Codul nu este asociat unui sef echipa!") { returnString[0] = "Codul nu este asociat unui sef echipa!"; return returnString; } } catch //Ws no reply { // MessageBox.Show("Cod incorect"); //TODO create exception EXC_DBRemoteServerConnectionError(); //throw new EXC_DBRemoteServerConnectionError(); return null; } finally { ws = null; } try { string[] sAtomi1 = sStream.Split(sSeparatori2.ToCharArray()); string SefID = sAtomi1[0]; string Nume = sAtomi1[1]; string Prenume = sAtomi1[2]; string Firma = sAtomi1[3]; Debug.WriteLine("SefID: "+SefID +" Nume: "+ Nume +" Prenume: "+ Prenume +" Firma: "+ Firma); returnString[0] = SefID; returnString[1] = Nume; returnString[2] = Prenume; /* LoginForm.sefID = SefID; LoginForm.nume = Nume; LoginForm.prenume = Prenume;*/ } catch { return null; //TODO create exception EXC_FormatIncorect(); //throw new EXC_FormatIncorect(); } return returnString; }
// CallBack function static public string SendScanare(string stringScanare) { WebService.PreluareDate ws = null; try { ws = new WebService.PreluareDate(); ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy(); return ws.Scanare(stringScanare); } finally { ws = null; } }
//static WS_PreluareDate() //{ //} static public void InitializareHale() { 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.GetHale(); 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 { Database.Connect(); //TODO isolate common code and create stream decode method string[] sAtomi1 = sStream.Split(sSeparatori1.ToCharArray()); 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 idHala = sAtomi2[0]; string denumire = sAtomi2[1]; //Debug.WriteLine("str1= " + str1);//listBox1.Items.Add(str2); //Debug.WriteLine("str2= " + str2); Database.Connect(); TabelHale.InsertTableHale(idHala, denumire); Database.Close(); } } catch { //TODO create exception EXC_FormatIncorect(); //throw new EXC_FormatIncorect(); } finally { Database.Close(); } }