public static void Insert(Gateway gateway) { DbCommand cmd = SqlHelpers.CreateCommand( DataHelpers.ConnectionString, "dbo.ctx_INSERT_GATEWAY"); cmd.AddInputParam("pName", DbType.String, gateway.Name); cmd.AddInputParam("pGatewayTypeId", DbType.Guid, gateway.GatewayTypeID); cmd.AddInputParam("pChargebackFee", DbType.Currency, gateway.ChargebackFee); cmd.AddInputParam("pTransactionFee", DbType.Currency, gateway.TransactionFee); cmd.AddInputParam("pLoginID", DbType.String, gateway.LoginKey); cmd.AddInputParam("pPassword", DbType.String, gateway.PasswordKey); cmd.AddInputParam("pTransactionKey", DbType.String, gateway.TransactionKey); cmd.AddOutputParam("oGateway", DbType.Guid); SqlHelpers.ExecuteNonQuery(cmd); gateway.ID = cmd.ExtractGuid("oGateway"); }
public static Gateway Load(Guid gatewayID) { Gateway GatewayReturn = new Gateway(); DbCommand cmd = SqlHelpers.CreateCommand (DataHelpers.ConnectionString, "dbo.ctx_GET_GATEWAY"); cmd.AddInputParam("pGatewayID", DbType.Guid, gatewayID); DataTable dt = cmd.ExecuteSelectTable(); if (dt != null) { if (dt.Rows.Count > 0) { GatewayReturn = dt.Rows[0].ToGateway(); } } return GatewayReturn; }
public static Gateway GetByID(Guid id) { DbCommand cmd = SqlHelpers.CreateCommand (DataHelpers.ConnectionString, "dbo.ctx_GET_GATEWAY"); cmd.AddInputParam("pGatewayID", DbType.Guid, id); DataTable dt = cmd.ExecuteSelectTable(); Gateway g = new Gateway(); if(dt!=null) { if(dt.Rows.Count>0) { g=dt.Rows[0].ToGateway(); } } return g; }
public static Gateway Save(Gateway gateway) { DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.ctx_SAVE_GATEWAY"); cmd.AddInputOutputParam("pGatewayID", DbType.Guid, gateway.ID); cmd.AddInputOutputParam("pGatewayTypeId", DbType.Guid, gateway.GatewayTypeID); cmd.AddInputOutputParam("pName", DbType.String, gateway.Name); cmd.AddInputOutputParam("pProviderName", DbType.String, gateway.ProviderName); cmd.AddInputOutputParam("pFriendlyName", DbType.String, gateway.FriendlyName); cmd.AddInputOutputParam("pChargebackFee", DbType.Currency, gateway.ChargebackFee); cmd.AddInputOutputParam("pTransactionFee", DbType.Currency, gateway.TransactionFee); cmd.AddInputOutputParam("pLoginID", DbType.String, gateway.LoginKey); cmd.AddInputOutputParam("pPassword", DbType.String, gateway.PasswordKey); cmd.AddInputOutputParam("pTransactionKey", DbType.String, gateway.TransactionKey); cmd.AddOutputParam("oCreationDate", DbType.DateTime); cmd.AddOutputParam("oLastEditDate", DbType.DateTime); SqlHelpers.ExecuteNonQuery(cmd); gateway.ID = cmd.ExtractGuid("pGatewayID"); gateway.GatewayTypeID = cmd.ExtractGuid("pGatewayTypeId"); gateway.Name = cmd.ExtractString("pName"); gateway.ProviderName = cmd.ExtractString("pProviderName"); gateway.FriendlyName = cmd.ExtractString("pFriendlyName"); gateway.ChargebackFee = cmd.ExtractDouble("pChargebackFee"); gateway.TransactionFee = cmd.ExtractDouble("pTransactionFee"); gateway.LoginKey = cmd.ExtractString("pLoginID"); gateway.PasswordKey = cmd.ExtractString("pPassword"); gateway.TransactionKey = cmd.ExtractString("pTransactionKey"); gateway.CreationDate = cmd.ExtractDateTime("oCreationDate"); gateway.LastEditDate = cmd.ExtractDateTime("oLastEditDate"); return gateway; }