Пример #1
0
        public bool EliminarFotoGaleria(int IdFoto)
        {
            GI.BR.Propiedades.Galeria.Foto foto = new GI.BR.Propiedades.Galeria.Foto();
            foto.IdFoto = IdFoto;

            return foto.Eliminar();
        }
Пример #2
0
        public GI.BR.Propiedades.Galeria.Foto AgregarFotoAGaleria(Bitmap Original, string Nombre, bool EsFachada, GI.BR.Propiedades.Propiedad p)
        {
            // Creamos la foto y generamos la transaccion correspondiente

            try
            {
                GI.BR.Propiedades.Galeria.Foto Foto = new GI.BR.Propiedades.Galeria.Foto();
                Foto.Descripcion = Nombre;
                Foto.EsFachada = EsFachada;
                Foto.Imagen = ResizeFromStream(Original);

                if (EsFachada)
                {
                    foreach (GI.BR.Propiedades.Galeria.Foto f in p.GaleriaFotos)
                    {
                        if (f.EsFachada)
                        {
                            EliminarFotoGaleria(f, p);
                            break;
                        }
                    }
                }

                if (!Foto.Guardar(p))
                    throw new Exception();

                if (!p.EsOtraInmobiliaria)
                {
                    GI.BR.Propiedades.Tranasacciones.TransaccionFotoPropiedad trans = new GI.BR.Propiedades.Tranasacciones.TransaccionFotoPropiedad();
                    trans.Activa = true;
                    trans.Estado = GI.BR.Propiedades.Tranasacciones.EnumEstadoTrans.Pendiente;
                    trans.Fecha = DateTime.Now;
                    trans.Foto = Foto;
                    trans.IdFoto = Foto.IdFoto;
                    trans.IdPropiedad = p.IdPropiedad;
                    trans.TipoTransaccion = GI.BR.Propiedades.Tranasacciones.EnumTipoTransaccion.Crear;
                    trans.Crear();
                }

                return Foto;
            }
            catch
            {
                return null;
            }
        }
Пример #3
0
        private void bAceptar_Click(object sender, EventArgs e)
        {
            if (openFileDialog.FileName == "")
            {
                Framework.General.GIMsgBox.Show("Debe seleccionar una imagen", GI.Framework.General.enumTipoMensaje.Error);
                return;
            }

            if (textBoxNombre.Text == "")
            {
                Framework.General.GIMsgBox.Show("Debe ingresar un descripción", GI.Framework.General.enumTipoMensaje.Error);
                return;
            }

            Foto = new GI.BR.Propiedades.Galeria.Foto();
            Foto.Descripcion = textBoxNombre.Text;
            Foto.EsFachada = checkBoxEsFechada.Checked;
            Foto.Imagen = new Bitmap(textBoxUrlFoto.Text);

            GI.Managers.Propiedades.MngPropiedades mngProp = new GI.Managers.Propiedades.MngPropiedades();
            GI.Managers.Propiedades.MngGaleriaFotos mng = new GI.Managers.Propiedades.MngGaleriaFotos();
            if ((Foto = mng.AgregarFotoAGaleria(new Bitmap(textBoxUrlFoto.Text), textBoxNombre.Text, checkBoxEsFechada.Checked, propiedad)) != null)
            {

                if (checkBoxCargarambiente.Checked)
                {
                    propiedad.Medidas.Add(medida);
                    mngProp.ActualizarPropiedad(propiedad);
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                Framework.General.GIMsgBox.Show("No se posible guardar la foto. Verifique los datos ingresados.", GI.Framework.General.enumTipoMensaje.Error);
            }
        }