Пример #1
0
 private void CargarEmpresaFormulario(Daiko_UC.Models.Empresa empresa)
 {
     txtRazonSocial.Text     = empresa.Razon_social;
     txtNombreComercial.Text = empresa.Nombre_comercial;
     txtCif.Text             = empresa.Cif;
     txtCodigoPostal.Text    = empresa.Codigo_postal;
     txtDireccionFiscal.Text = empresa.Direccion_fiscal;
     txtTelefono.Text        = empresa.Telefono;
     txtFax.Text             = empresa.Fax;
 }
Пример #2
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            SetEnabledFormulario(true);

            Daiko_BLL.Daiko_BLL     oDaikoBLL = new Daiko_BLL.Daiko_BLL();
            Daiko_UC.Models.Empresa empresa   = oDaikoBLL.ObtenerDatosEmpresa();
            CargarEmpresaFormulario(empresa);

            if (empresa.Logo.Length > 1)
            {
                pictureBoxLogo.Image = ByteArrayToImagen(empresa.Logo);
            }
        }
Пример #3
0
        private void btnAceptar_Click_1(object sender, EventArgs e)
        {
            Daiko_BLL.Daiko_BLL oDaikoBLL = new Daiko_BLL.Daiko_BLL();

            if (ValidarEmpresa())
            {
                if (txtUrlLogo.Text.Trim() != "")
                {
                    logoBytes = ImagenToByteArray(urlArchivo);
                }

                if (IsModoCrear())
                {
                    Daiko_UC.Models.Empresa nuevaEmpresa = new Daiko_UC.Models.Empresa(txtRazonSocial.Text, txtNombreComercial.Text, txtCif.Text, txtCodigoPostal.Text, txtDireccionFiscal.Text, txtTelefono.Text, txtFax.Text, logoBytes);

                    if (oDaikoBLL.InsertarEmpresa(nuevaEmpresa) == 1)
                    {
                        MessageBox.Show("Empresa añadida con exito");
                        LimpiarFormConfiguracionEmpresa();
                        SetModoEditar();
                        pictureBoxLogo.Image = Image.FromFile("..\\..\\..\\Resources\\Icons\\TU_LOGO.png");
                        SetEnabledFormulario(false);
                    }
                    else
                    {
                        MessageBox.Show("Se ha producido un error al insertar la empresa");
                    }
                }
                else if (IsModoEditar())
                {
                    Daiko_UC.Models.Empresa empresaActualizada = new Daiko_UC.Models.Empresa(txtRazonSocial.Text, txtNombreComercial.Text, txtCif.Text, txtDireccionFiscal.Text, txtCodigoPostal.Text, txtTelefono.Text, txtFax.Text, logoBytes);

                    if (oDaikoBLL.ActualizarEmpresa(empresaActualizada) == 1)
                    {
                        MessageBox.Show("Empresa actualizada con exito");
                        LimpiarFormConfiguracionEmpresa();
                        pictureBoxLogo.Image = Image.FromFile("..\\..\\..\\Resources\\Icons\\TU_LOGO.png");
                        SetEnabledFormulario(false);
                    }
                    else
                    {
                        MessageBox.Show("Se ha producido un error al actualizar la empresa");
                    }
                }
            }
        }
Пример #4
0
        private void CargarInfoEmpresa()
        {
            //COMPROBAR SI HAY EMPRESA
            //SI HAY CARGAR LOGO Y NOMBRE
            //SI NO DEJAR EN BLANCO
            Daiko_BLL.Daiko_BLL oDaikoBLL = new Daiko_BLL.Daiko_BLL();

            if (oDaikoBLL.ExisteEmpresa())
            {
                Daiko_UC.Models.Empresa empresa = oDaikoBLL.ObtenerDatosEmpresa();
                labelNombreEmpresa.Text = empresa.Nombre_comercial;

                if (empresa.Logo.Length > 1)
                {
                    imgLogo.Image = ByteArrayToImagen(empresa.Logo);
                }
            }
        }