private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (dg.Rows.Count == 0)
            {
                return;
            }

            double porciento = Convert.ToDouble(dg.Rows.Cast <DataGridViewRow>().Sum(x => Convert.ToDouble(x.Cells["PORCIENTO"].Value.ToString())));

            if (porciento != 100)
            {
                Funciones.Utilitario.Mensaje_Informacion("El Porciento Total debe ser Igual a 100");
                return;
            }
            try
            {
                N_Ponderacion.Eliminar_Datos();

                foreach (DataGridViewRow fila in dg.Rows)
                {
                    E_Ponderacion obj = new E_Ponderacion();
                    obj._ID_PONDERACION = Convert.ToInt32(fila.Cells[0].Value.ToString());
                    obj._DESCRIPCION    = fila.Cells[1].Value.ToString();
                    obj._PORCIENTO      = Convert.ToDouble(fila.Cells[2].Value.ToString());

                    N_Ponderacion.Insertar_Datos(obj);
                }
                Funciones.Utilitario.Mensaje_Informacion("Datos Actualizados Con Exito");
            }
            catch (Exception ex)
            {
                Funciones.Utilitario.Mensaje_Error(ex.Message);
            }
        }
Exemple #2
0
 public void Insertar_Datos(E_Ponderacion obj)
 {
     cn.Close();
     da.InsertCommand             = new SqlCommand("SP_PONDERACIONES", cn);
     da.InsertCommand.CommandType = CommandType.StoredProcedure;
     da.InsertCommand.Parameters.AddWithValue("@ACCION", "I");
     da.InsertCommand.Parameters.AddWithValue("@PORCIENTO", obj._PORCIENTO);
     da.InsertCommand.Parameters.AddWithValue("@ID_PONDERACION", obj._ID_PONDERACION);
     da.InsertCommand.Parameters.AddWithValue("@DESCRIPCION", obj._DESCRIPCION);
     cn.Open();
     da.InsertCommand.ExecuteNonQuery();
     cn.Close();
 }
Exemple #3
0
        public static void Insertar_Datos(E_Ponderacion obj_)
        {
            D_Ponderacion obj = new D_Ponderacion();

            obj.Insertar_Datos(obj_);
        }