using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;
using Common;

namespace CarMeterSystem
{
  public class MyTest
  {
    public LimisResponse sendDataToZn(WeightInfoBeta model)
    {
      DataContractJsonSerializer objseria = new DataContractJsonSerializer(typeof(WeightInfoBeta));
      MemoryStream mem = new MemoryStream();
      objseria.WriteObject(mem, model);
      string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
      WebClient webClient = new WebClient();
      webClient.Headers["Content-type"] = "application/json";
      webClient.Encoding = Encoding.UTF8;
      string retStr = webClient.UploadString("http://10.121.16.36:8888/LimsService.svc/SendWeightResultBeta", "POST", data);
      LimisResponse limisResponse = JsonConvert.DeserializeObject<LimisResponse>(retStr);
      return limisResponse;
    }
  }
  public class LimisResponse
  {
    public bool Success { get; set; }
    public string Msg { get; set; }
    public string Code { get; set; }
  }
}
