@ -31429,6 +31429,185 @@ where c.SKU1=@SKU";
}
# endregion
#region 保存
public static int Save_CustomFee ( HT_CustomFee Model )
{
string tsql = @ "
if @id > 0
begin
Update [ HT_CustomFee ] set [ customname ] = @customname , [ htdate ] = @htdate , [ htcode ] = @htcode , [ yjprice ] = @yjprice , [ rmbprice ] = @rmbprice , [ usdprice ] = @usdprice , [ njprice ] = @njprice , [ hyprice ] = @hyprice , [ hlrate ] = @hlrate , [ llrate ] = @llrate , [ totalrmbprice ] = @totalrmbprice , [ totalusdprice ] = @totalusdprice , [ yfprice ] = @yfprice , [ lxprice ] = @lxprice , [ inname ] = @inname , [ indate ] = @indate , [ state ] = @state where id = @id
end
else
begin
INSERT INTO [ HT_CustomFee ] ( [ customname ] , [ htdate ] , [ htcode ] , [ yjprice ] , [ rmbprice ] , [ usdprice ] , [ njprice ] , [ hyprice ] , [ hlrate ] , [ llrate ] , [ totalrmbprice ] , [ totalusdprice ] , [ yfprice ] , [ lxprice ] , [ inname ] , [ indate ] , [ state ] ) values ( @customname , @htdate , @htcode , @yjprice , @rmbprice , @usdprice , @njprice , @hyprice , @hlrate , @llrate , @totalrmbprice , @totalusdprice , @yfprice , @lxprice , @inname , @indate , @state )
set @id = SCOPE_IDENTITY ( )
end
select @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , Model . id ) ;
db . AddInParameter ( cmd , "@customname" , DbType . String , Model . customname ) ;
db . AddInParameter ( cmd , "@htdate" , DbType . DateTime , Model . htdate ) ;
db . AddInParameter ( cmd , "@htcode" , DbType . String , Model . htcode ) ;
db . AddInParameter ( cmd , "@yjprice" , DbType . Decimal , Model . yjprice ) ;
db . AddInParameter ( cmd , "@rmbprice" , DbType . Decimal , Model . rmbprice ) ;
db . AddInParameter ( cmd , "@usdprice" , DbType . Decimal , Model . usdprice ) ;
db . AddInParameter ( cmd , "@njprice" , DbType . Decimal , Model . njprice ) ;
db . AddInParameter ( cmd , "@hyprice" , DbType . Decimal , Model . hyprice ) ;
db . AddInParameter ( cmd , "@hlrate" , DbType . Decimal , Model . hlrate ) ;
db . AddInParameter ( cmd , "@llrate" , DbType . Decimal , Model . llrate ) ;
db . AddInParameter ( cmd , "@totalrmbprice" , DbType . Decimal , Model . totalrmbprice ) ;
db . AddInParameter ( cmd , "@totalusdprice" , DbType . Decimal , Model . totalusdprice ) ;
db . AddInParameter ( cmd , "@yfprice" , DbType . Decimal , Model . yfprice ) ;
db . AddInParameter ( cmd , "@lxprice" , DbType . Decimal , Model . lxprice ) ;
db . AddInParameter ( cmd , "@inname" , DbType . String , Model . inname ) ;
db . AddInParameter ( cmd , "@indate" , DbType . DateTime , Model . indate ) ;
db . AddInParameter ( cmd , "@state" , DbType . Int32 , Model . state ) ;
int a = Convert . ToInt32 ( db . ExecuteScalar ( cmd ) ) ;
return a ;
}
# endregion
#region 删除
public static void Delete_CustomFee ( int id )
{
string tsql = @ "
delete from HT_CustomFee where id = @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , id ) ;
db . ExecuteNonQuery ( cmd ) ;
}
# endregion
#region 返回Model
public static HT_CustomFee GetModel_CustomFee ( int id )
{
HT_CustomFee model = null ;
//string tsql = "select a.id,a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee";
string tsql = @ "
select * from HT_CustomFee where id = @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , id ) ;
DataSet ds = db . ExecuteDataSet ( cmd ) ;
if ( ds . Tables [ 0 ] . Rows . Count > 0 )
{
model = ds . Tables [ 0 ] . Rows [ 0 ] . ToModel < HT_CustomFee > ( ) ;
}
return model ;
}
# endregion
#region 返回列表
public static List < HT_CustomFee > GetListCustomFee ( )
{
//string tsql = "select a.id,a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee";
string tsql = "select * from HT_CustomFee" ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
DataTable tb = db . ExecuteDataTable ( cmd ) ;
List < HT_CustomFee > ListModel = tb . ToList < HT_CustomFee > ( ) ;
return ListModel ;
}
# endregion
#region 分页动态条件查询
public static List < HT_CustomFee > GetListCustomFee ( string where , int PageIndex , int PageSize , string Sort , out int RowCount )
{
QueryService2 ser = new QueryService2 ( ) ;
ser . Tsql = "select id=cast(a.id as int),a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee a" ;
ser . Tsql + = " " + ser . Filter ( where ) ;
ser . PageIndex = PageIndex ;
ser . PageSize = PageSize ;
if ( string . IsNullOrEmpty ( Sort ) = = true ) { ser . Sort = "a.id desc" ; }
else { ser . Sort = Sort ; }
string tsql = ser . GetText ( ) ;
List < HT_CustomFee > ListModel = null ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddOutParameter ( cmd , "@RowCount" , DbType . Int32 , 4 ) ;
DataTable tb = db . ExecuteDataTable ( cmd ) ;
RowCount = Convert . ToInt32 ( cmd . Parameters [ "@RowCount" ] . Value ) ;
ListModel = tb . ToList < HT_CustomFee > ( ) ;
return ListModel ;
}
# endregion
#region 保存
public static int Save_CustomFeeDetail ( HT_CustomFeeDetail Model )
{
string tsql = @ "
if @id > 0
begin
Update [ HT_CustomFeeDetail ] set [ feeid ] = @feeid , [ feedate ] = @feedate , [ feermbprice ] = @feermbprice , [ feeusdprice ] = @feeusdprice , [ hlrate ] = @hlrate , [ feetype ] = @feetype , [ jsbprice ] = @jsbprice , [ jslxprice ] = @jslxprice where id = @id
end
else
begin
INSERT INTO [ HT_CustomFeeDetail ] ( [ feeid ] , [ feedate ] , [ feermbprice ] , [ feeusdprice ] , [ hlrate ] , [ feetype ] , [ jsbprice ] , [ jslxprice ] ) values ( @feeid , @feedate , @feermbprice , @feeusdprice , @hlrate , @feetype , @jsbprice , @jslxprice )
set @id = SCOPE_IDENTITY ( )
end
select @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , Model . id ) ;
db . AddInParameter ( cmd , "@feeid" , DbType . Int32 , Model . feeid ) ;
db . AddInParameter ( cmd , "@feedate" , DbType . DateTime , Model . feedate ) ;
db . AddInParameter ( cmd , "@feermbprice" , DbType . Decimal , Model . feermbprice ) ;
db . AddInParameter ( cmd , "@feeusdprice" , DbType . Decimal , Model . feeusdprice ) ;
db . AddInParameter ( cmd , "@hlrate" , DbType . Decimal , Model . hlrate ) ;
db . AddInParameter ( cmd , "@feetype" , DbType . Int32 , Model . feetype ) ;
db . AddInParameter ( cmd , "@jsbprice" , DbType . Decimal , Model . jsbprice ) ;
db . AddInParameter ( cmd , "@jslxprice" , DbType . Decimal , Model . jslxprice ) ;
int a = Convert . ToInt32 ( db . ExecuteScalar ( cmd ) ) ;
return a ;
}
# endregion
#region 删除
public static void Delete_CustomFeeDetail ( int id )
{
string tsql = @ "
delete from HT_CustomFeeDetail where id = @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , id ) ;
db . ExecuteNonQuery ( cmd ) ;
}
# endregion
#region 返回Model
public static HT_CustomFeeDetail GetModel_CustomFeeDetail ( int id )
{
HT_CustomFeeDetail model = null ;
//string tsql = "select a.id,a.feeid,a.feedate,a.feermbprice,a.feeusdprice,a.hlrate,a.feetype,a.jsbprice,a.jslxprice from HT_CustomFeeDetail";
string tsql = @ "
select * from HT_CustomFeeDetail where id = @id ";
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@id" , DbType . Int32 , id ) ;
DataSet ds = db . ExecuteDataSet ( cmd ) ;
if ( ds . Tables [ 0 ] . Rows . Count > 0 )
{
model = ds . Tables [ 0 ] . Rows [ 0 ] . ToModel < HT_CustomFeeDetail > ( ) ;
}
return model ;
}
# endregion
#region 返回列表
public static List < HT_CustomFeeDetail > GetListCustomFeeDetail ( int feeid )
{
//string tsql = "select a.id,a.feeid,a.feedate,a.feermbprice,a.feeusdprice,a.hlrate,a.feetype,a.jsbprice,a.jslxprice from HT_CustomFeeDetail";
string tsql = "select * from HT_CustomFeeDetail where feeid=@feeid order by a.feedate" ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
DbCommand cmd = db . GetSqlStringCommand ( tsql ) ;
db . AddInParameter ( cmd , "@feeid" , DbType . Int32 , feeid ) ;
DataTable tb = db . ExecuteDataTable ( cmd ) ;
List < HT_CustomFeeDetail > ListModel = tb . ToList < HT_CustomFeeDetail > ( ) ;
return ListModel ;
}
# endregion
}
}