//---------------------------------------------------------------------------------------------------------------- public bool insertFacturaCuotas(FacturaCuotas FC) { SqlCommand _comand = null; bool inserteFactura = false; try { _comand = new SqlCommand("insertFacturaCuotas", _objConexion.getConexion()); _objConexion.getConexion().Open(); _comand.CommandType = CommandType.StoredProcedure; _comand.Parameters.Add("@Nro_Fac", SqlDbType.Int).Value = FC.Nro_Factura; _comand.Parameters.Add("@Nro_Cuota", SqlDbType.Int).Value = FC.Nro_Cuota; _comand.Parameters.Add("@Fecha_Inicial", SqlDbType.Date).Value = FC.fecha_inicial; _comand.Parameters.Add("@Fecha_Vto", SqlDbType.Date).Value = FC.fecha_vto.ToShortDateString(); _comand.Parameters.Add("@Estado", SqlDbType.VarChar).Value = FC.estado_cuota; _comand.Parameters.Add("@Importe", SqlDbType.Decimal).Value = FC.Importe; _comand.ExecuteNonQuery(); inserteFactura = true; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("HAY UN PROBLEMA CON LA BASE DE DATOS" + "INFORMACION : " + ex.Message); inserteFactura = false; _objConexion.getConexion().Close(); } finally { _comand.Connection.Close(); _objConexion.cerrarConexion(); } return(inserteFactura); }
//------------------------------------------------------------------------------------------------------------------------------ public void insertFacturaCuotasCC() { var FC = new FacturaCuotas(); if (_vf.dgvFacturaCuotas.RowCount > 0) { foreach (DataGridViewRow filaProd in _vf.dgvFacturaCuotas.Rows) { FC.Nro_Factura = Convert.ToInt16(filaProd.Cells[0].Value); FC.Nro_Cuota = Convert.ToInt32(filaProd.Cells[1].Value); FC.Importe = Convert.ToDecimal(filaProd.Cells[2].Value); FC.fecha_inicial = Convert.ToDateTime(filaProd.Cells[3].Value); FC.fecha_vto = Convert.ToDateTime(filaProd.Cells[4].Value); FC.estado_cuota = (filaProd.Cells[5].Value).ToString(); _fac_dao.insertFacturaCuotas(FC); } } else { MessageBox.Show("NO SE CARGARON CUOTAS A LA FACTURA, INGRESE CANTIDAD DE CUOTAS!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }