예제 #1
0
        // Cargar Grilla
        private void CargarGrilla()
        {
            try
            {
                List <Plato> listadoPlatos = LogicaPlato.Listar(Convert.ToInt64(ddlCasasPlato.SelectedValue));

                GridPlatos.DataSource = null;

                if (listadoPlatos != null)
                {
                    if (listadoPlatos.Count > 0)
                    {
                        GridPlatos.Visible    = true;
                        GridPlatos.DataSource = listadoPlatos;
                        GridPlatos.DataBind();
                    }

                    else
                    {
                        GridPlatos.Visible = false;
                        lbError.Text       = "No existen platos registrados";
                    }
                }

                else
                {
                    GridPlatos.Visible = false;
                    lbError.Text       = "No existen platos registrados";
                }
            }
            catch (Exception ex)
            {
                lbError.Text = ex.Message; //"Ha ocurrido un error";
            }
        }
예제 #2
0
        // Limpiar carrito
        protected void btLimpiar_Click(object sender, EventArgs e)
        {
            try
            {
                listadoCarrito.Items.Clear();

                List <Plato> listarPlatos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));

                listadoPlatos.DataSource = listarPlatos;
                listadoPlatos.DataBind();

                List <Linea> borrar = new List <Linea>();
                Session["LineaVenta"] = borrar;

                List <Plato> borrar2 = new List <Plato>();
                Session["Carrito"] = borrar2;

                lbCantidad.Text = "0";
                lbError.Text    = "";
            }
            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #3
0
        // Page load
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Carrito"] == null)
                    {
                        List <Plato> linea = new List <Plato>();
                        Session["Carrito"] = linea;
                    }

                    else
                    {
                        List <Plato> linea = (List <Plato>)Session["Carrito"];
                    }

                    if (Session["LineaVenta"] == null)
                    {
                        List <Linea> lineaVenta = new List <Linea>();
                        Session["LineaVenta"] = lineaVenta;
                    }

                    else
                    {
                        List <Linea> lineaVenta = (List <Linea>)Session["LineaVenta"];
                    }

                    Session["Platos"] = listadoPlatos;
                    List <Especializacion> listadoEspecializaciones = new List <Especializacion>(LogicaEspecializacion.Listar());

                    ddlEspecializacion.DataSource = listadoEspecializaciones;
                    ddlEspecializacion.DataBind();

                    List <Casa> listadoCasas = new List <Casa>(LogicaCasa.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue)));
                    Session["Casas"] = listadoCasas;

                    if (listadoCasas.Count > 0)
                    {
                        ddlCasas.DataSource = listadoCasas;
                        ddlCasas.DataBind();
                    }

                    List <Plato> listarPlatos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));
                    Session["Platos"] = listarPlatos;

                    if (listarPlatos.Count > 0)
                    {
                        listadoPlatos.DataSource = listarPlatos;
                        listadoPlatos.DataBind();
                    }
                }

                catch (Exception ex)
                {
                    lbError.Text = ex.Message;
                }
            }
        }
예제 #4
0
        private void loadmenu()
        {
            List <plato> _listaPlato = new List <plato>();

            _listaPlato          = LogicaPlato.getPlato();
            DataList1.DataSource = _listaPlato.Select(data => new
            {
                ID          = data.id_plato,
                Nombre      = data.nombre_plato,
                Descripcion = data.descripcion_plato,
                Precio      = data.precio_plato.ToString("0.00"),
                URL         = data.imagen_plato
            }).ToList();
            DataList1.DataBind();
        }
예제 #5
0
        // Eliminar un plato
        protected void GridPlatos_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                int  resultado  = 0;
                int  IdEliminar = Convert.ToInt32(GridPlatos.Rows[e.RowIndex].Cells[1].Text);
                long rut        = Convert.ToInt64(ddlPlatoBuscar.SelectedValue);

                resultado = LogicaPlato.Eliminar(IdEliminar, rut);

                if (resultado == 1) // ok
                {
                    lbError.Text = "Se ha eliminado el plato.";

                    /* Control para eliminar EDICION del plalto que se esta eliminando*/
                    if (idModificar.Text != null && idModificar.Text != "")
                    {
                        if (Convert.ToInt32(idModificar.Text) == IdEliminar)
                        {
                            idModificar.Text               = "";
                            nombreModificar.Text           = "";
                            ddlCasaModificar.SelectedIndex = 0;
                            precioModificar.Text           = "";
                            btModificar.Visible            = false;
                            foto.Visible = false;
                        }
                    }

                    CargarGrilla();
                }

                else if (resultado == -1)
                {
                    lbError.Text = "No es posible eliminar el plato con pedidos asociados.";
                }

                else
                {
                    GridPlatos.Visible = false;
                    lbError.Text       = "No existen platos registrados.";
                }
            }

            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #6
