@ -31133,74 +31133,17 @@ select @ID";
int a = Convert . ToInt32 ( db . ExecuteScalar ( cmd ) ) ;
tsql = @"INSERT INTO [TemuShopGoodActiveDetail]([ActiveId],[OffNum],[SalePrice],[ActiveNum],[OutNum])values(@ActiveId,@OffNum,@SalePrice,@ActiveNum,@OutNum)" ;
cmd = db . GetSqlStringCommand ( tsql ) ;
if ( Model . ListModel ! = null )
{
foreach ( var item in Model . ListModel )
{
cmd . Parameters . Clear ( ) ;
item . OutNum = 0 ;
db . AddInParameter ( cmd , "@ActiveId" , DbType . Int32 , a ) ;
db . AddInParameter ( cmd , "@OffNum" , DbType . Decimal , item . OffNum ) ;
db . AddInParameter ( cmd , "@SalePrice" , DbType . Decimal , item . SalePrice ) ;
db . AddInParameter ( cmd , "@ActiveNum" , DbType . Int32 , item . ActiveNum ) ;
db . AddInParameter ( cmd , "@OutNum" , DbType . Int32 , item . OutNum ) ;
db . ExecuteNonQuery ( cmd ) ;
}
}
return a ;
}
# endregion
#region 编辑TemuShopGoodActive
public static int update_TemuShopGoodActive_Data ( TemuShopGoodActive Model )
{
string tsql = @ "
if @ID > 0
begin
Update [ TemuShopGoodActive ] set [ Shopid ] = @Shopid , [ SKU ] = @SKU , [ SPUID ] = @SPUID , [ BasePrice ] = @BasePrice , [ CreateUserId ] = @CreateUserId , [ CreateTime ] = @CreateTime , [ PostPrice ] = @PostPrice , [ State ] = @State where ID = @ID
end
else
select @ID ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@ID" , DbType . Int32 , Model . ID ) ;
db . AddInParameter ( cmd , "@Shopid" , DbType . Int32 , Model . Shopid ) ;
db . AddInParameter ( cmd , "@SKU" , DbType . String , Model . SKU ) ;
db . AddInParameter ( cmd , "@SPUID" , DbType . String , Model . SPUID ) ;
db . AddInParameter ( cmd , "@BasePrice" , DbType . Decimal , Model . BasePrice ) ;
db . AddInParameter ( cmd , "@CreateUserId" , DbType . Int32 , Model . CreateUserId ) ;
db . AddInParameter ( cmd , "@CreateTime" , DbType . DateTime , Model . CreateTime ) ;
db . AddInParameter ( cmd , "@PostPrice" , DbType . Decimal , Model . PostPrice ) ;
db . AddInParameter ( cmd , "@State" , DbType . Int32 , Model . State ) ;
int a = Convert . ToInt32 ( db . ExecuteScalar ( cmd ) ) ;
tsql = @ "
if @Id > 0
begin
Update [ TemuShopGoodActiveDetail ] set [ ActiveId ] = @ActiveId , [ OffNum ] = @OffNum , [ SalePrice ] = @SalePrice , [ ActiveNum ] = @ActiveNum , [ OutNum ] = @OutNum where Id = @Id
end
else
begin
INSERT INTO [ TemuShopGoodActiveDetail ] ( [ ActiveId ] , [ OffNum ] , [ SalePrice ] , [ ActiveNum ] , [ OutNum ] ) values ( @ActiveId , @OffNum , @SalePrice , @ActiveNum , @OutNum )
end ";
cmd = db . GetSqlStringCommand ( tsql ) ;
if ( Model . ListModel ! = null )
foreach ( var item in Model . ListModel )
{
foreach ( var item in Model . ListModel )
{
cmd . Parameters . Clear ( ) ;
item . OutNum = 0 ;
db . AddInParameter ( cmd , "@ActiveId" , DbType . Int32 , a ) ;
db . AddInParameter ( cmd , "@OffNum" , DbType . Decimal , item . OffNum ) ;
db . AddInParameter ( cmd , "@SalePrice" , DbType . Decimal , item . SalePrice ) ;
db . AddInParameter ( cmd , "@ActiveNum" , DbType . Int32 , item . ActiveNum ) ;
db . AddInParameter ( cmd , "@OutNum" , DbType . Int32 , item . OutNum ) ;
db . AddInParameter ( cmd , "@Id" , DbType . Int32 , item . Id ) ;
db . ExecuteNonQuery ( cmd ) ;
}
cmd . Parameters . Clear ( ) ;
item . OutNum = 0 ;
db . AddInParameter ( cmd , "@ActiveId" , DbType . Int32 , a ) ;
db . AddInParameter ( cmd , "@OffNum" , DbType . Decimal , item . OffNum ) ;
db . AddInParameter ( cmd , "@SalePrice" , DbType . Decimal , item . SalePrice ) ;
db . AddInParameter ( cmd , "@ActiveNum" , DbType . Int32 , item . ActiveNum ) ;
db . AddInParameter ( cmd , "@OutNum" , DbType . Int32 , item . OutNum ) ;
db . ExecuteNonQuery ( cmd ) ;
}
return a ;
}
# endregion