Exemplo n.º 1
0
        public static ApiResponse.DatosChip GetDataChip(string ROM)
        {
            PropiedadesExtendidas LogPropiedades = new PropiedadesExtendidas();
            CategoriasLog         LogCategorias  = new CategoriasLog();

            try
            {
                ApiResponse.DatosChip response = null;
                LogCategorias.Clear();
                LogCategorias.Agregar("SICOM");
                LogPropiedades.Clear();
                LogPropiedades.Agregar("Mensaje", "Antes de enviar la consulta");
                LogPropiedades.Agregar("ROM ENVIADO", ROM);
                LogPropiedades.Agregar("Fecha", DateTime.Now.ToString());
                POSstation.Fabrica.LogIt.Loguear("Envio de consulta de chip sicom", LogPropiedades, LogCategorias);

                string json = ApiSICOM.ExecuteApiCommand("ConsultarChip", "", ROM);


                LogCategorias.Clear();
                LogCategorias.Agregar("SICOM");
                LogPropiedades.Clear();
                LogPropiedades.Agregar("Mensaje", "Despues de enviar la consulta");
                LogPropiedades.Agregar("JSON RECIBIDO", json);
                LogPropiedades.Agregar("Fecha", DateTime.Now.ToString());
                POSstation.Fabrica.LogIt.Loguear("Respuesta de consulta de chip sicom", LogPropiedades, LogCategorias);

                response = JSON.Deserialize <ApiResponse.DatosChip>(json);

                ApiSICOM.ThrowExceptionApi(response);

                return(response);
            }
            catch { throw; }
        }
Exemplo n.º 2
0
        public static string DownloadCertificate(string path)
        {
            try
            {
                string content = String.Empty;
                ApiResponse.Respuesta response = null;

                string json = ApiSICOM.ExecuteApiCommand("DescargarCertificado", "", "");

                if (JSON.IsDeserializable <ApiResponse.Respuesta>(json))
                {
                    response = JSON.Deserialize <ApiResponse.Respuesta>(json);
                    ApiSICOM.ThrowExceptionApi(response);
                }
                else
                {
                    content = json;
                    string pathfolder = String.Empty;

                    if (!String.IsNullOrEmpty(path))
                    {
                        pathfolder = Util.GetFolderPath(path);
                        string file = Util.GetFileName(path).Replace(pathfolder, "");

                        if (String.IsNullOrEmpty(file))
                        {
                            file = String.Format("Certificado{0}.csv", DateTime.Now.ToString("yyyyMMddHHmmss"));
                        }

                        if (!Directory.Exists(pathfolder))
                        {
                            Directory.CreateDirectory(pathfolder);
                        }

                        pathfolder += @"\" + file;

                        if (!String.IsNullOrEmpty(pathfolder))
                        {
                            using (StreamWriter writer = new StreamWriter(pathfolder))
                                writer.Write(content);
                        }
                    }
                }

                return(content);
            }
            catch { throw; }
        }