Example #1
0
        public bool InsertarUnidadMedida(tblUnidadMedida _TBL_UniMedida)
        {
            bool respuesta = false;

            try
            {
                contexto.tblUnidadMedida.InsertOnSubmit(_TBL_UniMedida);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
Example #2
0
        protected void btnaceptar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtNombre.Text) || string.IsNullOrWhiteSpace(txtPresentacion.Text))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "alerta()", true);
            }
            else
            {
                tblUnidadMedida UniMed = new tblUnidadMedida();
                UniMed.strNombre      = txtNombre.Text.ToUpper();
                UniMed.strAbreviatura = txtPresentacion.Text.ToUpper();
                UniMed.idActivo       = 1;

                ControllerUnidadMedida ctrlUniMed = new ControllerUnidadMedida();
                ctrlUniMed.InsertarUnidadMedida(UniMed);
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                this.LimpiarCampos();
            }
        }