Ejemplo n.º 1
0
        public string Post([FromBody] List <JObject> value)
        {
            string result;

            try
            {
                //llama la estructura del conector

                DataSet structure = new DataSet();

                SQLTransaction ejecutar = new SQLTransaction();
                structure  = ejecutar.GetStruct();
                planeBuild = new PlaneBuilder();


                if (value != null)
                {
                    plane.Append(planeBuild.BuildInitial(structure, value[0]));                  //construye linea inicial

                    for (int j = 0; j < value.Count; j++)                                        //recorre la lista de registros a enviar
                    {
                        string  ConectorType = (string)value[j]["Conector"];                     //extrae el nombre del conector
                        JObject json         = value[j];                                         //extrae json del conector a enviar

                        plane.Append(planeBuild.BuildMasters(structure, json, ref consectLine)); //construye encabezados o maestros
                        string Pano = plane.ToString();
                        plane.Append(planeBuild.BuildDetails(structure, json, ref consectLine)); //construye movimientos
                    }

                    plane.Append(planeBuild.BuildFinal(structure, value[0], ref consectLine));//construye linea final


                    string Plano             = plane.ToString();
                    String PlanoSinEtiquetas = Plano.Replace("<Linea>", "").Replace("</Linea>", "");
                    string cia = PlanoSinEtiquetas.Substring(17, 1);
                    //var SavePlane = new StreamWriter($@"C:\inetpub\wwwroot\SKYApi\planos\Pedido{DateTime.Now.ToString("ddMMyyyy")}.txt");
                    //SavePlane.WriteLine(PlanoSinEtiquetas);
                    //SavePlane.Close();
                    result = planeBuild.SendInformationWS(Plano, cia);
                    return(result);
                }
                return("No se envio ningun Body..");
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }