コード例 #1
0
        public string recibirFactura(byte[] xml, byte[] pdf, string email, string nombre, string dst)
        {
            try
            {
                DB.Conectar();
                DB.CrearComando(@"SELECT dirtxt,dirdocs,dirrespaldo from ParametrosSistema");
                DbDataReader DR = DB.EjecutarConsulta();
                if (DR.Read())
                {
                    dirArc = DR[0].ToString();
                    dirPdf = DR[1].ToString();
                    dirBck = DR[2].ToString();
                }
                DB.Desconectar();

                if (xml != null)
                {
                    //StreamWriter swXml = new StreamWriter(dirArc + nombre + ".xml");
                    //swXml.Write(xml);
                    //swXml.Close();
                    //swXml.Dispose();
                    System.IO.File.WriteAllBytes(dirArc + nombre + ".xml", xml);
                }
                if (pdf != null)
                {
                    //StreamWriter swPdf = new StreamWriter(dirArc + nombre + ".pdf");
                    //swPdf.Write(xml);
                    //swPdf.Close();
                    //swPdf.Dispose();
                    System.IO.File.WriteAllBytes(dirArc + nombre + ".pdf", pdf);
                }
                String[] files = Directory.GetFiles(dirArc);

                FAC           = new Facturas(files, dirBck, dirPdf, dirArc, "", Session["identificador"].ToString());
                FAC.emails    = email;
                FAC.msj       = "";
                FAC.TIPOORDEN = dst;

                FAC.leerIndividual(dirArc + nombre + ".xml");

                //Estatus general
                //msj = FAC.getmsgarrayLog();
                return(msj);
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }