public override void Siguiente()
        {
            eUNIDAD_MEDIDA o = new eUNIDAD_MEDIDA();

            o.UME_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balUNIDAD_MEDIDA.siguienteRegistro(o));
        }
        public override void Anterior()
        {
            eUNIDAD_MEDIDA o = new eUNIDAD_MEDIDA();

            o.UME_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balUNIDAD_MEDIDA.anteriorRegistro(o));
        }
Beispiel #3
0
        private void btnGoUnidadMedida_Click(object sender, EventArgs e)
        {
            eUNIDAD_MEDIDA o = new eUNIDAD_MEDIDA();

            o.UME_codigo = this.cmbUnidadMedida.SelectedValue != null?this.cmbUnidadMedida.SelectedValue.ToString() : "";

            frmDM_UnidadMedida o2 = new frmDM_UnidadMedida(o);

            o2.MdiParent = this.MdiParent;
            o2.Show();
        }
Beispiel #4
0
        public bool eliminarRegistro(eUNIDAD_MEDIDA oeUNIDAD_MEDIDA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_UNIDAD_MEDIDA_eliminarRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                cnn.Open();

                cmd.Parameters.Add(new SqlParameter("@UME_CODIGO", oeUNIDAD_MEDIDA.UME_codigo));

                return(cmd.ExecuteNonQuery() > 0);
            }
        }
        public override bool Actualizar()
        {
            int  u;
            bool rpta = false;

            try
            {
                eUNIDAD_MEDIDA o = new eUNIDAD_MEDIDA();
                o.UME_codigo            = this.txtCodigo.Text.Trim();
                o.UME_descripcion       = this.txtDescripcion.Text.Trim();
                o.UME_descripcion_sunat = this.txtDescripcionSunat.Text.Trim();
                o.UME_multiplo          = Int32.TryParse(this.nudMultiplo.Value.ToString(), out u) ? Convert.ToInt32(this.nudMultiplo.Value) : -1;

                if (balUNIDAD_MEDIDA.actualizarRegistro(o))
                {
                    mensaje("actualizar", "");
                    //MessageBox.Show("El registro fue actualizado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtCodigo.ReadOnly = true;
                    rpta = true;
                }
            }
            catch (CustomException ex)
            {
                if (ex.tupla != null)
                {
                    foreach (Control c in this.gpbInformacion.Controls)
                    {
                        foreach (var item in ex.tupla)
                        {
                            if (c.Tag != null && c.Tag.ToString() == item.name)
                            {
                                errValidacion.SetError(c, item.message.ToString());
                            }
                        }
                    }
                    mensaje("subsanar", "");
                }
                else
                {
                    mensaje("corregir", ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(rpta);
        }
        public override void Buscar()
        {
            eUNIDAD_MEDIDA   o         = new eUNIDAD_MEDIDA();
            balUNIDAD_MEDIDA b         = new balUNIDAD_MEDIDA();
            _frmBusqueda     ventana   = new _frmBusqueda(false, "buscarRegistro", b);
            DialogResult     respuesta = ventana.ShowDialog();

            if (respuesta == DialogResult.OK)
            {
                o.UME_codigo = ventana.pk;
                DataTable dt = balUNIDAD_MEDIDA.obtenerRegistro(o);
                cargarDatos(dt);

                this.txtCodigo.ReadOnly = true;
            }
        }
Beispiel #7
0
        public DataTable obtenerRegistro(eUNIDAD_MEDIDA oeUNIDAD_MEDIDA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_UNIDAD_MEDIDA_obtenerRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter dad = new SqlDataAdapter(cmd);
                dad.SelectCommand.Parameters.Add(new SqlParameter("@UME_CODIGO", oeUNIDAD_MEDIDA.UME_codigo));

                DataTable dt = new DataTable();
                dad.Fill(dt);

                return(dt);
            }
        }
        public override bool Eliminar()
        {
            int  u;
            bool rpta = false;

            try
            {
                eUNIDAD_MEDIDA o = new eUNIDAD_MEDIDA();
                o.UME_codigo = this.txtCodigo.Text.Trim();

                if (balUNIDAD_MEDIDA.eliminarRegistro(o))
                {
                    mensaje("eliminar", "");
                    //MessageBox.Show("El registro fue eliminado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtCodigo.ReadOnly = true;
                    rpta = true;
                }
            }
            catch (CustomException ex)
            {
                if (ex.tupla != null)
                {
                    foreach (Control c in this.gpbInformacion.Controls)
                    {
                        foreach (var item in ex.tupla)
                        {
                            if (c.Tag != null && c.Tag.ToString() == item.name)
                            {
                                errValidacion.SetError(c, item.message.ToString());
                            }
                        }
                    }
                    mensaje("subsanar", "");
                }
                else
                {
                    mensaje("corregir", ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(rpta);
        }
Beispiel #9
0
        public bool actualizarRegistro(eUNIDAD_MEDIDA oeUNIDAD_MEDIDA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_UNIDAD_MEDIDA_actualizarRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                cnn.Open();

                cmd.Parameters.Add(new SqlParameter("@UME_CODIGO", oeUNIDAD_MEDIDA.UME_codigo));                                               //variable tipo:string
                cmd.Parameters.Add(new SqlParameter("@UME_DESCRIPCION", oeUNIDAD_MEDIDA.UME_descripcion));                                     //variable tipo:string
                cmd.Parameters.Add(new SqlParameter("@UME_DESCRIPCION_SUNAT", (object)oeUNIDAD_MEDIDA.UME_descripcion_sunat ?? DBNull.Value)); //variable tipo:string
                cmd.Parameters.Add(new SqlParameter("@UME_MULTIPLO", oeUNIDAD_MEDIDA.UME_multiplo));                                           //variable tipo:int

                return(cmd.ExecuteNonQuery() > 0);
            }
        }
 public frmDM_UnidadMedida(eUNIDAD_MEDIDA o)
 {
     InitializeComponent();
     tabla   = "UNIDAD_MEDIDA";
     this._o = o;
 }