private void btnAplicar_Click(object sender, EventArgs e) { int vUltimaLinea; CapaEntidad.Estructura.Planilla vDatos; CapaNegocios.Planilla vNegocioPlanilla = new CapaNegocios.Planilla(); try { if (dtDatos.Rows.Count > 0) { vUltimaLinea = dtDatos.Rows.Count - 1; vDatos = new CapaEntidad.Estructura.Planilla() { IdLote = Convert.ToInt32(dtDatos.Rows[0]["IdLote"].ToString()), IdCliente = Convert.ToInt32(dtDatos.Rows[0]["IdCliente"].ToString()), FechaCorte = Convert.ToDateTime(dtDatos.Rows[0]["FechaCorte"].ToString()), IdCredito = Convert.ToInt32(dtDatos.Rows[0]["IdCredito"].ToString()), CuotaCobrada = Convert.ToDecimal(dtDatos.Rows[0]["CuotaCobrada"].ToString()), CuotaPaga = Convert.ToDecimal(dtDatos.Rows[0]["CuotaPaga"].ToString()), SaldoPendiente = Convert.ToDecimal(dtDatos.Rows[0]["SaldoPendiente"].ToString()), Amortizacion = Convert.ToDecimal(dtDatos.Rows[0]["Amortizacion"].ToString()), Intereses = Convert.ToDecimal(dtDatos.Rows[0]["Intereses"].ToString()), EstadoPlanilla = Convert.ToString(dtDatos.Rows[0]["EstadoPlanilla"].ToString()), }; vNegocioPlanilla.Insert(vDatos); MessageBox.Show("El Proceso a finalizado de forma correcta"); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Insert(CapaEntidad.Estructura.Planilla pDatos) { CapaDatos.Planilla vDatos = new CapaDatos.Planilla(); try { vDatos.Insert(pDatos); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Insert(CapaEntidad.Estructura.Planilla pDatos) { DataTable dtResultado = new DataTable(); try { string vSQL = string.Empty; vSQL += "INSERT INTO dbo.Planilla "; vSQL += " (IdLote "; vSQL += " , IdCliente "; vSQL += " , FechaCorte "; vSQL += " , IdCredito "; vSQL += " , CuotaCobrada "; vSQL += " , CuotaPaga "; vSQL += " , SaldoPendiente "; vSQL += " , Amortizacion "; vSQL += " , Intereses "; vSQL += " , EstadoPlanilla) "; vSQL += " VALUES "; vSQL += " (@IdLote "; vSQL += " , @IdCliente "; vSQL += " , @FechaCorte "; vSQL += " , @IdCredito "; vSQL += " , @CuotaCobrada "; vSQL += " , @CuotaPaga "; vSQL += " , @SaldoPendiente "; vSQL += " , @Amortizacion "; vSQL += " , @Intereses "; vSQL += " , @EstadoPlanilla) "; AbrirConexion(); vcmd = new SqlCommand(vSQL, vConnection); vcmd.Parameters.Add("@IdLote", SqlDbType.Int, 32).Value = pDatos.IdLote; vcmd.Parameters.Add("@IdCliente", SqlDbType.Int, 32).Value = pDatos.IdCliente; vcmd.Parameters.Add("@FechaCorte", SqlDbType.Int, 32).Value = pDatos.FechaCorte; vcmd.Parameters.Add("@IdCredito", SqlDbType.Int, 32).Value = pDatos.IdCredito; vcmd.Parameters.Add("@CuotaCobrada", SqlDbType.Int, 32).Value = pDatos.CuotaCobrada; vcmd.Parameters.Add("@CuotaPaga", SqlDbType.Int, 32).Value = pDatos.CuotaPaga; vcmd.Parameters.Add("@SaldoPendiente", SqlDbType.Int, 32).Value = pDatos.SaldoPendiente; vcmd.Parameters.Add("@Amortizacion", SqlDbType.Int, 32).Value = pDatos.Amortizacion; vcmd.Parameters.Add("@Intereses", SqlDbType.Int, 32).Value = pDatos.Intereses; vcmd.Parameters.Add("@EstadoPlanilla", SqlDbType.Int, 32).Value = pDatos.EstadoPlanilla; vcmd.ExecuteNonQuery(); CerrarConexion(); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }