public static string Insertar(int tipodocumento, string nombredocu, string seriedocu, string numdocu, int sujeto, decimal subtotal, decimal iva, decimal total, int bodega, int vendedor, int estado, DataTable Detalles) { //int idedocumento, D_Egreso Datos = new D_Egreso(); E_Egreso Obj = new E_Egreso(); //Obj.idedocumento = idedocumento; Obj.tipodocu = tipodocumento; Obj.nombredocu = nombredocu; Obj.seriedocu = seriedocu; Obj.numdocu = numdocu; Obj.sujeto = sujeto; Obj.subtotal = subtotal; Obj.iva = iva; Obj.total = total; Obj.bodega = bodega; Obj.vendedor = vendedor; Obj.estado = estado; Obj.Detalle = Detalles; return(Datos.Insertar(Obj)); }
public string Insertar(E_Egreso Obj) { string Rpta = ""; SqlConnection SqlCon = new SqlConnection(); try { SqlCon = Conexion.getInstancia().CrearConexion(); SqlCommand Comando = new SqlCommand("egreso_insertar", SqlCon); Comando.CommandType = CommandType.StoredProcedure; Comando.Parameters.Add("@idusuario", SqlDbType.Int).Value = Obj.vendedor; Comando.Parameters.Add("@idsujeto", SqlDbType.Int).Value = Obj.sujeto; Comando.Parameters.Add("@serie_comprobante", SqlDbType.VarChar).Value = Obj.seriedocu; Comando.Parameters.Add("@num_comprobante", SqlDbType.VarChar).Value = Obj.numdocu; Comando.Parameters.Add("@subtotal", SqlDbType.Decimal).Value = Obj.subtotal; Comando.Parameters.Add("@iva", SqlDbType.Decimal).Value = Obj.iva; Comando.Parameters.Add("@total", SqlDbType.Decimal).Value = Obj.total; Comando.Parameters.Add("@bodega", SqlDbType.Int).Value = Obj.bodega; Comando.Parameters.Add("@detalle", SqlDbType.Structured).Value = Obj.Detalle; SqlCon.Open(); Comando.ExecuteNonQuery(); Rpta = "OK"; } catch (Exception ex) { Rpta = ex.Message; } finally { if (SqlCon.State == ConnectionState.Open) { SqlCon.Close(); } } return(Rpta); }