Пример #1
0
        public void Elimina(DocumentoBE pItem)
        {
            try
            {
                DocumentoDL        Documento        = new DocumentoDL();
                DocumentoPersonaDL DocumentoPersona = new DocumentoPersonaDL();
                Documento.Elimina(pItem);

                //ELIMINAMOS EL DETALLE
                List <DocumentoPersonaBE> lstDocumentoPersona = null;
                lstDocumentoPersona = new DocumentoPersonaBL().ListaTodosActivo(0, 0, pItem.IdDocumento);

                if (lstDocumentoPersona.Count > 0)
                {
                    foreach (var item in lstDocumentoPersona)
                    {
                        item.Usuario   = pItem.Usuario;
                        item.Maquina   = pItem.Maquina;
                        item.IdEmpresa = pItem.IdEmpresa;
                        DocumentoPersona.Elimina(item);
                    }
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
Пример #2
0
        public static DocumentoBE ObtenerDocumento(IDataReader dr)
        {
            DocumentoBE oDocumentoBE = new DocumentoBE();

            if (!dr.IsDBNull(dr.GetOrdinal("idDocumento")))
            {
                oDocumentoBE.idDocumento = dr.GetString(dr.GetOrdinal("idDocumento"));
            }

            if (!dr.IsDBNull(dr.GetOrdinal("idInversion")))
            {
                oDocumentoBE.idInversion = dr.GetString(dr.GetOrdinal("idInversion"));
            }

            if (!dr.IsDBNull(dr.GetOrdinal("ruta")))
            {
                oDocumentoBE.ruta = dr.GetString(dr.GetOrdinal("ruta"));
            }

            if (!dr.IsDBNull(dr.GetOrdinal("nombre")))
            {
                oDocumentoBE.nombre = dr.GetString(dr.GetOrdinal("nombre"));
            }

            if (!dr.IsDBNull(dr.GetOrdinal("observaciones")))
            {
                oDocumentoBE.observaciones = dr.GetString(dr.GetOrdinal("observaciones"));
            }

            return(oDocumentoBE);
        }
Пример #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Guardar Documento en la base de datos
            DocumentoBE oDocumento = new DocumentoBE();
            //Guardar la cabecera
            CabDocumentoBE oCabecera = new CabDocumentoBE();

            oCabecera.Cliente   = otmpCliente;
            oCabecera.FechaHora = DateTime.Now;
            oCabecera.IGV       = oFacturaBL.IGV;
            oCabecera.SubTotal  = oFacturaBL.SubTotal;
            oCabecera.Total     = oFacturaBL.Total;
            //Agregamos la cabecera al documento
            oDocumento.Cabecera = oCabecera;
            //Agregamos el detalle al documento
            oDocumento.Detalle = oFacturaBL.GetDetalle();
            //Guardar en la base de datos
            //TbDocumentoDao documento = new TbDocumentoDao();
            TbDocumentoBL documento = new TbDocumentoBL();

            /*if(documento.GuardarDocumento(oDocumento) == eEstadoProceso.Correcto){
             *  MessageBox.Show("Documento Guardado");
             * }*/
            ProxyDocumento.DocServiceClient proxyDoc = new ProxyDocumento.DocServiceClient("EndPoint_MSMQ");
            proxyDoc.GuardarDocumento(oDocumento);
            MessageBox.Show("Documento Guardado");
        }
Пример #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Guardar Documento en la Base de Datos
            DocumentoBE oDocumento = new DocumentoBE();
            //Guardar la cabecera
            CabDocumentoBE oCabecera = new CabDocumentoBE();

            oCabecera.Cliente   = otmpCliente;
            oCabecera.FechaHora = DateTime.Now;
            oCabecera.IGV       = oFacturaBL.IGV;
            oCabecera.SubTotal  = oFacturaBL.SubTotal;
            oCabecera.Total     = oFacturaBL.Total;
            //Agregamos la cabera al documento
            oDocumento.Cabecera = oCabecera;
            //Agregarmos el detalle al documento
            oDocumento.Detalle = oFacturaBL.GetDetalle();
            //Guardar en la Base de Datos
            TbDocumentoDAO documento = new TbDocumentoDAO();

            if (documento.GuardarDocumento(oDocumento) ==
                eEstadoProceso.Correcto)
            {
                MessageBox.Show("Documento Guardado");
            }
        }
Пример #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Guardar Documento en la Base de Datos
            DocumentoBE oDocumento = new DocumentoBE();
            //Guardar la cabecera
            CabDocumentoBE oCabecera = new CabDocumentoBE();

            oCabecera.Cliente   = otmpCliente;
            oCabecera.FechaHora = DateTime.Now;
            oCabecera.IGV       = oFacturaBL.IGV;
            oCabecera.SubTotal  = oFacturaBL.SubTotal;
            oCabecera.Total     = oFacturaBL.Total;
            //Agregamos la cabera al documento
            oDocumento.Cabecera = oCabecera;
            //Agregarmos el detalle al documento
            oDocumento.Detalle = oFacturaBL.GetDetalle();
            //Guardar en la Base de Datos
            DocumentoBL documento = new DocumentoBL();

            //if (documento.GuardarDocumento(oDocumento) ==
            //    eEstadoProceso.Correcto)
            //documento.GuardarDocumento(oDocumento);
            //    MessageBox.Show("Documento Guardado");

            ProxyFactura.Service1Client proxy = new ProxyFactura.Service1Client("MSMQ_EndPoint");
            proxy.GuardarDocumento(oDocumento);
            MessageBox.Show("Documento Guardado");
        }
