Click here to Skip to main content
15,396,920 members

Comments by Luis M. Rojas (Top 5 by date)

Luis M. Rojas 4-Aug-22 14:20pm View
   
Hello,
The result(the store procedure) has return a string: FACTURA VALIDA or FACTURA INVALIDA
Luis M. Rojas 2-Aug-22 12:54pm View
   
Hello,
Well i just try to use this code:

json = tr.ReadToEnd();
dynamic result = JsonConvert.DeserializeObject(json);
foreach (dynamic paq in result)
{
string string2 = "contenido: " + paq.contenido;
}

But i got this error
Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0656	Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'	Login	C:\Login\Login\Login\DisplayTracking.xaml.cs	69	Active


but i have the DLL installed in the reference of the project.
Luis M. Rojas 2-Aug-22 8:13am View
   
Hello, First i beg you pardon me, when i say: lastname, could be any fields, in my case it is a unique key: tracking number, and here is my class(package):
public class Package
{
[JsonProperty("id_tipo_envio")]
// [JsonConverter(typeof(ParseStringConverter))]
public long IdTipoEnvio { get; set; }

[JsonProperty("peso")]
public string Peso { get; set; }

[JsonProperty("tracking_number")]
public string TrackingNumber { get; set; }

[JsonProperty("contenido")]
public string Contenido { get; set; }

[JsonProperty("guia")]
public string Guia { get; set; }

[JsonProperty("desc_estatus_proceso")]
public string DescEstatusProceso { get; set; }

[JsonProperty("id_estatus_proceso")]
//[JsonConverter(typeof(ParseStringConverter))]
public long IdEstatusProceso { get; set; }

[JsonProperty("fec_creacion")]
public string FecCreacion { get; set; }

[JsonProperty("factura")]
//[JsonConverter(typeof(ParseStringConverter))]
public long Factura { get; set; }

[JsonProperty("trackingestatus")]
public string Trackingestatus { get; set; }

[JsonProperty("colorestatus")]
public string Colorestatus { get; set; }

[JsonProperty("imagenapp")]
public string Imagenapp { get; set; }

[JsonProperty("id_")]
//[JsonConverter(typeof(ParseStringConverter))]
public long Id { get; set; }

[JsonProperty("urlfoto")]
public string Urlfoto { get; set; }

[JsonProperty("facturatext")]
public string Facturatext { get; set; }

[JsonProperty("facturatext2")]
public string Facturatext2 { get; set; }

[JsonProperty("texto1")]
public object Texto1 { get; set; }

[JsonProperty("texto2")]
public object Texto2 { get; set; }

[JsonProperty("mostrar_boton")]
public long MostrarBoton { get; set; }

[JsonProperty("padre")]
//[JsonConverter(typeof(ParseStringConverter))]
public long Padre { get; set; }

[JsonProperty("tipo_envio")]
public string TipoEnvio { get; set; }

[JsonProperty("show_tipo_envio")]
public long ShowTipoEnvio { get; set; }
}
}
Luis M. Rojas 21-Jul-22 10:20am View
   
Excellent, that is it. Great. Thanks at lot. it is works
Luis M. Rojas 1-Jul-22 9:27am View
   
Well, i think YES. This is it what i want: I have a vitronic Machine which is running on a server (ip xxx.xxx.xxx, port xxx), this program send an answer in XML, the host (ip xxx.xxx.xxx, port yyy) has to read and send a XML and so on.
I found this code to send and Recive, but nothing happen.

private void startButton_Click(object sender, EventArgs e)
{
//IPEndPoint LocalEndpoint = new IPEndPoint(IPAddress.Parse(txtIP.Text), 20000);
IPEndPoint LocalEndpoint = new IPEndPoint(IPAddress.Parse("xxx.xxx.xxx.xx"), 20000);
Socket _Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

_Socket.Bind(LocalEndpoint);
_Socket.Listen(10);
_Socket.BeginAccept(new AsyncCallback(Accept), _Socket);
}

private void Accept(IAsyncResult _IAsyncResult)
{
Socket AsyncSocket = (Socket)_IAsyncResult.AsyncState;
Socket dataSocket = AsyncSocket.EndAccept(_IAsyncResult);
var buffer = new byte[1024];
AsyncSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(Receive), dataSocket);

}

private void Receive(IAsyncResult _IAsyncResult)
{
Socket AsyncSocket = (Socket)_IAsyncResult.AsyncState;
AsyncSocket.EndReceive(_IAsyncResult);
var buffer = new byte[1024];
var strReceive = Encoding.ASCII.GetString(buffer);
txtXMLRecibido.Text +=strReceive;
AsyncSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(Receive), AsyncSocket);
}

private void button1_Click(object sender, EventArgs e)
{
//To conect to the server
if (txtIP.Text == "")
{
lblMensaje.Text = "Debe Digitar el IP";
return;
}

if (txtPort.Text == "")
{
lblMensaje.Text = "Debe Digitar el número de Puerto";
return;
}
IPEndPoint RemoteEndPoint = new IPEndPoint(IPAddress.Parse(txtIP.Text), Convert.ToInt32(txtPort.Text));
Socket _Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

_Socket.BeginConnect(RemoteEndPoint, new AsyncCallback(Connect), _Socket);

}
private void Connect(IAsyncResult _IAsyncResult)
{
try
{
Socket RemoteSocket = (Socket)_IAsyncResult.AsyncState;
RemoteSocket.EndConnect(_IAsyncResult);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}