コード例 #1
0
        /// <summary>
        /// Eliminamos logicamente el Tipo de Ingrediente.
        /// </summary>
        /// <returns></returns>
        private bool eliminar()
        {
            bool isOk = false;

            try
            {
                DialogResult result = MessageBox.Show("¿Esta seguro que desea eliminar el tipo de ingrediente?", "Eliminar", MessageBoxButtons.YesNo);//consultar duda
                if (result == DialogResult.Yes)
                {
                    //falta validar los compos obligatorios antes de guardar
                    tipoInGlobal.estado          = false;
                    tipoInGlobal.fecha_ult_mod   = Utility.getDate();
                    tipoInGlobal.usuario_ult_mod = Global.Usuario.nombreUsuario.ToUpper().Trim();
                    tbTipoIngrediente tipoIngre = tipoBIns.eliminar(tipoInGlobal);
                    isOk = true;

                    MessageBox.Show("Se ha eliminado el tipo de ingrediente.", "Información");
                }
            }
            catch (UpdateEntityException ex)
            {
                MessageBox.Show(ex.Message);
                isOk = false;
            }
            return(isOk);
        }
コード例 #2
0
 private void cerrarForm(object sender, FormClosedEventArgs e)
 {
     if (!banderaSeleccionar)
     {
         TipInGlobal = null;
         pasarDatosEvent(TipInGlobal);
     }
 }
コード例 #3
0
        private void lstvTipoIngred_SelectedIndexChanged(object sender, EventArgs e)//cuando selecciono un index diferente
        {
            if (lstvTipoIngred.SelectedItems.Count > 0)
            {
                string idSelected = lstvTipoIngred.SelectedItems[0].Text;



                foreach (tbTipoIngrediente tipoIngrediente in listaTipoIng)
                {
                    if (int.Parse(idSelected) == tipoIngrediente.id)
                    {
                        TipInGlobal = tipoIngrediente;
                    }
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Recuperamos la información del tipo de ingrediente buscado.
 /// </summary>
 /// <param name="tipo"></param>
 private void dataBuscar(tbTipoIngrediente tipo)
 {
     try
     {
         tipoInGlobal = tipo;
         if (tipoInGlobal != null)
         {
             if (tipoInGlobal.id != 0)
             {
                 txtId.Text        = tipoInGlobal.id.ToString().Trim();
                 txtNombre.Text    = tipoInGlobal.nombre.Trim();
                 txtDes.Text       = tipoInGlobal.descripcion.Trim();
                 chkEstado.Checked = tipoInGlobal.estado;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
        /// <summary>
        /// Actualizamos la informacion del tipo de Ingrediente seleccionado.
        /// </summary>
        /// <returns></returns>
        private bool modificar()
        {
            bool isOk = false;

            try
            {
                tipoInGlobal.nombre          = txtNombre.Text.ToUpper();
                tipoInGlobal.descripcion     = txtDes.Text.ToUpper();
                tipoInGlobal.estado          = chkEstado.Checked;
                tipoInGlobal.fecha_ult_mod   = Utility.getDate();
                tipoInGlobal.usuario_ult_mod = Global.Usuario.nombreUsuario.ToUpper().Trim();

                tipoInGlobal = tipoBIns.modificar(tipoInGlobal);

                MessageBox.Show("El tipo de ingrediente ha sido actualizado.", "Información.");
            }
            catch (UpdateEntityException ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(isOk);
        }
コード例 #6
0
        DTipoIngrediente TipoIngIns = new DTipoIngrediente();//debo cear instancia para llamar a DL

        public tbTipoIngrediente guardar(tbTipoIngrediente tipoIngre)
        {
            tbTipoIngrediente tipoIngLocal = TipoIngIns.GetEntity(tipoIngre);

            if (tipoIngLocal == null)
            {
                return(TipoIngIns.Guardar(tipoIngre));
            }
            else
            {
                if (tipoIngLocal.estado == true)
                {
                    throw new EntityExistException("  tipo ingrediente  ");
                }
                else
                {
                    throw new EntityDisableStateException("  tipo Ingrediente  ");
                }

                /*  exist = true;
                 * return tipoIngLocal;*/
            }
        }
コード例 #7
0
        /// <summary>
        /// Guardamos el tipo de ingrediente.
        /// </summary>
        /// <returns></returns>
        private bool guardar()
        {
            bool isOk = false;
            tbTipoIngrediente tipoIngrediente = new tbTipoIngrediente();

            if (validar())
            {
                try
                {
                    tipoIngrediente.nombre      = txtNombre.Text.ToUpper();
                    tipoIngrediente.descripcion = txtDes.Text.ToUpper();

                    tipoIngrediente.estado          = true;
                    tipoIngrediente.fecha_crea      = Utility.getDate();
                    tipoIngrediente.fecha_ult_mod   = Utility.getDate();
                    tipoIngrediente.usuario_crea    = Global.Usuario.nombreUsuario.ToUpper().Trim();
                    tipoIngrediente.usuario_ult_mod = Global.Usuario.nombreUsuario.ToUpper().Trim();


                    tipoIngrediente = tipoBIns.guardar(tipoIngrediente);

                    txtId.Text = tipoIngrediente.id.ToString();
                    isOk       = true;
                    MessageBox.Show("El tipo de ingrediente se guardó correctamente");
                }

                catch (EntityExistException ex)
                {
                    MessageBox.Show(ex.Message);
                    isOk = false;
                }

                catch (EntityDisableStateException ex)
                {
                    DialogResult result = MessageBox.Show(ex.Message, "  existe el tipo de ingrediente", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        chkEstado.Checked = true;
                        tipoInGlobal      = tipoBIns.getEntity(tipoIngrediente);
                        //isOk = modificar();
                        modificar();
                        isOk = true;
                    }
                    else
                    {
                        isOk = false;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                isOk = false;
            }


            return(isOk);
        }
コード例 #8
0
 public tbTipoIngrediente getEntity(tbTipoIngrediente eltipoIngrediente)
 {
     return(TipoIngIns.GetEntity(eltipoIngrediente));
 }
コード例 #9
0
 public tbTipoIngrediente eliminar(tbTipoIngrediente tipoIngre)
 {
     return(TipoIngIns.Actualizar(tipoIngre));
 }
コード例 #10
0
 public tbTipoIngrediente  modificar(tbTipoIngrediente tipoIngre)
 {
     return(TipoIngIns.Actualizar(tipoIngre));
 }