public Boolean Validar()
        {
            if (Prov == null)
            {
                MessageBox.Show("No ha seleccionado ningun proveedor", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            if (ConsolidadoSelected == null)
            {
                MessageBox.Show("No ha seleccionado algún elemento de la tabla ", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }
            Evaluador e = new Evaluador();

            if (!e.esNumeroEntero(Cantidad))
            {
                MessageBox.Show("La cantidad ingresada no es un número Entero.", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;

            }

            if (int.Parse(Cantidad) <= 0)
            {
                MessageBox.Show("No puedo ingresar cantidades que son cero.", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            if (ConsolidadoSelected != null)
            {

                if (ConsolidadoSelected.Cantidad < int.Parse(Cantidad))
                {

                    MessageBox.Show("No puede ingresar una cantidad mayor a la que dispone.", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                    return false;
                }

            }

            return true;
        }
        public bool Validar(OrdenCompra o)
        {
            if (String.IsNullOrEmpty(o.Observaciones))
            {
                MessageBox.Show( "El campo se encuentra vacio,Corregir..","AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
            if (o.Proveedor == null) {

                MessageBox.Show( "No ha Seleccionado un proveedor..","AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                return false;
            }

            if (o.LstProducto.Count == 0)
            {

                MessageBox.Show("Ingrese algún producto..", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;

            }

                if (o.Estado == 3)
                {
                    MessageBox.Show("No se puede editar Ordenes de compras ATENDIDAS.", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;

                }

                foreach (ProductoxOrdenCompra oc in o.LstProducto)
                {
                    Evaluador e = new Evaluador();

                    if (String.IsNullOrEmpty(oc.Cantidad))
                    {
                        MessageBox.Show("Hay cantidades que  se encuentran vacias,Corregir..", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;
                    }

                    if (!e.esNumeroEntero(oc.Cantidad))
                    {
                        MessageBox.Show("No se puede ingresar valores que no sean números en cantidad", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;

                    }

                    if (!e.esPositivo(Convert.ToInt32(oc.Cantidad)))
                    {

                        MessageBox.Show("No se puede ingresar valores negativos en cantidad", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;

                    }

                    if ((Convert.ToInt32(oc.Cantidad)) == 0)
                    {

                        MessageBox.Show("No se puede ingresar 0 como cantidad", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;

                    }

                    if (oc.CantAtendida > Convert.ToInt32(oc.Cantidad))
                    {

                        MessageBox.Show("La cantidad emitida no puede ser menor a la cantidad Atendida", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;
                    }

                }

            return true;
        }
        public string evaluarCantidad()
        {
            Evaluador e = new Evaluador();

            if (string.IsNullOrEmpty(Cantidad)) {

                return "La cantidád está vacia";
            }

            if (!e.esNumeroEntero(Cantidad)) {

                return "La cantidad ingresada no es un número Entero.";

            }

            if (int.Parse(Cantidad) <= 0)
            {
                return "No puedo ingresar cantidades que son cero.";
            }

            if (ConsolidadoSelected != null)
            {
                if (ConsolidadoSelected.Cantidad < int.Parse(Cantidad))
                {
                    return "No puede ingresar una cantidad mayor a la que dispone.";
                }

            }

            return String.Empty;
        }
        public void Distribuir(int tipo, MadeInHouse.Dictionary.DynamicGrid dg)
        {
            Evaluador eva = new Evaluador();

            if (tipo == 0)
            {
                if (String.IsNullOrEmpty(TxtAlturaAnq) || String.IsNullOrEmpty(TxtNumColumnsAnq) || String.IsNullOrEmpty(TxtNumRowsAnq) ||
                   !eva.esNumeroEntero(TxtNumColumnsAnq) || !eva.esNumeroEntero(TxtNumRowsAnq) || !eva.esNumeroEntero(TxtAlturaAnq)
                )
                {
                    System.Windows.MessageBox.Show("Debes ingresar un numero entero para el numero de filas , columnas y altura");
                    return;
                }
                else if (int.Parse(TxtAlturaAnq) <= 0 ||  int.Parse(TxtNumColumnsAnq) <= 0 ||
                        int.Parse(TxtNumRowsAnq) <= 0  )
                    {
                    System.Windows.MessageBox.Show("Debes ingresar un numero entero para el numero de filas , columnas y altura");
                    return;
                    }

                NumColumnsAnq = Int32.Parse(TxtNumColumnsAnq);
                NumRowsAnq = Int32.Parse(TxtNumRowsAnq);
                AlturaAnq = Int32.Parse(TxtAlturaAnq);
                dg.RecreateGridCells();

                if (accion == 2)
                {
                    dg.cargarGrid(lstZonasAnq);
                }

            }
            else
            {

                if (String.IsNullOrEmpty(TxtAlturaAnq) || String.IsNullOrEmpty(TxtNumColumnsDto) || String.IsNullOrEmpty(TxtNumRowsDto)
                     || !eva.esNumeroEntero(TxtAlturaDto) || !eva.esNumeroEntero(TxtNumColumnsDto) || !eva.esNumeroEntero(TxtNumRowsDto))
                {
                    System.Windows.MessageBox.Show("Debes ingresar un numero entero para el numero de filas , columnas y altura");
                    return;
                }
                else if (int.Parse(TxtAlturaDto) <= 0 || int.Parse(TxtNumColumnsAnq) <= 0 ||
                    int.Parse(TxtNumRowsDto) <= 0)
                {
                    System.Windows.MessageBox.Show("Debes ingresar un numero entero para el numero de filas , columnas y altura");
                    return;
                }

                NumColumnsDto = Int32.Parse(TxtNumColumnsDto);
                NumRowsDto = Int32.Parse(TxtNumRowsDto);
                AlturaDto = Int32.Parse(TxtAlturaDto);
                dg.RecreateGridCells();

                if (accion == 2)
                {
                    dg.cargarGrid(lstZonasDto);
                }
            }
        }
        public int GuardarTienda(MadeInHouse.Dictionary.DynamicGrid anaquel, MadeInHouse.Dictionary.DynamicGrid deposito)
        {
            Evaluador eva = new Evaluador();
            if (String.IsNullOrEmpty(TxtAlturaAnq) || String.IsNullOrEmpty(TxtNumColumnsAnq) || String.IsNullOrEmpty(TxtNumRowsAnq) ||
                 String.IsNullOrEmpty(TxtAlturaDto) || String.IsNullOrEmpty(TxtNumColumnsDto) || String.IsNullOrEmpty(TxtNumRowsDto) ||
                !eva.esNumeroEntero(TxtNumColumnsAnq) || !eva.esNumeroEntero(TxtNumColumnsDto) || !eva.esNumeroEntero(TxtNumRowsAnq) || !eva.esNumeroEntero(TxtNumRowsDto) ||
                !eva.esNumeroEntero(TxtAlturaAnq) || !eva.esNumeroEntero(TxtAlturaDto) ||
                int.Parse(TxtAlturaDto) <= 0 || int.Parse(TxtAlturaAnq) <= 0 || int.Parse(TxtNumColumnsAnq) <= 0 || int.Parse(TxtNumColumnsDto) <= 0 ||
                int.Parse(TxtNumRowsAnq) <= 0 || int.Parse(TxtNumRowsDto) <= 0  )
            {
                System.Windows.MessageBox.Show("Debes ingresar un numero entero para el numero de filas , columnas y altura");
                return 1;
            }

            int exito = 0;

            DBConexion db = new DBConexion();
            db.conn.Open();
            SqlTransaction trans = db.conn.BeginTransaction(IsolationLevel.Serializable);
            db.cmd.Transaction = trans;
            pxaSQL = new ProductoSQL(db);

                /*Agrega una tienda*/
                Tienda tienda = new Tienda();
                tienda.Estado = 1;
                tienda.Nombre = txtNombre;
                tienda.Direccion = txtDir;
                tienda.Telefono = txtTelef;
                tienda.Administrador = txtAdmin;
                Ubigeo seleccionado = new Ubigeo();
                UbigeoSQL uSQL = new UbigeoSQL(db);
                seleccionado = uSQL.buscarUbigeo(selectedDpto, selectedProv, selectedDist);
                tienda.IdUbigeo = seleccionado.IdUbigeo;
                tienda.FechaReg = DateTime.Today;
                TiendaSQL gw = new TiendaSQL(db);
                int idTienda=-1;

                if (accion == 1)
                    idTienda = gw.AgregarTienda(tienda);
                else if (accion == 2)
                {
                    tienda.IdTienda = this.idTienda;
                    exito = gw.ActualizarTienda(tienda);
                }
               if (idTienda > 0 || exito>0)
                {

                    /*Se agregan las dos partes de la tienda*/
                    AlmacenSQL aSQL = new AlmacenSQL(db);

                    /*anaquel*/
                    Almacenes ana = new Almacenes();
                    ana.CodAlmacen = "ANA00" + tienda.IdTienda.ToString();
                    ana.IdTienda = tienda.IdTienda;
                    ana.Nombre = "Anaquel de "+ txtNombre;
                    ana.Telefono = tienda.Telefono;
                    ana.Direccion = tienda.Direccion;
                    ana.NroColumnas = int.Parse(TxtNumColumnsAnq);
                    ana.NroFilas = int.Parse(TxtNumRowsAnq);
                    ana.Altura = int.Parse(TxtAlturaAnq);
                    ana.Tipo = 2;
                    int idAnaquel=-1;
                    if (accion == 1)
                        idAnaquel = aSQL.Agregar(ana);
                    else if (accion == 2)
                    {
                        ana.IdAlmacen = this.idAnaquel;
                        exito = aSQL.Actualizar(ana);
                    }
                    if (idAnaquel > 0 || exito>0)
                    {

                        /*deposito*/
                        Almacenes dto = new Almacenes();
                        dto.CodAlmacen = "DTO00" + tienda.IdTienda.ToString();
                        dto.IdTienda = tienda.IdTienda;
                        dto.Nombre = "Deposito de " + txtNombre;
                        dto.Telefono = tienda.Telefono;
                        dto.Direccion = tienda.Direccion;
                        dto.NroColumnas = int.Parse(TxtNumColumnsDto);
                        dto.NroFilas = int.Parse(TxtNumRowsDto);
                        dto.Altura = int.Parse(TxtAlturaDto);
                        dto.Tipo = 1;
                        int idDeposito=-1;
                        if (accion == 1)
                            idDeposito = aSQL.Agregar(dto);
                        else if (accion == 2)
                        {
                            dto.IdAlmacen = this.idDeposito;
                            exito = aSQL.Actualizar(dto);
                        }

                        if (idDeposito > 0 || exito>0)
                        {
                            if (accion == 1)
                            {
                                /*Productos de la tienda*/
                                for (int i = 0; i < LstProductos.Count; i++)
                                {
                                    LstProductos[i].IdAlmacen = idDeposito;
                                    LstProductos[i].IdTienda = idTienda;
                                     exito = pxaSQL.AgregarProductoxAlmacen(LstProductos[i]);

                                    if (exito <= 0) break;
                                }
                            }
                            else if (accion == 2)
                            {
                                DataTable productoxAlmacenDT= pxaSQL.CrearProductoxAlmacenDT();
                                pxaSQL.AgregarFilasToDT(productoxAlmacenDT, LstProductos);
                                exito = pxaSQL.ActualizarProductoxAlmacen(productoxAlmacenDT,trans);
                            }

                            if (exito > 0)
                            {
                               DataTable zonaxAlmacenData = CrearZonasDT();
                                AgregarFilasToZonasDT(zonaxAlmacenData, anaquel.listaZonas, (accion==1) ? idAnaquel :this.idAnaquel );
                                AgregarFilasToZonasDT(zonaxAlmacenData, deposito.listaZonas, (accion==1) ? idDeposito : this.idDeposito );

                                if (accion==1)
                                    exito = aSQL.AgregarZonasMasivo(zonaxAlmacenData, trans);
                                else if (accion==2)
                                    exito = aSQL.ActualizarZonasMasivo(zonaxAlmacenData, trans);

                                if (exito > 0)
                                {

                                    UbicacionSQL ubSQL = new UbicacionSQL(db);

                                    /*Ubicaciones del anaquel*/
                                    DataTable ubicacionesData = CrearUbicacionesDT();
                                    AgregarFilasToUbicacionesDT(ubicacionesData, anaquel.Ubicaciones, (accion == 1) ? idAnaquel : this.idAnaquel);
                                    AgregarFilasToUbicacionesDT(ubicacionesData, deposito.Ubicaciones, (accion == 1) ? idDeposito : this.idDeposito);

                                    if (accion == 1)
                                        exito = ubSQL.AgregarMasivo(ubicacionesData, trans);
                                    else if (accion == 2)
                                        exito = ubSQL.ActualizarUbicacionMasivo(ubicacionesData, trans);

                                    if (exito > 0)
                                    {
                                        trans.Commit();
                                        if (accion == 1)
                                        {
                                            //1: Agregar, 2: Editar, 3: Eliminar, 4: Recuperar, 5: Desactivar
                                            DataObjects.Seguridad.LogSQL.RegistrarActividad("Registrar Tienda", tienda.IdTienda+"", 1);
                                            System.Windows.MessageBox.Show("Se creó la tienda correctamente");
                                        }
                                        else if (accion == 2)
                                        {
                                            //1: Agregar, 2: Editar, 3: Eliminar, 4: Recuperar, 5: Desactivar
                                            DataObjects.Seguridad.LogSQL.RegistrarActividad("Actualizar Tienda",tienda.IdTienda+"" , 2);
                                            System.Windows.MessageBox.Show("Se editó la tienda correctamente");
                                        }
                                        return 1;
                                    }
                                    else
                                    {
                                        System.Windows.MessageBox.Show("ERROR");
                                    }
                                }
                                else
                                {
                                    System.Windows.MessageBox.Show("ERROR");
                                }
                            }
                            else
                            {
                                System.Windows.MessageBox.Show("ERROR");
                            }
                        }
                        else
                        {
                            System.Windows.MessageBox.Show("ERROR");
                        }
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("ERROR");
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("ERROR");
                }

                trans.Rollback();
                return -1;

               // System.Windows.MessageBox.Show("Se creo correctamente la tienda con id: " + idTienda.ToString() + " con anaquel id: " + idAnaquel.ToString() + " y con deposito id :" + idDeposito.ToString());
        }
        public void AgregarDetalle()
        {
            if (String.IsNullOrEmpty(TxtProducto))
            {
                MessageBox.Show("No ha ingresado ningún producto", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            DetalleVentaSQL dvsql = new DetalleVentaSQL();
            Producto p = dvsql.Buscar(TxtProducto,idTienda);
            if (p == null)
            {
                return;
            }
            Evaluador ev = new Evaluador();
            int nuevo = 1;
            int cant;

            List<DetalleVenta> aux = new List<DetalleVenta>();
            foreach (DetalleVenta item in LstVenta)
            {
                if (item.IdProducto == p.IdProducto)
                {
                    if (ev.esNumeroEntero(TxtCantidad) && ev.esPositivo(Convert.ToInt32(TxtCantidad))) item.Cantidad += Int32.Parse(TxtCantidad);
                    else
                    {
                        MessageBox.Show("Tiene que poner una cantidad");
                        return;
                    }
                    item.SubTotal = item.Cantidad * p.Precio;
                    //item.Descuento += CalculaDescuento(p.IdProducto, item.Cantidad);

                    desc = 0;// item.Descuento;
                    //TxtDescuentoTotal = desc.ToString();

                    total += Math.Round(Int32.Parse(TxtCantidad) * p.Precio, 2);
                    TxtTotal = total.ToString();

                    subt = Math.Round(total / (1 + IGV), 2);
                    TxtSubTotal = subt.ToString();

                    igv_total = Math.Round(subt * IGV, 2);
                    TxtIGVTotal = igv_total.ToString();

                    TxtPagaCon = txtPagaCon;

                    nuevo = 0;
                }
                aux.Add(item);
            }

            if (nuevo == 1)
            {
                DetalleVenta dv = new DetalleVenta();
                dv.IdProducto = p.IdProducto;
                dv.CodProducto = p.CodigoProd;
                dv.Descripcion = p.Nombre;
                dv.Unidad = p.UnidadMedida;

                dv.Precio = p.Precio;
                if (ev.esNumeroEntero(TxtCantidad)) cant = Int32.Parse(TxtCantidad);
                else
                {
                    MessageBox.Show("Tiene que poner una cantidad");
                    return;
                }

                dv.Descuento = CalculaDescuento(p.IdProducto,cant);
                dv.SubTotal = p.Precio * cant;
                dv.Cantidad = cant;
                aux.Add(dv);
                ActualizaCampos(dv,1);
            }
            LstVenta = aux;
            TxtCantidad = "";
        }
        public void AgregarDetalleServicio()
        {
            Evaluador ev = new Evaluador();
            int nuevo = 1;

            List<DetalleVentaServicio> aux = new List<DetalleVentaServicio>();
            foreach (DetalleVentaServicio item in LstVentaServicios)
            {
                if (item.IdServicio == serv.IdServicio)
                {
                    nuevo = 0;
                }
                aux.Add(item);
            }

            if (nuevo == 1)
            {
                DetalleVentaServicio dv = new DetalleVentaServicio();
                ServicioxProductoSQL sxpsql = new ServicioxProductoSQL();
                dv.Servicio = sxpsql.ServiciobyId(serv.IdServicio);
                dv.IdProducto = serv.Producto.IdProducto;
                dv.IdServicio = serv.IdServicio;
                dv.Descripcion = dv.Servicio.Descripcion;
                dv.Precio = serv.Precio;

                aux.Add(dv);

                total += Math.Round(dv.Precio, 2);
                TxtTotal = total.ToString();
                subt = Math.Round(total / (1 + IGV), 2);
                TxtSubTotal = subt.ToString();
                igv_total = Math.Round((subt) * IGV, 2);
                TxtIGVTotal = igv_total.ToString();
                TxtPagaCon = txtPagaCon;
            }
            LstVentaServicios = aux;
            TxtServicio = "";
        }
        public void GuardarDatos(object sender, RoutedEventArgs e)
        {
            Empleado emp;
            emp = new Empleado();
            Evaluador eva = new Evaluador();

            emp.CodEmpleado = TxtCodEmp.Text;
            emp.Dni = TxtDni.Text;
            emp.Nombre = TxtNomb.Text;
            emp.ApePaterno = TxtApePat.Text;
            emp.ApeMaterno = TxtApeMat.Text;
            if (TxtFechNac.Text != "") emp.FechNacimiento = DateTime.Parse(TxtFechNac.Text);
            emp.Sexo = "M";
            if (RdbFem.IsChecked == true) emp.Sexo = "F";
            emp.Direccion = TxtDir.Text;
            emp.Referecia = TxtRef.Text;
            emp.Telefono = TxtTelef.Text;
            emp.Celular = TxtCel.Text;
            emp.EmailEmpleado = TxtEmail.Text;
            emp.Estado = 1;
            emp.FechaReg = DateTime.Today;
            emp.Puesto = CmbPuesto.Text;
            emp.Tienda = CmbTienda.Text;    //esto es el nombre de la Tienda seleccionada
            //emp.IdTienda = DataObjects.RRHH.EmpleadoSQL.GetIdTienda(emp.Tienda);
            if (String.Compare("ALMACEN CENTRAL", emp.Tienda) == 0) {
                emp.IdTienda=0;
            }
            else{
                emp.IdTienda = DataObjects.RRHH.EmpleadoSQL.GetIdTienda(emp.Tienda);
            }

            //MessageBox.Show("IDTIENDA: "+emp.IdTienda);

            emp.Area = CmbArea.Text;
            emp.EmailEmpresa = TxtEmailEmpresa.Text;
            if (TxtSalario.Text != "") emp.Sueldo = decimal.Parse(TxtSalario.Text, NumberStyles.AllowThousands
                                        | NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol);
            else emp.Sueldo = 0;
            emp.Banco = TxtBanco.Text;
            emp.CuentaBancaria = TxtCuentaBancaria.Text;
            if (!Regex.IsMatch(emp.Dni, "^[0-9]{8}$")) { MessageBox.Show("Inserte un DNI valido"); }
            else if (revisarDNI(emp.Dni)) { MessageBox.Show("El DNI ya existe"); }
            else if (emp.Nombre == "") { MessageBox.Show("Inserte un nombre valido"); }
            else if (emp.ApePaterno == "") { MessageBox.Show("Inserte un apellido paterno valido"); }
            else if (emp.ApeMaterno == "") { MessageBox.Show("Inserte un apellido materno valido"); }
            else if (emp.Direccion == "") { MessageBox.Show("Inserte una direccion valida"); }
            else if (emp.Telefono == "") { MessageBox.Show("Inserte un telefono valido"); }
            else if (!eva.esNumeroEntero(TxtTelef.Text)) { MessageBox.Show("Inserte un número Telefónico válido"); }
            else if (!eva.esNumeroEntero(TxtCel.Text)) { MessageBox.Show("Inserte un número de Celular válido"); }
            else if (emp.Tienda == "") { MessageBox.Show("Inserte un nombre valido"); }
            else if (emp.Puesto == "") { MessageBox.Show("Inserte un puesto valido"); }
            else if (emp.Area == "") { MessageBox.Show("Inserte una area valida"); }
            else if (emp.Banco == "") { MessageBox.Show("Inserte un banco valido"); }
            else if (emp.CuentaBancaria == "") { MessageBox.Show("Inserte una cuenta bancaria valida"); }
            else
            {
                int k;
                k = DataObjects.RRHH.EmpleadoSQL.agregarEmpleado(emp);

                if (k == 0)
                    MessageBox.Show("Ocurrio un error");
                else
                {
                    MessageBox.Show("Los datos han sido guardados exitosamente");
                    Limpiar(sender, e);
                }
            }
        }
        private bool ValidaMonto()
        {
            Evaluador e = new Evaluador();
            if (String.IsNullOrEmpty(TxtMonto) && !e.esNumeroReal(TxtMonto) && e.esPositivo(Convert.ToInt32(TxtMonto)))
            {
                MessageBox.Show("No ha ingresado un valor correcto en el Monto de pago", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }
            if (selectedValue == 0)
            {
                MessageBox.Show("No ha seleccionado una forma de pago", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            return true;
        }
Пример #10
0
        public bool Validar()
        {
            if (P == null) {
            MessageBox.Show("No ha seleccionado producto ", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
            }

            Evaluador e = new Evaluador();

            if (!e.esNumeroReal(Precio)) {
            MessageBox.Show("El precio no es Numero real ", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
            }

            if (!e.esPositivo(Convert.ToDouble(Precio)))
            {
            MessageBox.Show("El precio no es Negativo ", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
            }

            if (String.IsNullOrEmpty(Descripcion)) {
            MessageBox.Show("La descripcion no debe ser vacia ", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
            }

            if (String.IsNullOrEmpty(CodComercial))
            {
            MessageBox.Show("El codigo Comercial no puede ser Vacio", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
            }

            return true;
        }
        public bool Validar()
        {
            Evaluador e = new Evaluador();

            if (!e.esNumeroReal(MontoMax)&& !String.IsNullOrEmpty(MontoMax)) {
                MessageBox.Show("No ha ingresado un valor correcto en el Monto máximo", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);

                return false;

            }

            if (!e.esNumeroReal(MontoMin) && !String.IsNullOrEmpty(MontoMin))
            {
                MessageBox.Show("No ha ingresado un valor correcto en el Monto mínimo", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);

                return false;

            }

            if (!e.esNumeroReal(DniRuc)&& !String.IsNullOrEmpty(DniRuc))
            {
                MessageBox.Show("El DNI/RUC es un valor numérico", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);

                return false;

            }

            return true;
        }
        private bool Validar()
        {
            Evaluador e = new Evaluador();
            if (String.IsNullOrEmpty(TxtRazonSocial) || String.IsNullOrEmpty(TxtTelefono))
            {
                MessageBox.Show("Los datos de direccion y/o telefono son requeridos", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }
            if (!e.evalString(TxtDireccion))
            {
                MessageBox.Show("No ha ingresado la direccion del cliente", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            int numFilas = LstPagos.Count();
            if (numFilas == 0)
            {
                MessageBox.Show("No se ha ingresado el monto de pago", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            return true;
        }
        public bool Validar()
        {
            Evaluador e = new Evaluador();

            if (!e.esNumeroEntero(Cantidad)) {
                MessageBox.Show(Error.esNumero.mensaje, Error.esNumero.titulo, MessageBoxButton.OK, MessageBoxImage.Error);
                return false;

            }

            if(!e.esPositivo( Convert.ToInt32(Cantidad))){
            MessageBox.Show(Error.esNegativo.mensaje, Error.esNegativo.titulo, MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            return true ;
        }
        public void Disminuir(DynamicGrid ubicacionCol, DynamicGrid almacen)
        {
            Evaluador eva = new Evaluador();

            int exito = 0;
            if (String.IsNullOrEmpty(TxtCantidad))
            {
                _windowManager.ShowDialog(new AlertViewModel(_windowManager, "Debe ingresar una cantidad"));
                return;
            }
            else if (!eva.esNumeroEntero(TxtCantidad))
            {
                _windowManager.ShowDialog(new AlertViewModel(_windowManager, "Debe ingresar un número"));
                return;
            }
            else if (int.Parse(TxtCantidad) < 0)
            {
                _windowManager.ShowDialog(new AlertViewModel(_windowManager, "Debe ingresar una cantidad mayor a cero"));
                return;
            }
            else if (ubicacionCol.SelectedProduct != null)
            {

                exito = ubicacionCol.DisminuirProductos(int.Parse(TxtCantidad), ubicacionCol.SelectedProduct.IdProducto);
                if (exito == 1)
                {
                    int index = LstProductos.FindIndex(x => x.IdProducto == ubicacionCol.SelectedProduct.IdProducto);
                    if (index >= 0)
                    {
                        LstProductos[index].CanAtender = "" + (int.Parse(LstProductos[index].CanAtender) + int.Parse(TxtCantidad));
                    }
                    else
                    {
                        ubicacionCol.SelectedProduct.CanAtender = TxtCantidad;
                        LstProductos.Add(ubicacionCol.SelectedProduct);
                    }
                    LstProductos = new List<ProductoCant>(LstProductos);

                }
            }
        }