0
        protected void casaModificar_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Plato plato = new Plato();


                plato.Id     = Convert.ToInt32(idModificar.Text);
                plato.Nombre = nombreModificar.Text;
                plato.Precio = Convert.ToDouble(precioModificar.Text);
                long rut = Convert.ToInt64(ddlPlatoBuscar.SelectedValue);


                if (nombreModificar.Text == "")
                {
                    lbError.Text = ("ERROR: Ingrese un Plato.");
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
                }

                int resultado = LogicaPlato.Modificar(plato, rut);

                if (resultado == 1)
                {
                    lbError.Text = "Plato Modificado";
                    CargarGrilla();

                    //btAgregarModal.Visible = true;
                    //btGuardarModal.Visible = false;
                    btVerificar.Visible = false;

                    // Reseteamos campos
                    idPlato.Text     = "";
                    nombrePlato.Text = "";
                }
                else
                {
                    lbError.Text = "No se pudo modificar";
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
                }
            }

            catch (Exception ex)
            {
                lbError.Text = ex.Message;
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
            }
        }
예제 #7
0
        // Buscar plato
        protected void btVerificar_Click(object sender, EventArgs e)
        {
            try
            {
                List <Plato> listadoPlatos = new List <Plato>();

                if (idPlato.Text != "")
                {
                    Plato plato = LogicaPlato.Buscar(Convert.ToInt32(idPlato.Text), Convert.ToInt64(ddlPlatoBuscar.SelectedValue));

                    if (plato.Id == 0)
                    {
                        GridPlatos.Visible = false;
                        throw new Exception("ERROR: No se encontraron coinciencias");
                    }

                    listadoPlatos.Add(plato);

                    GridPlatos.DataSource = null;

                    if (listadoPlatos != null)
                    {
                        if (listadoPlatos.Count > 0)
                        {
                            GridPlatos.Visible    = true;
                            GridPlatos.DataSource = listadoPlatos;
                            GridPlatos.DataBind();
                            lbError.Text = "";
                        }
                    }

                    else
                    {
                        GridPlatos.Visible = false;
                        lbError.Text       = "No existen platos registrados.";
                    }
                }
                else
                {
                    CargarGrilla();
                }
            }
            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #8
0
        protected void CargarDatosPlato()
        {
            try
            {
                List <Plato> platos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));
                Session["Platos"] = platos;

                foreach (Plato plato in platos)
                {
                    if (plato.Id == Convert.ToInt32(listadoPlatos.SelectedValue))
                    {
                        verPlato.Mostrar(plato);
                    }
                }
            }
            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #9
0
        // DDL Buscar
        protected void ddlPlatoBuscar_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                List <Plato> listadoCasa = LogicaPlato.Listar(Convert.ToInt64(ddlPlatoBuscar.SelectedValue));

                GridPlatos.DataSource = null;

                if (listadoCasa != null)
                {
                    if (listadoCasa.Count > 0)
                    {
                        GridPlatos.Visible    = true;
                        GridPlatos.DataSource = listadoCasa;
                        GridPlatos.DataBind();
                        lbError.Text = "";
                    }

                    else
                    {
                        GridPlatos.Visible    = false;
                        GridPlatos.DataSource = listadoCasa;
                        GridPlatos.DataBind();
                        lbError.Text = "No existen platos registrados";
                    }
                }

                else
                {
                    GridPlatos.Visible    = false;
                    GridPlatos.DataSource = listadoCasa;
                    GridPlatos.DataBind();
                    lbError.Text = "No existen platos registrados";
                }
            }

            catch (Exception ex)
            {
                lbError.Text = "Error :" + ex.Message;
            }
        }