Пример #6
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = 0;

            try
            {
                if (dgvDocumento.RowCount > 0)
                {
                    dialogResult = MessageBox.Show("Seguro de Eliminar el Documento: " + dgvDocumento.CurrentRow.Cells["vDocumento"].Value.ToString().Trim(), "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.Yes)
                    {
                        DocumentoBE DocumentoBE = new DocumentoBE()
                        {
                            OPCION      = 3,
                            USUARIO     = General.General.GetUsuario,
                            IdDocumento = dgvDocumento.CurrentRow.Cells["IdDocumento"].Value.ToString()
                        };

                        DocumentoBL.ProcesarDocumento(DocumentoBE);
                        MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        btnBuscar.PerformClick();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Esta seguro de eliminar el registro?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        DocumentoBE objE_Documento = new DocumentoBE();
                        objE_Documento.IdDocumento = int.Parse(gvDocumento.GetFocusedRowCellValue("IdDocumento").ToString());
                        objE_Documento.Usuario     = Parametros.strUsuarioLogin;
                        objE_Documento.Maquina     = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Documento.IdEmpresa   = Parametros.intEmpresaId;

                        DocumentoBL objBL_Area = new DocumentoBL();
                        objBL_Area.Elimina(objE_Documento);
                        XtraMessageBox.Show("El registro se eliminó correctamente", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #8
0
        public void GuardarDocumento(DocumentoBE oDocumentoDTO)
        {
            TbDocumentoBL documento = new TbDocumentoBL();

            documento.GuardarDocumentoFromServiceLogic(oDocumentoDTO);
            //documento.GuardarDocumento(oDocumentoDTO);
        }
Пример #9
0
 public void Actualiza(DocumentoBE pItem)
 {
     try
     {
         DocumentoDL Documento = new DocumentoDL();
         Documento.Actualiza(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
Пример #10
0
 public void Inserta(DocumentoBE pItem)
 {
     try
     {
         DocumentoDL Documento = new DocumentoDL();
         Documento.Inserta(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
Пример #11
0
        public eEstadoProceso GuardarDocumento(
            DocumentoBE oDocumentoDTO)
        {
            //GUARDA CABECERA
            string codigodocumentogenerado = "";
            var    ConnectionString        = @"Data Source=.;Initial Catalog=NorthWind;Integrated Security=SSPI";

            using (var conn = new SqlConnection(ConnectionString))
            {
                conn.Open();
                using (var cmd = new SqlCommand("GuardarCab", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@codcliente", SqlDbType.Int).Value             = oDocumentoDTO.Cabecera.Cliente.CodCliente;
                    cmd.Parameters.Add("@subtotal", SqlDbType.Int).Value               = oDocumentoDTO.Cabecera.SubTotal;
                    cmd.Parameters.Add("@igv", SqlDbType.Int).Value                    = oDocumentoDTO.Cabecera.IGV;
                    cmd.Parameters.Add("@total", SqlDbType.Int, 50).Value              = oDocumentoDTO.Cabecera.Total;
                    cmd.Parameters.Add("@fechahora", SqlDbType.SmallDateTime).Value    = oDocumentoDTO.Cabecera.FechaHora;
                    cmd.Parameters.Add("@tipodocumento", SqlDbType.NVarChar, 50).Value = oDocumentoDTO.Cabecera.TipoDocumento.ToString();

                    //cmd.ExecuteNonQuery();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            codigodocumentogenerado = reader["CodigoGenerado"].ToString();
                        }
                    }
                }

                //GUARDA DETALLE
                foreach (var itemlista in oDocumentoDTO.Detalle)
                {
                    using (SqlCommand command = new SqlCommand("GuardarDET", conn))
                    {
                        command.CommandType = CommandType.StoredProcedure;

                        command.Parameters.Add("@coddocumento", SqlDbType.Int).Value = codigodocumentogenerado;
                        command.Parameters.Add("@codproducto", SqlDbType.Int).Value  = itemlista.Producto.CodProducto;
                        command.Parameters.Add("@precio", SqlDbType.Int).Value       = itemlista.Precio;
                        command.Parameters.Add("@cantidad", SqlDbType.Int).Value     = itemlista.Cantidad;
                        command.Parameters.Add("@total", SqlDbType.Decimal).Value    = itemlista.Total;

                        command.ExecuteNonQuery();
                    }
                }
                conn.Close();
            }

            return(eEstadoProceso.Correcto);

            //Si todo esta OK se guarda como Correcto
            //return eEstadoProceso.Correcto;
        }
Пример #12
0
 public DocumentoBE Selecciona(int IdDocumento)
 {
     try
     {
         DocumentoDL Documento = new DocumentoDL();
         DocumentoBE objEmp    = Documento.Selecciona(IdDocumento);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
Пример #13
0
        public List <DocumentoBE> ListaTodosActivo(int IdEmpresa, int IdCarpeta)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnSSOMABD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Documento_ListaTodosActivo");

            db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, IdEmpresa);
            db.AddInParameter(dbCommand, "pIdCarpeta", DbType.Int32, IdCarpeta);

            IDataReader        reader        = db.ExecuteReader(dbCommand);
            List <DocumentoBE> Documentolist = new List <DocumentoBE>();
            DocumentoBE        Documento;

            while (reader.Read())
            {
                Documento             = new DocumentoBE();
                Documento.IdDocumento = Int32.Parse(reader["idDocumento"].ToString());
                Documento.IdEmpresa   = Int32.Parse(reader["IdEmpresa"].ToString());
                Documento.RazonSocial = reader["RazonSocial"].ToString();
                Documento.IdCarpeta   = Int32.Parse(reader["IdCarpeta"].ToString());
                Documento.DescCarpeta = reader["DescCarpeta"].ToString();
                //Documento.Archivo = (byte[])reader["Archivo"];
                Documento.Ruta                         = reader["Ruta"].ToString();
                Documento.Codigo                       = reader["Codigo"].ToString();
                Documento.NombreArchivo                = reader["NombreArchivo"].ToString();
                Documento.Revision                     = reader["Revision"].ToString();
                Documento.FechaAprobacion              = DateTime.Parse(reader["FechaAprobacion"].ToString());
                Documento.FlagContabilidad             = Boolean.Parse(reader["FlagContabilidad"].ToString());
                Documento.FlagSistemas                 = Boolean.Parse(reader["FlagSistemas"].ToString());
                Documento.FlagLegal                    = Boolean.Parse(reader["FlagLegal"].ToString());
                Documento.FlagTesoreria                = Boolean.Parse(reader["FlagTesoreria"].ToString());
                Documento.FlagAtraccion                = Boolean.Parse(reader["FlagAtraccion"].ToString());
                Documento.FlagAdministracion           = Boolean.Parse(reader["FlagAdministracion"].ToString());
                Documento.FlagComercial                = Boolean.Parse(reader["FlagComercial"].ToString());
                Documento.FlagDesarrolloNegocio        = Boolean.Parse(reader["FlagDesarrolloNegocio"].ToString());
                Documento.FlagControlGestion           = Boolean.Parse(reader["FlagControlGestion"].ToString());
                Documento.FlagAlmacen                  = Boolean.Parse(reader["FlagAlmacen"].ToString());
                Documento.FlagDespacho                 = Boolean.Parse(reader["FlagDespacho"].ToString());
                Documento.FlagGerenciaGeneral          = Boolean.Parse(reader["FlagGerenciaGeneral"].ToString());
                Documento.FlagMarketing                = Boolean.Parse(reader["FlagMarketing"].ToString());
                Documento.FlagOperacion                = Boolean.Parse(reader["FlagOperacion"].ToString());
                Documento.FlagProyecto                 = Boolean.Parse(reader["FlagProyecto"].ToString());
                Documento.FlagServicioGeneral          = Boolean.Parse(reader["FlagServicioGeneral"].ToString());
                Documento.FlagPlaneamiento             = Boolean.Parse(reader["FlagPlaneamiento"].ToString());
                Documento.FlagCompensacion             = Boolean.Parse(reader["FlagCompensacion"].ToString());
                Documento.FlagBienestar                = Boolean.Parse(reader["FlagBienestar"].ToString());
                Documento.FlagAlquiler                 = Boolean.Parse(reader["FlagAlquiler"].ToString());
                Documento.FlagDesarrolloOrganizacional = Boolean.Parse(reader["FlagDesarrolloOrganizacional"].ToString());
                Documento.FlagEstado                   = Boolean.Parse(reader["flagestado"].ToString());
                Documentolist.Add(Documento);
            }
            reader.Close();
            reader.Dispose();
            return(Documentolist);
        }
Пример #14
0
        public void Elimina(DocumentoBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnSSOMABD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Documento_Elimina");

            db.AddInParameter(dbCommand, "pIdDocumento", DbType.Int32, pItem.IdDocumento);
            db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, pItem.IdEmpresa);
            db.AddInParameter(dbCommand, "pUsuario", DbType.String, pItem.Usuario);
            db.AddInParameter(dbCommand, "pMaquina", DbType.String, pItem.Maquina);

            db.ExecuteNonQuery(dbCommand);
        }
Пример #15
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            DataSet     ds          = new DataSet();
            DocumentoBE DocumentoBE = new DocumentoBE()
            {
                OPCION     = 1,
                USUARIO    = General.General.GetUsuario,
                vDocumento = TextBoxX1.Text.Trim()
            };

            ds = DocumentoBL.ProcesarDocumento(DocumentoBE);
            dgvDocumento.DataSource = ds.Tables[0];
        }
Пример #16
0
        public static void ActualizarDocumento(DocumentoBE Documento)
        {
            DBBaseDatos baseDatosDA = new DBBaseDatos();

            baseDatosDA.Configurar();
            baseDatosDA.Conectar();
            try
            {
                baseDatosDA.ComenzarTransaccion();

                #region Insertamos los detalles
                foreach (DocumentoDetalleBE item in Documento.Detalles)
                {
                    DocumentoDetalleBL.ActualizarDocumentoDetalle(item, baseDatosDA);
                }
                #endregion

                #region Actualizamos los equipamientos
                foreach (DocumentoEquipamientoBE item in Documento.Equipamientos)
                {
                    DocumentoEquipamientoBL.ActualizarDocumentoEquipamiento(item, baseDatosDA);
                }
                #endregion

                #region Actualizamos los materiales
                foreach (DocumentoMaterialBE item in Documento.Materiales)
                {
                    DocumentoMaterialBL.ActualizarDocumentoMaterial(item, baseDatosDA);
                }
                #endregion

                #region Actualizamos las Mediciones de enlaces de propagación
                foreach (DocumentoMedicionEnlacePropagacionBE item in Documento.MedicionesEnlacePropagacion)
                {
                    DocumentoMedicionEnlacePropagacionBL.ActualizarDocumentoMedicionEnlacePropagacion(item, baseDatosDA);
                }
                #endregion

                baseDatosDA.ConfirmarTransaccion();
            }
            catch (Exception ex)
            {
                baseDatosDA.CancelarTransaccion();
                throw ex;
            }
            finally
            {
                baseDatosDA.Desconectar();
                baseDatosDA = null;
            }
        }
Пример #17
0
        private void frmManDocumentoEdit_Load(object sender, EventArgs e)
        {
            BSUtils.LoaderLook(cboCarpeta, new CarpetaBL().ListaTodosActivo(0), "DescCarpeta", "IdCarpeta", true);
            cboCarpeta.EditValue       = IdCarpeta;
            deFechaAprobacion.DateTime = DateTime.Now;

            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Documento - Nuevo";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Documento - Modificar";
                DocumentoBE objE_Documento = null;
                objE_Documento = new DocumentoBL().Selecciona(IdDocumento);
                if (objE_Documento != null)
                {
                    IdDocumento          = objE_Documento.IdDocumento;
                    cboCarpeta.EditValue = objE_Documento.IdCarpeta;

                    strRuta                          = objE_Documento.Ruta;
                    txtCodigo.Text                   = objE_Documento.Codigo;
                    byteArchivo                      = objE_Documento.Archivo;
                    txtNombreArchivo.Text            = objE_Documento.NombreArchivo;
                    txtRevision.Text                 = objE_Documento.Revision;
                    deFechaAprobacion.EditValue      = objE_Documento.FechaAprobacion;
                    chkFlagContabilidad.Checked      = objE_Documento.FlagContabilidad;
                    chkFlagSistemas.Checked          = objE_Documento.FlagSistemas;
                    chkFlagLegal.Checked             = objE_Documento.FlagContabilidad;
                    chkFlagTesoreria.Checked         = objE_Documento.FlagTesoreria;
                    chkFlagAtraccion.Checked         = objE_Documento.FlagAtraccion;
                    chkFlagAdministracion.Checked    = objE_Documento.FlagAdministracion;
                    chkFlagComercial.Checked         = objE_Documento.FlagComercial;
                    chkFlagDesarrolloNegocio.Checked = objE_Documento.FlagDesarrolloNegocio;
                    chkFlagControlGestion.Checked    = objE_Documento.FlagControlGestion;
                    chkFlagAlmacen.Checked           = objE_Documento.FlagAlmacen;
                    chkFlagDespacho.Checked          = objE_Documento.FlagDespacho;
                    chkFlagGerenciaGeneral.Checked   = objE_Documento.FlagGerenciaGeneral;
                    chkFlagMarketing.Checked         = objE_Documento.FlagMarketing;
                    chkFlagOperacion.Checked         = objE_Documento.FlagOperacion;
                    chkFlagProyecto.Checked          = objE_Documento.FlagProyecto;
                    chkFlagServicioGeneral.Checked   = objE_Documento.FlagServicioGeneral;
                    chkFlagPlaneamiento.Checked      = objE_Documento.FlagPlaneamiento;
                    chkFlagCompensacion.Checked      = objE_Documento.FlagCompensacion;
                    chkFlagBienestar.Checked         = objE_Documento.FlagBienestar;
                    chkFlagAlquileres.Checked        = objE_Documento.FlagAlquiler;
                }
            }

            btnBucarPdf.Select();
        }
Пример #18
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtDocumento.Text.Trim()))
                {
                    MessageBox.Show("Se debe Ingresar un Documento", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (string.IsNullOrEmpty(txtAbreviatura.Text.Trim()))
                {
                    MessageBox.Show("Se debe Ingresar una Abreviatura", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string FlgFisicoElectronico = string.Empty;
                if (rdbFisico.Checked)
                {
                    FlgFisicoElectronico = "1";
                }
                else if (rdbElectronico.Checked)
                {
                    FlgFisicoElectronico = "2";
                }

                DocumentoBE DocumentoBE = new DocumentoBE()
                {
                    OPCION               = 2,
                    USUARIO              = General.General.GetUsuario,
                    IdDocumento          = txtCodigo.Text.Trim(),
                    vDocumento           = txtDocumento.Text.Trim(),
                    cAbreviatura         = txtAbreviatura.Text.Trim(),
                    vMascara             = txtMascara.Text.Trim(),
                    bTituloValor         = CheckTituloValor.Checked == true ? true : false,
                    FlgFisicoElectronico = FlgFisicoElectronico,
                    FlgImportePago       = chkFlgImportePago.Checked == true ? "1" : "0",
                };

                DocumentoBL.ProcesarDocumento(DocumentoBE);
                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void LlenarCombos()
        {
            try
            {
                DocumentoBE oEntity = new DocumentoBE()
                {
                    OPCION  = 1,
                    USUARIO = General.General.GetUsuario
                };

                General.General.LlenarCombobox(cboIdDocumento, "vDocumento", "IdDocumento", new DocumentoBL().ProcesarDocumento(oEntity).Tables[0]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void InicializarModificar()
        {
            if (gvDocumento.RowCount > 0)
            {
                int         intIdDocumento = int.Parse(gvDocumento.GetFocusedRowCellValue("IdDocumento").ToString());
                DocumentoBE objSSOMA       = null;
                objSSOMA = new DocumentoBL().Selecciona(intIdDocumento);
                if (objSSOMA != null)
                {
                    string sFilePath = "";
                    byte[] Buffer;

                    Buffer = objSSOMA.Archivo;

                    sFilePath = Path.GetTempFileName();
                    File.Move(sFilePath, Path.ChangeExtension(sFilePath, ".pdf"));
                    sFilePath = Path.ChangeExtension(sFilePath, ".pdf");
                    File.WriteAllBytes(sFilePath, Buffer);

                    ProcessStartInfo start = new ProcessStartInfo();
                    //start.UseShellExecute = false;
                    // Enter in the command line arguments, everything you would enter after the executable name itself
                    start.Arguments = sFilePath + " 1";
                    // Enter the executable to run, including the complete path
                    start.FileName = Path.Combine(Directory.GetCurrentDirectory(), "Pdf\\PdfiumViewer.Demo.exe");
                    // Do you want to show a console window?
                    start.WindowStyle    = ProcessWindowStyle.Hidden;
                    start.CreateNoWindow = true;
                    int exitCode;

                    // Run the external process & wait for it to finish
                    using (Process proc = Process.Start(start))
                    {
                        proc.WaitForExit();

                        // Retrieve the app's exit code
                        exitCode = proc.ExitCode;
                    }
                }
            }
            else
            {
                MessageBox.Show("No se pudo editar");
            }
        }
Пример #21
0
        private void LlenarCombos()
        {
            DocumentoBE DocumentoBE = new DocumentoBE()
            {
                OPCION  = 1,
                USUARIO = General.General.GetCodigoUsuario
            };

            General.General.LlenarCombobox(cboIdDocumento, "vDocumento", "IdDocumento", DocumentoBL.ProcesarDocumento(DocumentoBE).Tables[0]);
            //cboIdDocumento.DataSource = DocumentoBL.ProcesarDocumento(DocumentoBE).Tables[0];
            //cboIdDocumento.DisplayMember = "vDocumento";
            //cboIdDocumento.ValueMember = "IdDocumento";

            String      Table_Id    = "00012";
            TableBaseBE TableBaseBE = new TableBaseBE()
            {
                OPCION          = 1,
                USUARIO         = General.General.GetCodigoUsuario,
                Table_Parent_Id = Table_Id
            };

            General.General.LlenarCombobox(cboIdFormaPago_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "00433"; //Tipo Confirmacion
            General.General.LlenarCombobox(cboIdTipoConfirmacion_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "00999"; //Tipo Transferencia Titularidad
            General.General.LlenarCombobox(cboIdTipoTransferencia_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "01003"; //Tipo Carta/Documentos Pagadora
            General.General.LlenarCombobox(cboIdTipoCartaP_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "01003"; //Tipo Carta/Documentos Pagadora
            General.General.LlenarCombobox(cboIdTipoCartaE_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "01057"; //Frecuencia
            General.General.LlenarCombobox(cboIdFrecuencia_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            TableBaseBE.Table_Parent_Id = "01060"; //Días de Pago Frecuencia
            General.General.LlenarCombobox(cboIdDiasPagoFrecuencia_tt, "Table_Name", "Table_Id", TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0]);

            //cboIdFormaPago_tt.DataSource = TableBaseBL.ProcesarTableBase(TableBaseBE).Tables[0];
            //cboIdFormaPago_tt.DisplayMember = "Table_Name";
            //cboIdFormaPago_tt.ValueMember = "Table_Id";
        }
        private void btnAsignar_Click(object sender, EventArgs e)
        {
            try
            {
                string strCodigo        = "";
                string strNombreArchivo = "";
                string strRevision      = "";

                var Buscar = mListaDocumentoPersonaOrigen.Where(oB => oB.IdDocumento == Convert.ToInt32(cboDocumento.EditValue)).ToList();
                if (Buscar.Count > 0)
                {
                    XtraMessageBox.Show("No se puede repetir el documento \n Por Favor Verique", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    DocumentoBE objE_Documento = null;
                    objE_Documento = new DocumentoBL().Selecciona(Convert.ToInt32(cboDocumento.EditValue));
                    if (objE_Documento != null)
                    {
                        strCodigo        = objE_Documento.Codigo;
                        strNombreArchivo = objE_Documento.NombreArchivo;
                        strRevision      = objE_Documento.Revision;
                    }
                }

                gvDocumentoPersona.AddNewRow();
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdEmpresa", Parametros.intEmpresaId);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdDocumentoPersona", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdPersona", IdPersona);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdDocumento", Convert.ToInt32(cboDocumento.EditValue));
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Codigo", strCodigo);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "NombreArchivo", strNombreArchivo);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Revision", strRevision);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "FlagImpresion", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Lectura", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "TipoOper", Convert.ToInt32(Operacion.Nuevo));
            }

            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #23
0
        public void GuardarDocumentoFromService(DocumentoBE oDocumentoDTO)
        {
            //Guardar Cabecera
            string codigodocumentogenerado = "";
            //var ConnectionString = @"Data Source=.;Initial Catalog=Northwind;Integrated Security=SSPI";
            string ConnectionString = ConfigurationManager.ConnectionStrings["Northwind"].ToString();

            using (var conn = new SqlConnection(ConnectionString)) {
                conn.Open();
                using (var cmd = new SqlCommand("GuardarCab", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@codcliente", SqlDbType.Int).Value             = oDocumentoDTO.Cabecera.Cliente.CodCliente;
                    cmd.Parameters.Add("@subtotal", SqlDbType.Int).Value               = oDocumentoDTO.Cabecera.SubTotal;
                    cmd.Parameters.Add("@igv", SqlDbType.Int).Value                    = oDocumentoDTO.Cabecera.IGV;
                    cmd.Parameters.Add("@total", SqlDbType.Int, 50).Value              = oDocumentoDTO.Cabecera.Total;
                    cmd.Parameters.Add("@fechahora", SqlDbType.SmallDateTime).Value    = oDocumentoDTO.Cabecera.FechaHora;
                    cmd.Parameters.Add("@tipodocumento", SqlDbType.NVarChar, 50).Value = oDocumentoDTO.Cabecera.TipoDocumento.ToString();
                    //cmd.ExecuteNonQuery()
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        while (reader.Read())
                        {
                            codigodocumentogenerado = reader["CodigoGenerado"].ToString();
                        }
                    }
                }
                //Guarda Detalle
                foreach (var itemlista in oDocumentoDTO.Detalle)
                {
                    using (SqlCommand command = new SqlCommand("GuardarDet", conn)) {
                        command.CommandType = CommandType.StoredProcedure;

                        command.Parameters.Add("@coddocumento", SqlDbType.Int).Value = codigodocumentogenerado;
                        command.Parameters.Add("@codproducto", SqlDbType.Int).Value  = itemlista.Producto.CodProducto;
                        command.Parameters.Add("@precio", SqlDbType.Int).Value       = itemlista.Precio;
                        command.Parameters.Add("@cantidad", SqlDbType.Int).Value     = itemlista.Cantidad;
                        command.Parameters.Add("@total", SqlDbType.Decimal).Value    = itemlista.Total;

                        command.ExecuteNonQuery();
                    }
                }
                conn.Close();
            }
        }
Пример #24
0
        private void CargarDatos()
        {
            try
            {
                DataSet     ds          = new DataSet();
                DocumentoBE DocumentoBE = new DocumentoBE()
                {
                    OPCION      = 1,
                    USUARIO     = General.General.GetUsuario,
                    IdDocumento = txtCodigo.Text.Trim()
                };

                ds = DocumentoBL.ProcesarDocumento(DocumentoBE);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtDocumento.Text           = ds.Tables[0].Rows[0]["vDocumento"].ToString();
                    txtAbreviatura.Text         = ds.Tables[0].Rows[0]["cAbreviatura"].ToString();
                    txtMascara.Text             = ds.Tables[0].Rows[0]["vMascara"].ToString();
                    CheckTituloValor.CheckValue = ds.Tables[0].Rows[0]["bTituloValor"];
                    if (ds.Tables[0].Rows[0]["FlgFisicoElectronico"].ToString().Equals("1"))
                    {
                        rdbFisico.Checked = true;
                    }
                    else if (ds.Tables[0].Rows[0]["FlgFisicoElectronico"].ToString().Equals("2"))
                    {
                        rdbElectronico.Checked = true;
                    }
                    if (ds.Tables[0].Rows[0]["FlgImportePago"].ToString().Equals("1"))
                    {
                        chkFlgImportePago.Checked = true;
                    }
                }
                else
                {
                    MessageBox.Show("Este Documento no Existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #25
0
        public List <DocumentoBE> ListaCombo()
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnSSOMABD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Documento_ListaCombo");

            IDataReader        reader        = db.ExecuteReader(dbCommand);
            List <DocumentoBE> Documentolist = new List <DocumentoBE>();
            DocumentoBE        Documento;

            while (reader.Read())
            {
                Documento               = new DocumentoBE();
                Documento.IdDocumento   = Int32.Parse(reader["idDocumento"].ToString());
                Documento.NombreArchivo = reader["NombreArchivo"].ToString();
                Documentolist.Add(Documento);
            }
            reader.Close();
            reader.Dispose();
            return(Documentolist);
        }
Пример #26
0
        public void Actualiza(DocumentoBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnSSOMABD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Documento_Actualiza");

            db.AddInParameter(dbCommand, "pIdDocumento", DbType.Int32, pItem.IdDocumento);
            db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, pItem.IdEmpresa);
            db.AddInParameter(dbCommand, "pIdCarpeta", DbType.Int32, pItem.IdCarpeta);
            db.AddInParameter(dbCommand, "pArchivo", DbType.Binary, pItem.Archivo);
            db.AddInParameter(dbCommand, "pRuta", DbType.String, pItem.Ruta);
            db.AddInParameter(dbCommand, "pCodigo", DbType.String, pItem.Codigo);
            db.AddInParameter(dbCommand, "pNombreArchivo", DbType.String, pItem.NombreArchivo);
            db.AddInParameter(dbCommand, "pRevision", DbType.String, pItem.Revision);
            db.AddInParameter(dbCommand, "pFechaAprobacion", DbType.DateTime, pItem.FechaAprobacion);
            db.AddInParameter(dbCommand, "pFlagContabilidad", DbType.Boolean, pItem.FlagContabilidad);
            db.AddInParameter(dbCommand, "pFlagSistemas", DbType.Boolean, pItem.FlagSistemas);
            db.AddInParameter(dbCommand, "pFlagLegal", DbType.Boolean, pItem.FlagLegal);
            db.AddInParameter(dbCommand, "pFlagTesoreria", DbType.Boolean, pItem.FlagTesoreria);
            db.AddInParameter(dbCommand, "pFlagAtraccion", DbType.Boolean, pItem.FlagAtraccion);
            db.AddInParameter(dbCommand, "pFlagAdministracion", DbType.Boolean, pItem.FlagAdministracion);
            db.AddInParameter(dbCommand, "pFlagComercial", DbType.Boolean, pItem.FlagComercial);
            db.AddInParameter(dbCommand, "pFlagDesarrolloNegocio", DbType.Boolean, pItem.FlagDesarrolloNegocio);
            db.AddInParameter(dbCommand, "pFlagControlGestion", DbType.Boolean, pItem.FlagControlGestion);
            db.AddInParameter(dbCommand, "pFlagAlmacen", DbType.Boolean, pItem.FlagAlmacen);
            db.AddInParameter(dbCommand, "pFlagDespacho", DbType.Boolean, pItem.FlagDespacho);
            db.AddInParameter(dbCommand, "pFlagGerenciaGeneral", DbType.Boolean, pItem.FlagGerenciaGeneral);
            db.AddInParameter(dbCommand, "pFlagMarketing", DbType.Boolean, pItem.FlagMarketing);
            db.AddInParameter(dbCommand, "pFlagOperacion", DbType.Boolean, pItem.FlagOperacion);
            db.AddInParameter(dbCommand, "pFlagProyecto", DbType.Boolean, pItem.FlagProyecto);
            db.AddInParameter(dbCommand, "pFlagServicioGeneral", DbType.Boolean, pItem.FlagServicioGeneral);
            db.AddInParameter(dbCommand, "pFlagPlaneamiento", DbType.Boolean, pItem.FlagPlaneamiento);
            db.AddInParameter(dbCommand, "pFlagCompensacion", DbType.Boolean, pItem.FlagCompensacion);
            db.AddInParameter(dbCommand, "pFlagBienestar", DbType.Boolean, pItem.FlagBienestar);
            db.AddInParameter(dbCommand, "pFlagAlquiler", DbType.Boolean, pItem.FlagAlquiler);
            db.AddInParameter(dbCommand, "pFlagDesarrolloOrganizacional", DbType.Boolean, pItem.FlagDesarrolloOrganizacional);
            db.AddInParameter(dbCommand, "pFlagEstado", DbType.Boolean, pItem.FlagEstado);
            db.AddInParameter(dbCommand, "pUsuario", DbType.String, pItem.Usuario);
            db.AddInParameter(dbCommand, "pMaquina", DbType.String, pItem.Maquina);

            db.ExecuteNonQuery(dbCommand);
        }
Пример #27
0
        public string insertDocumento(DocumentoBE pDocumentoBE)
        {
            string idDocumento = string.Empty;

            using (DbCommand cmd = dbAdeudosInversiones.GetStoredProcCommand(GetNameStoreProcedure.uspInsertDocumento))
            {
                //cmd.CommandTimeout = 0;
                dbAdeudosInversiones.AddInParameter(cmd, "idInversion", DbType.String, pDocumentoBE.idInversion);
                dbAdeudosInversiones.AddInParameter(cmd, "ruta", DbType.String, pDocumentoBE.ruta);
                dbAdeudosInversiones.AddInParameter(cmd, "extension", DbType.String, pDocumentoBE.nombre.Substring(pDocumentoBE.nombre.LastIndexOf("."), pDocumentoBE.nombre.Length - pDocumentoBE.nombre.LastIndexOf(".")));
                dbAdeudosInversiones.AddInParameter(cmd, "observaciones", DbType.String, pDocumentoBE.observaciones);
                dbAdeudosInversiones.AddOutParameter(cmd, "idDocumento", DbType.String, 10);

                dbAdeudosInversiones.ExecuteNonQuery(cmd);

                if (dbAdeudosInversiones.GetParameterValue(cmd, "idDocumento") != DBNull.Value)
                {
                    idDocumento = dbAdeudosInversiones.GetParameterValue(cmd, "idDocumento").ToString();
                }

                return(idDocumento);
            }
        }
Пример #28
0
        public DataSet ProcesarDocumento(DocumentoBE BE)
        {
            DataSet dsResult;

            try
            {
                cmd = db.GetStoredProcCommand("Documento_Mnt");
                db.AddInParameter(cmd, "OPCION", DbType.Int32, BE.OPCION);
                db.AddInParameter(cmd, "USUARIO", DbType.String, BE.USUARIO);
                db.AddInParameter(cmd, "IdDocumento", DbType.String, BE.IdDocumento);
                db.AddInParameter(cmd, "vDocumento", DbType.String, BE.vDocumento);
                db.AddInParameter(cmd, "cAbreviatura", DbType.String, BE.cAbreviatura);
                db.AddInParameter(cmd, "vMascara", DbType.String, BE.vMascara);
                db.AddInParameter(cmd, "bTituloValor", DbType.Boolean, BE.bTituloValor);
                db.AddInParameter(cmd, "FlgFisicoElectronico", DbType.String, BE.FlgFisicoElectronico);
                db.AddInParameter(cmd, "FlgImportePago", DbType.String, BE.FlgImportePago);
                dsResult = db.ExecuteDataSet(cmd);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(dsResult);
        }
Пример #29
0
 public DataSet ProcesarDocumento(DocumentoBE BE)
 {
     return(DocumentoDA.ProcesarDocumento(BE));
 }
Пример #30
0
        private void tvwDatos_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                int         intIdDocumento = Convert.ToInt32(e.Node.Tag.ToString().Substring(3, e.Node.Tag.ToString().Length - 3));
                DocumentoBE objSSOMA       = null;
                objSSOMA = new DocumentoBL().Selecciona(intIdDocumento);
                if (objSSOMA != null)
                {
                    string sFilePath = "";
                    byte[] Buffer;

                    Buffer = objSSOMA.Archivo;

                    sFilePath = Path.GetTempFileName();
                    File.Move(sFilePath, Path.ChangeExtension(sFilePath, ".pdf"));
                    sFilePath = Path.ChangeExtension(sFilePath, ".pdf");
                    File.WriteAllBytes(sFilePath, Buffer);

                    ProcessStartInfo start = new ProcessStartInfo();
                    // Enter in the command line arguments, everything you would enter after the executable name itself

                    List <DocumentoPersonaBE> lstDocumentoPersona = null;
                    lstDocumentoPersona = new DocumentoPersonaBL().ListaTodosActivo(0, Parametros.intPersonaId, intIdDocumento);
                    if (lstDocumentoPersona.Count > 0)
                    {
                        if (lstDocumentoPersona[0].FlagImpresion)
                        {
                            start.Arguments = sFilePath + " 1";
                        }
                        else
                        {
                            start.Arguments = sFilePath + " 0";
                        }
                    }

                    // Enter the executable to run, including the complete path
                    start.FileName = Path.Combine(Directory.GetCurrentDirectory(), "Pdf\\PdfiumViewer.Demo.exe");
                    // Do you want to show a console window?
                    start.WindowStyle    = ProcessWindowStyle.Hidden;
                    start.CreateNoWindow = true;
                    int exitCode;

                    // Run the external process & wait for it to finish
                    using (Process proc = Process.Start(start))
                    {
                        proc.WaitForExit();

                        // Retrieve the app's exit code
                        exitCode = proc.ExitCode;
                    }

                    //ACTUALIZA LA LECTURA DE LOS DOCUMENTOS POR PERSONA
                    DocumentoPersonaBL objBL_DocumentoPersona = new DocumentoPersonaBL();
                    objBL_DocumentoPersona.ActualizaLectura(Parametros.intPersonaId, intIdDocumento);
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }