@ -7174,7 +7174,7 @@ end
}
if ( ! string . IsNullOrEmpty ( GoodsCode ) )
{
where + = " and GoodsCode =' " + GoodsCode + " ' ";
where + = " and GoodsCode like '% " + GoodsCode + " % ' ";
}
if ( ! string . IsNullOrEmpty ( Name ) )
{
@ -31117,7 +31117,7 @@ end
# endregion
#region 保存
#region 保存 TemuShopGoodActive
public static int Save_TemuShopGoodActive ( TemuShopGoodActive Model )
{
string tsql = @ "
@ -31146,20 +31146,78 @@ 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 ) ;
foreach ( var item in Model . ListMode l)
i f ( Model . ListMode l! = nul l)
{
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 ) ;
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 ( 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 )
{
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 ) ;
}
}
return a ;
}
# endregion
#region 删除
public static void Delete_TemuShopGoodActive ( int ID )
{
@ -31334,4 +31392,5 @@ where c.SKU1=@SKU";
}
# endregion
}
}