예제 #10
0
        // DDL especializacion
        protected void ddlEspecializacion_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                List <Casa> listadoCasas = new List <Casa>(LogicaCasa.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue)));
                Session["Casas"] = listadoCasas;

                if (listadoCasas.Count > 0)
                {
                    ddlCasas.DataSource = listadoCasas;
                    ddlCasas.DataBind();
                }

                else
                {
                    lbError.Text = "No existen platos para la casa seleccionada..";
                }

                List <Plato> listarPlatos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));
                Session["Platos"] = listadoPlatos;

                if (listarPlatos.Count > 0)
                {
                    listadoPlatos.DataSource = listarPlatos;
                    listadoPlatos.DataBind();
                }

                else
                {
                    listadoPlatos.DataSource = "";
                    listadoPlatos.DataBind();
                    lbError.Text = "No existen platos para la casa seleccionada..";
                }
            }
            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #11
0
        //guardar
        private void savePlato()
        {
            plato _infoPalto = new plato();

            _infoPalto.id_carta          = Convert.ToInt16(ddlTiposCartas.SelectedValue);
            _infoPalto.nombre_plato      = txtNombre.Text.ToUpper();
            _infoPalto.descripcion_plato = txtDescripcion.Text.ToUpper();
            _infoPalto.precio_plato      = Convert.ToDecimal(txtPrecio.Text);

            if (FileUpload1.HasFile)
            {
                if (!string.IsNullOrEmpty(txtNombre.Text))
                {
                    try
                    {
                        if (FileUpload1.PostedFile.ContentType == "image/png" || FileUpload1.PostedFile.ContentType == "image/jpeg" || FileUpload1.PostedFile.ContentType == "image/jpg")
                        {
                            string nombreArchivo = txtNombre.Text + ".jpg";
                            FileUpload1.SaveAs(Server.MapPath("~/Images/Platos/") + nombreArchivo);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new ArgumentException("ERROR" + ex.Message);
                    }
                }
            }
            _infoPalto.imagen_plato = "~/Images/Platos/" + txtNombre.Text + ".jpg";
            bool res = LogicaPlato.savePlato(_infoPalto);

            if (res)
            {
                Response.Write("<script>alert('Plato guardado correctamente.!!');</script>");
                newPlato();
            }
        }
예제 #12
0
        // Realizar Venta
        protected void btVender_Click(object sender, EventArgs e)
        {
            try
            {
                List <Plato> lineaCarrito = (List <Plato>)Session["Carrito"];
                List <Linea> lineaVenta   = (List <Linea>)Session["LineaVenta"];

                // Obtener cliente que queda guardado desde el login
                Cliente cliente = new Cliente();
                cliente = (Cliente)Session["Usuario"];

                // Creo venta
                double totalVenta = 0;
                bool   estado     = false;

                if (lineaVenta.Count < 1)
                {
                    lbError.Text = "Debes agregar al menos un producto al carrito..";
                }

                else
                {
                    Pedido nuevaVenta = new Pedido(1, Convert.ToDateTime(DateTime.Now), Convert.ToDateTime("1990-01-01"), totalVenta, cliente, lineaVenta, estado);

                    int resultado  = LogicaPedido.Agregar(nuevaVenta, cliente);
                    int resultado2 = 0;

                    foreach (Linea lineaAgregar in lineaVenta)
                    {
                        // Total de ventas
                        totalVenta = totalVenta + (lineaAgregar.Cantidad * lineaAgregar.UnPlato.Precio);

                        resultado2 = LogicaLinea.Agregar(lineaAgregar, totalVenta, cliente);
                    }

                    if (resultado == 1 || resultado2 == 2)
                    {
                        lbError.Text = "Venta exitosa, total facturado: " + Convert.ToString(totalVenta);

                        List <Linea> lineaVenta2 = new List <Linea>();
                        Session["LineaVenta"] = lineaVenta2;

                        List <Plato> linea = new List <Plato>();
                        Session["Carrito"] = linea;

                        listadoCarrito.DataSource = linea;
                        listadoCarrito.DataBind();

                        List <Plato> listarPlatos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));
                        Session["Platos"] = listarPlatos;

                        if (listarPlatos.Count > 0)
                        {
                            listadoPlatos.DataSource = listarPlatos;
                            listadoPlatos.DataBind();
                        }

                        // Redirigir a un ticket a futuro si da el tiempo
                    }
                }
            }

            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #13
