Esempio n. 1
0
        private void popupWindowShowActionGetXml_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            IObjectSpace   objectSpace = Application.CreateObjectSpace();
            CargaRecepcion obj         = e.PopupWindowViewCurrentObject as CargaRecepcion;

            Empresa emprs = View.ObjectSpace.FindObject <Empresa>(null);
            Ventas  Prms  = objectSpace.FindObject <Ventas>(null);

            string aux = Path.Combine(obj.Rt, "Extract");

            string[] dirs = Directory.GetFiles(aux, "*.xml");
            foreach (string dir in dirs)
            {
                DocumentoSalida rcpcn = objectSpace.CreateObject <DocumentoSalida>();

                NegocioAdmin.ObtenXmlsVnts(rcpcn, emprs, Prms, dir);
                NegocioAdmin.GrabaDocumento(rcpcn, Prms, false);
                objectSpace.CommitChanges();

                string auxX = $"{rcpcn.FechaDoc.Year}{rcpcn.FechaDoc.Month:d2}{rcpcn.FechaDoc.Day:d2}{Path.GetFileName(dir)}";
                NegocioAdmin.Mueve(Path.GetDirectoryName(dir), Path.Combine(obj.Rt, "Factura"),
                                   Path.GetFileName(dir), auxX);
            }
        }