Esempio n. 1
0
        private void Aplicar()
        {
            try
            {
                App_Code.Configuracion.Empresa    oRegistro = new App_Code.Configuracion.Empresa(empresa);
                App_Code.Sistema.Sistema_Empresas oEmpresa  = new App_Code.Sistema.Sistema_Empresas(oRegistro.Id);

                oEmpresa.Nombre = this.txtNombre.Text;

                oRegistro.Pais                = this.txtPais.Text.ToString().ToUpper();
                oRegistro.Estado              = this.txtEstado.Text.ToString().ToUpper();
                oRegistro.Municipio           = this.txtMunicipio.Text.ToString().ToUpper();
                oRegistro.Parroquia           = this.txtParroquia.Text.ToString().ToUpper();
                oRegistro.Nombre              = this.txtNombre.Text;
                oRegistro.Direccion           = this.txtDomicilio.Text.ToString().ToUpper();
                oRegistro.Denominacion_Social = this.txtDenominacion.Text.ToString().ToUpper();
                oRegistro.Rif              = this.txtRif.Text.ToString().ToUpper();
                oRegistro.Telefono         = this.txtTelOfi.Text;
                oRegistro.TelefonoCel      = this.txtTelCel.Text;
                oRegistro.Sucursal         = this.txtNombreSuc.Text;
                oRegistro.Cod_Sucursal     = this.txtCodigoSuc.Text.ToString().ToUpper();
                oRegistro.Contacto         = this.txtNombreContacto.Text.ToString().ToUpper();
                oRegistro.TelefonoContacto = this.txtTelContacto.Text;
                oRegistro.Fax              = this.txtFax.Text;
                oRegistro.Email            = this.txtEmail.Text;
                oRegistro.WebSite          = this.txtWeb.Text;
                oRegistro.Registro         = this.txtRegistro.Text;
                oRegistro.Codigo           = this.txtCodigo.Text.ToString().ToUpper();
                oRegistro.Ciudad           = this.txtCiudad.Text.ToString().ToUpper();
                oRegistro.Cod_Postal       = this.txtCodPostal.Text;
                oRegistro.Retencion_Iva    = decimal.Parse(this.txtRetencionIva.Text.ToString());
                oRegistro.Retencion_Islr   = decimal.Parse(this.txtRetencionIslr.Text.ToString());
                oRegistro.Factor_Cambio    = decimal.Parse(this.txtFactor.Text.ToString());
                oRegistro.Debito_Bancario  = decimal.Parse(this.txtDebito.Text.ToString());
                oRegistro.Imagen           = "";
                oRegistro.Tomo             = this.txtTomo.Text;
                oRegistro.Hoja             = this.txtHoja.Text;
                oRegistro.Folio            = this.txtFolio.Text;
                if (this.lblNombreFoto.Text == "Nombre")
                {
                    oRegistro.Imagen = "Ninguna";
                }
                else
                {
                    oRegistro.Imagen = this.lblNombreFoto.Text;
                }


                if (!Validar())
                {
                    oRegistro.Actualizar();
                    oEmpresa.Actualizar();
                    MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error Al Intentar Guardar", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void dgEmpresas_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                panterasoftware.Formularios.frmPrincipal oInicio  = new panterasoftware.Formularios.frmPrincipal();
                App_Code.Sistema.Sistema_Empresas        oEmpresa = new App_Code.Sistema.Sistema_Empresas(int.Parse(this.dgEmpresas.Rows[int.Parse(e.RowIndex.ToString())].Cells[0].Value.ToString()));

                SqlConnection oConexion = new SqlConnection(oEmpresa.CadenaConexion);
                oConexion.Open();
                if (oConexion.State == ConnectionState.Open)
                {
                    oInicio.CargoDatos(oEmpresa.Codigo);
                    oInicio.Show();
                    this.Close();
                }
            }
            catch (Exception)
            {
                panterasoftware.Formularios.frmPrincipal oInicio  = new panterasoftware.Formularios.frmPrincipal();
                App_Code.Sistema.Sistema_Empresas        oEmpresa = new App_Code.Sistema.Sistema_Empresas(int.Parse(this.dgEmpresas.Rows[int.Parse(e.RowIndex.ToString())].Cells[0].Value.ToString()));
                MessageBox.Show("A ocurrido un fallo al intentar conectar a la base de datos", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Formularios.Configuracion.frmConexionEmpresa oConexion = new Formularios.Configuracion.frmConexionEmpresa();
                Formularios.Configuracion.frmConexionEmpresa.id     = oEmpresa.Id;
                Formularios.Configuracion.frmConexionEmpresa.codigo = oEmpresa.Codigo;
                oConexion.Show();
                this.Hide();
            }
        }
Esempio n. 3
0
        public void CargoDatos(string codigo)
        {
            //Busquedad de los datos de la empresa seleccionada
            DataTable oEmpresa = new App_Code.Sistema.Sistema_Empresas().Buscar(
                1,
                "id,nombre,cadena_conexion,codigo",
                "codigo = '" + codigo + "'",
                "");

            if (oEmpresa.Rows.Count > 0)
            {
                DataRow oRow = oEmpresa.Rows[0];
                conexion = oRow["cadena_conexion"].ToString();
                sql      = oRow["cadena_conexion"].ToString();

                MessageBox.Show("Conexión a Base de Datos Exitosa Bienvenido", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                App_Code.Configuracion.Empresa  oE     = new App_Code.Configuracion.Empresa((string)oRow["codigo"]);
                App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(id_grupo_usuario);
                this.lblGrupo.Text     = oGrupo.Nombre;
                this.lblIdGrupo.Text   = oGrupo.Id.ToString();
                this.lblIdEmpresa.Text = oE.Id.ToString();
                id_empresa             = oE.Id;
                codigo = oE.Codigo.ToString();

                this.Text = oE.Nombre.ToUpper() + " - Rif: " + oE.Rif.ToUpper() + " (" + oE.Codigo.ToString() + ")";
                if (oE.Imagen == "Ninguna" || oE.Imagen == null)
                {
                    this.campoImagen.Image = Properties.Resources.Factory;
                }
                else
                {
                    try
                    {
                        this.campoImagen.Image = Image.FromFile(dest + oE.Imagen);
                    }
                    catch (Exception)
                    {
                        this.campoImagen.Image = Properties.Resources.Factory;
                    }
                }

                this.lblIdU.Text           = id_usuario.ToString();
                this.lblNombreUsuario.Text = usuario;
                this.lblIdEmpresa.Text     = id_empresa.ToString();
            }
        }
Esempio n. 4
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            if (!Validar())
            {
                DataTable oTabla = new App_Code.Sistema.Sistema_Usuarios().Buscar(
                    1,
                    "id,nombre,apellido,grupo_id,empresa_id,estatus",
                    "(usuario = '" + this.txtUsuario.Text + "') AND (clave = '" + this.txtClave.Text + "')",
                    "");
                if (oTabla.Rows.Count > 0)
                {
                    if ((oTabla.Rows[0]["estatus"].ToString()) == "Bloqueado")
                    {
                        MessageBox.Show("Disculpe usuario bloqueado", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        App_Code.Sistema.Sistema_Grupos oGrupo = new App_Code.Sistema.Sistema_Grupos(int.Parse(oTabla.Rows[0]["grupo_id"].ToString()));
                        frmPrincipal.id_usuario       = int.Parse(oTabla.Rows[0]["id"].ToString());
                        frmPrincipal.usuario          = oTabla.Rows[0]["apellido"].ToString().ToUpper() + " " + oTabla.Rows[0]["nombre"].ToString().ToUpper();
                        frmPrincipal.id_grupo_usuario = int.Parse(oTabla.Rows[0]["grupo_id"].ToString());
                        if (oGrupo.Nombre == "Administrador" || oGrupo.Nombre == "Desarrollo")
                        {
                            panterasoftware.Configuracion.frmSelEmpresa oEmpresa = new panterasoftware.Configuracion.frmSelEmpresa();
                            oEmpresa.Show();
                            this.Hide();
                        }
                        else
                        {
                            App_Code.Sistema.Sistema_Empresas oEmpresa = new App_Code.Sistema.Sistema_Empresas(int.Parse(oTabla.Rows[0]["empresa_id"].ToString()));
                            frmPrincipal oPrincipal = new frmPrincipal();
                            frmPrincipal.id_empresa = oEmpresa.Id;
                            frmPrincipal.codigo     = oEmpresa.Codigo;

                            oPrincipal.Show();
                            this.Hide();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Disculpe usuario o contraseña incorrecta", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Esempio n. 5
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (!Validar())
            {
                App_Code.Sistema.Sistema_Empresas oEmpresa = new App_Code.Sistema.Sistema_Empresas(id);
                oEmpresa.CadenaConexion = "" +
                                          "Data Source=" + this.txtServidor.Text + ";" +
                                          "Initial Catalog=" + this.txtBd.Text + ";" +
                                          "User ID=" + this.txtUsuario.Text + ";" +
                                          "Password="******";" +
                                          "Encrypt=False".ToString();
                oEmpresa.Actualizar();
                MessageBox.Show(oEmpresa.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                frmPrincipal oInicio = new frmPrincipal();
                oInicio.CargoDatos(oEmpresa.Codigo);
                oInicio.Refresh();
                oInicio.Show();
                this.Close();
            }
        }