0
        // Agregar desde el carrito +1
        protected void btAgregarCarrito_Click(object sender, EventArgs e)
        {
            try
            {
                // Contiene listado de codigos para el carrito
                List <Plato> lineaCarrito = (List <Plato>)Session["Carrito"];

                List <Plato> listadoPlatos = (List <Plato>)Session["Platos"];

                bool modificado = false;

                List <Linea> lineaVenta = new List <Linea>();
                lineaVenta = (List <Linea>)Session["LineaVenta"];
                List <Linea> lineaVentaAux = new List <Linea>();
                // Linea de venta tiene Producto y Cantidad

                List <Plato> platos = new List <Plato>(LogicaPlato.ListarPedido(Convert.ToInt32(ddlEspecializacion.SelectedValue), Convert.ToInt64(ddlCasas.SelectedValue)));
                // volver al listadoPlATOS
                if (listadoCarrito.SelectedValue != "")
                {
                    foreach (Plato plato in listadoPlatos)
                    {
                        if (plato.Id == Convert.ToInt32(listadoCarrito.SelectedValue))
                        {
                            if (lineaVenta != null)
                            {
                                if (lineaVenta.Count > 0)
                                {
                                    foreach (Linea lineaVerificar in lineaVenta)
                                    {
                                        if (lineaVerificar.UnPlato.Id == plato.Id)
                                        {
                                            lineaVentaAux = lineaVenta;

                                            foreach (Linea venAux in lineaVentaAux)
                                            {
                                                if (lineaVerificar.UnPlato.Id == venAux.UnPlato.Id)
                                                {
                                                    venAux.Cantidad = venAux.Cantidad + 1;

                                                    Session["LineaVenta"] = lineaVentaAux;

                                                    lbCantidad.Text = Convert.ToString(venAux.Cantidad);

                                                    modificado = true;
                                                }
                                            }
                                        }

                                        else if (Convert.ToInt32(listadoCarrito.SelectedValue) != lineaVerificar.UnPlato.Id && Convert.ToInt32(listadoCarrito.SelectedValue) == plato.Id && modificado == false) // Agregar siguiente producto
                                        {
                                            bool esta = true;

                                            foreach (Plato enElCarrito in lineaCarrito)
                                            {
                                                if (enElCarrito.Id == plato.Id)
                                                {
                                                    esta = false;
                                                }
                                            }

                                            if (esta == false)
                                            {
                                            }

                                            else
                                            {
                                                lineaVentaAux = lineaVenta; // (List<LineaVenta>)Session["LineaVenta"];

                                                Casa casa = new Casa();
                                                casa.RUT = Convert.ToInt64(ddlCasas.SelectedValue);
                                                Linea lineaAgregar = new Linea(plato, casa, 1);
                                                lineaVentaAux.Add(lineaAgregar);

                                                Session["LineaVenta"] = lineaVentaAux; //lineaVentaAux;

                                                lbCantidad.Text = Convert.ToString(lineaAgregar.Cantidad);

                                                lineaCarrito.Add(plato);
                                                listadoCarrito.DataSource = lineaCarrito;
                                                listadoCarrito.DataBind();
                                                break;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    Casa casa2 = new Casa();
                                    casa2.RUT = Convert.ToInt64(ddlCasas.SelectedValue);
                                    Linea lineaAgregar = new Linea(plato, casa2, 1);
                                    lineaVentaAux.Add(lineaAgregar);
                                    Session["LineaVenta"] = lineaVentaAux;

                                    lbCantidad.Text = Convert.ToString(lineaAgregar.Cantidad);

                                    lineaCarrito.Add(plato);

                                    listadoCarrito.DataSource = lineaCarrito;
                                    listadoCarrito.DataBind();
                                }
                            }
                        }
                    }

                    foreach (var linea in lineaVenta)
                    {
                        if (linea.UnPlato.Id == Convert.ToInt32(listadoCarrito.SelectedValue) && modificado == false)
                        {
                            linea.Cantidad        = linea.Cantidad + 1;
                            Session["LineaVenta"] = lineaVenta;
                            lbCantidad.Text       = linea.Cantidad.ToString();
                        }
                    }
                }

                else
                {
                    lbError.Text = "Debe seleccionar un plato del carrito...";
                }
            }

            catch (Exception ex)
            {
                lbError.Text = ex.Message;
            }
        }
예제 #14
0
        // Editar un plato
        protected void btGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string nombreFoto = "";

                if (nombreModificar.Text == "")
                {
                    lbError3.Text = ("ERROR: Ingrese un nombre..");
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
                }

                else if (precioModificar.Text == "")
                {
                    lbError3.Text = ("ERROR: Ingrese un precio..");
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
                }

                else
                {
                    if ((FileUpload2.PostedFile != null) && (FileUpload2.PostedFile.ContentLength > 0))
                    {
                        String   nombreOriginal = Path.GetFileName(FileUpload2.PostedFile.FileName);
                        String[] extensionFoto  = nombreOriginal.Split('.');

                        byte[] stringAByte   = System.Text.ASCIIEncoding.ASCII.GetBytes(nombreOriginal);
                        string nombreConHash = Convert.ToBase64String(stringAByte);
                        string fec           = Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second);
                        string nombreHash    = nombreConHash + fec;

                        nombreFoto = nombreHash + "." + extensionFoto[1];

                        string SaveLocation = Server.MapPath("ImagenesPlato") + "\\" + nombreFoto;

                        FileUpload2.PostedFile.SaveAs(SaveLocation);
                    }

                    else
                    {
                        nombreFoto = (string)Session["Foto"];
                    }

                    Plato plato = new Plato();

                    plato.Id     = Convert.ToInt32(idModificar.Text);
                    plato.Nombre = nombreModificar.Text;
                    plato.Precio = Convert.ToDouble(precioModificar.Text);
                    long rut = Convert.ToInt64(ddlCasaModificar.SelectedValue);
                    plato.Foto = nombreFoto;

                    int resultado = LogicaPlato.Modificar(plato, rut);

                    if (resultado == 1 || resultado == 2)
                    {
                        lbError.Text = "Plato Modificado";
                        CargarGrilla();

                        idPlato.Text     = "";
                        nombrePlato.Text = "";
                        precioPlato.Text = "";
                        lbError3.Text    = "";

                        Session["Foto"] = nombreFoto;
                        fotoMostrar.Src = "/ImagenesPlato/" + nombreFoto;
                        fotoMostrar.DataBind();
                    }

                    else
                    {
                        lbError3.Text = "No se pudo modificar";
                        ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
                    }
                }
            }

            catch (Exception ex)
            {
                lbError3.Text = ex.Message;
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi2();</script>");
            }
        }
