public async Task UpdateEmpresaAsync()
        {
            bool Response = await EmpresasBL.UpdateEmpresaAsync(ObjEmpresa);

            if (Response)
            {
                await Alert("Empresa actualizada", "Acción realizada con exito", true);
            }
            else
            {
                await Alert("Opps...", "Ocurrio un error", false);
            }
        }
Exemplo n.º 2
0
        private void emitirPendientesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            frmSplash.Show();
            EmpresasBL     EmpresasBL = BusinessLogicFactory.GetBusinessLogicInstance(db, typeof(EmpresasBL)) as EmpresasBL;
            ComprobantesBL FacturasBL;

            FacturasBL = BusinessLogicFactory.GetBusinessLogicInstance(db, typeof(ComprobantesBL)) as ComprobantesBL;
            //FacturasBL.SetTipoFilter(TiposComprobantesList.Factura);
            List <TiposComprobantesList> tipos = new List <TiposComprobantesList>();

            tipos.Add(TiposComprobantesList.Factura);
            tipos.Add(TiposComprobantesList.NotaCredito);
            tipos.Add(TiposComprobantesList.NotaDebito);
            FacturasBL.SetTiposFilter(tipos);
            FacturasBL.SetEstadoFilter(Comprobantes.EstadoPendiente);
            FacturasBL.SetEmisionHoyFilter();
            ArrayList facturasPend = new ArrayList();

            facturasPend.AddRange(FacturasBL.GetDataSource());
            CRUDComprobantesController result = new CRUDComprobantesController(FacturasBL, "Facturas", "Facturas", typeof(ComprobantesCRUD));

            bool     verReporteAux;
            string   nroComp;
            int      index = 1;
            Empresas emp   = null;

            foreach (Comprobantes comp in facturasPend)
            {
                frmSplash.TextoContador = String.Format("{0} de {1}", index.ToString(), facturasPend.Count.ToString());
                frmSplash.Refresh();
                nroComp         = null;
                verReporteAux   = comp.VerReporte;
                comp.VerReporte = false;
                result.EmitirComprobante(comp, out nroComp, false);
                if (nroComp == "-1")
                {
                    throw new Exception("Hubo un error emitiendo los comprobantes.");
                }
                PersistirUltimoNroCbanteComprobante(comp);

                comp.VerReporte = verReporteAux;
                index++;
                emp = comp.Empresa;
            }
            EmpresasBL.SaveOrUpdate(emp);
            frmSplash.Hide();
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 3
0
        public void EnvioFTP()
        {
            EmpresasBL empBL = new EmpresasBL();

            empBL.SetParameters(db);
            ComprobantesBL compBL = new ComprobantesBL();

            compBL.SetParameters(db);

            Empresas empresa = empBL.GetObject(GeneralSettings.Instance.IdEmpresaDefault) as Empresas;

            if (empresa != null)
            {
                Ftp FtpClient = new Ftp();
                FtpClient.HostAddress = FTPHost;
                FtpClient.Port        = FTPPort;
                FtpClient.Username    = FTPName;
                FtpClient.Password    = FTPPass;
                FtpClient.Timeout     = FTPTimeOut;
                FtpClient.Connect();

                string       fileName = empresa.Cuit + "_" + DateTime.Now.ToString("yyyyMMdd_hhmm") + ".txt";
                StreamWriter tw       = File.CreateText(fileName);

                FtpClient.MoveDirectory(empresa.Cuit);
                int cantidadEmitidos = 0;
                foreach (Comprobantes comp in compBL.GetDataSource())
                {
                    if (comp.IsEmitido)
                    {
                        tw.Write(compBL.GetResumeStream(comp));
                        cantidadEmitidos++;
                    }
                }
                tw.Write("Cantidad de facturas emitidas: " + cantidadEmitidos.ToString() + "\r\n");
                tw.Close();

                FtpClient.PutFile(fileName);
                FtpClient.Quit();

                File.Delete(fileName);
            }
        }
Exemplo n.º 4
0
        public bool IsValidLicense()
        {
            if (!lastLicenseCheck.HasValue || lastLicenseCheck.Value.AddMonths(1) < DateTime.Today)
            {
                EmpresasBL empBL = new EmpresasBL();
                empBL.SetParameters(db);
                ComprobantesBL compBL = new ComprobantesBL();
                compBL.SetParameters(db);

                Empresas empresa = empBL.GetObject(GeneralSettings.Instance.IdEmpresaDefault) as Empresas;
                if (empresa != null)
                {
                    Ftp FtpClient = new Ftp();
                    FtpClient.HostAddress = FTPHost;
                    FtpClient.Port        = FTPPort;
                    FtpClient.Username    = FTPName;
                    FtpClient.Password    = FTPPass;
                    FtpClient.Timeout     = FTPTimeOut;
                    FtpClient.Connect();

                    string fileName = empresa.Cuit;

                    FtpClient.MoveDirectory("Licencias");
                    FtpItemCollection fic = new FtpItemCollection();
                    FtpClient.FileList(ref fic);
                    foreach (FtpItem item in fic)
                    {
                        if (item.Name.ToLower() == fileName.ToLower())
                        {
                            lastLicenseCheck = DateTime.Today;
                            return(true);
                        }
                    }
                    FtpClient.Quit();
                }

                return(false);
            }
            else
            {
                return(true);
            }
        }
        public async Task DeleteEmpresaAsync(EmpresaModel Empresa)
        {
            await EmpresasBL.DeleteEmpresaAsync(Empresa);

            await GetEmpresasAsync();
        }
        public async Task GetEmpresasAsync()
        {
            ListEmpresas = await EmpresasBL.GetEmpresasAsync();

            Opacity = 0;
        }
Exemplo n.º 7
0
 public LibroComprasAFIPController(ComprobantesComprasBL comprobantesComprasBL, EmpresasBL empresasBL)
 {
     libroIVAComprasBL = new LibroIVAComprasBL(comprobantesComprasBL);
     this.empresasBL   = empresasBL;
 }