Пример #1
0
        public bool validateBorrador()
        {
            //Valido que no dejen campos vacios
            if (txtDescripcion.Text == "" || txtStock.Text == "" || txtPrecio.Text == "")
            {
                MessageBox.Show("Debe completar todos los campos");
                return(false);
            }

            if (!MetodosGlobales.esNumericConDosDecimales(txtPrecio))
            {
                return(false);
            }

            //valido que la publicacion tenga al menos un rubro.
            if (chkRubros.CheckedItems.Count == 0)
            {
                MessageBox.Show("La publicación debe estar asociada al menos a un rubro.");
                return(false);
            }

            if (Convert.ToDouble(txtPrecio.Text) <= 0)
            {
                MessageBox.Show("El producto no puede valer $0 o menos.");
                return(false);
            }

            return(true);
        }
Пример #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            //VALIDO LOS TIPOS DE LOS CAMPOS
            if (textBox1.Text != "" && !MetodosGlobales.esInteger(textBox1))
            {
                return;
            }
            if (textBox3.Text != "" && !MetodosGlobales.esNumericConDosDecimales(textBox3))
            {
                return;
            }
            if (textBox4.Text != "" && !MetodosGlobales.esNumericConDosDecimales(textBox4))
            {
                return;
            }
            if (textBox5.Text != "" && !MetodosGlobales.esInteger(textBox5))
            {
                return;
            }



            //Filtro
            decimal?cod = null;
            string  des = null;
            decimal?pre = null;
            decimal?por = null;
            int?    dur = null;

            if (textBox1.Text != "")
            {
                cod = Convert.ToDecimal(textBox1.Text);
            }
            if (textBox2.Text != "")
            {
                des = textBox2.Text;
            }
            if (textBox3.Text != "")
            {
                pre = Convert.ToDecimal(textBox3.Text);
            }
            if (textBox4.Text != "")
            {
                por = Convert.ToDecimal(textBox4.Text);
            }
            if (textBox5.Text != "")
            {
                dur = Convert.ToInt32(textBox5.Text);
            }


            vISIBILIDADTableAdapter.Filtrar(gD1C2014DataSet.VISIBILIDAD, cod, des, pre, por, dur);
        }
Пример #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            //Valido que no dejen campos vacios
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
            {
                MessageBox.Show("Debe completar por lo menos 1 campo");
                return;
            }


            //Valido que los tipos de datos sean correctos
            if (!MetodosGlobales.esInteger(textBox1) || !MetodosGlobales.esInteger(textBox5) || !MetodosGlobales.esNumericConDosDecimales(textBox3) || !MetodosGlobales.esInteger(textBox4))
            {
                return;
            }

            //Valido que el codigo no exista
            if (Convert.ToInt32(textBox1.Text) != codigo && Convert.ToInt32(visibilidadTableAdapter1.existeCod(Convert.ToDecimal(textBox1.Text))) > 0)
            {
                MessageBox.Show("Ese codigo de visibilidad ya existe");
                return;
            }

            //Valido que el nombre no exista
            if (textBox2.Text != nombre && Convert.ToInt32(visibilidadTableAdapter1.existeNom(textBox2.Text)) > 0)
            {
                MessageBox.Show("Ese nombre de visibilidad ya existe");
                return;
            }

            //Valido que no exista la combinacion de $, % y duracion
            if ((Convert.ToInt32(textBox5.Text) != duracion || Convert.ToInt32(textBox4.Text) != porcentaje || Convert.ToDecimal(textBox3.Text) != precio) && Convert.ToInt32(visibilidadTableAdapter1.existeCombinacion(Convert.ToInt32(textBox5.Text), Convert.ToDecimal(textBox3.Text), Convert.ToDecimal(textBox4.Text) / 100)) > 0)
            {
                MessageBox.Show("Esa combinacion de precio, porcentaje y duracion ya existe");
                return;
            }


            //Si hay errores, agrego a la base de datos
            modificar();
        }