예제 #15
0
        // Agregar un plato
        protected void btAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                string nombreFoto = "";

                if (nombrePlato.Text == "")
                {
                    lbError2.Text = ("ERROR: Ingrese un nombre..");
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
                }

                else if (precioPlato.Text == "")
                {
                    lbError2.Text = ("ERROR: Ingrese un precio..");
                    ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
                }

                else
                {
                    if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
                    {
                        String   nombreOriginal = Path.GetFileName(FileUpload1.PostedFile.FileName);
                        String[] extensionFoto  = nombreOriginal.Split('.');

                        byte[] stringAByte   = System.Text.ASCIIEncoding.ASCII.GetBytes(nombreOriginal);
                        string nombreConHash = Convert.ToBase64String(stringAByte);
                        string fec           = Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second);
                        string nombreHash    = nombreConHash + fec;

                        nombreFoto = nombreHash + "." + extensionFoto[1];

                        string SaveLocation = Server.MapPath("ImagenesPlato") + "\\" + nombreFoto;

                        FileUpload1.PostedFile.SaveAs(SaveLocation);

                        Plato nuevoPlato = new Plato();

                        nuevoPlato.Id     = 0;
                        nuevoPlato.Nombre = nombrePlato.Text;
                        nuevoPlato.Precio = Convert.ToDouble(precioPlato.Text);
                        nuevoPlato.Foto   = nombreFoto;

                        int resultado = LogicaPlato.Agregar(nuevoPlato, Convert.ToInt64(ddlCasasPlato.SelectedValue));

                        if (resultado == 2)
                        {
                            lbError.Text = "Se ha agregado plato satisfactoriamente..";
                            CargarGrilla();

                            idPlato.Text     = "";
                            nombrePlato.Text = "";
                            precioPlato.Text = "";
                            lbError2.Text    = "";
                        }

                        else if (resultado == 1)
                        {
                            lbError2.Text = " El Plato ingresado ya se encuentra registrado.";
                            ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
                        }

                        else
                        {
                            lbError2.Text = "No se ha agregado el Plato..";
                            ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
                        }
                    }

                    else
                    {
                        lbError2.Text = ("Seleccione una foto..");
                        ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
                    }
                }
            }

            catch (Exception ex)
            {
                lbError2.Text = ex.Message;
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: vpi();</script>");
            }
        }