public IEnumerable <NaklItem> GetDirectAcceptance(int naklId) { const string commandText = @"Select chz_nakl_item_id, name, (Select Count(*) From chz_sgtins Where chz_sgtins.chz_nakl_item_id=chz_nakl_items.chz_nakl_item_id) As count, (vat_value * (Select Count(*) From chz_sgtins Where chz_sgtins.chz_nakl_item_id=chz_nakl_items.chz_nakl_item_id)) As nds, ((cost - vat_value)*(Select Count(*) From chz_sgtins Where chz_sgtins.chz_nakl_item_id=chz_nakl_items.chz_nakl_item_id)) As price, (cost * (Select Count(*) From chz_sgtins Where chz_sgtins.chz_nakl_item_id=chz_nakl_items.chz_nakl_item_id)) As sum, (Select Count(*) From chz_scanned_sgtins Where chz_scanned_sgtins.chz_nakl_item_id = chz_nakl_items.chz_nakl_item_id) As scaned_count, (Select Count(*) From chz_sgtins Inner Join chz_scanned_sgtins On chz_sgtins.sgtin=chz_scanned_sgtins.value Where chz_scanned_sgtins.chz_nakl_item_id = chz_nakl_items.chz_nakl_item_id And chz_sgtins.chz_nakl_item_id = chz_nakl_items.chz_nakl_item_id ) As count_matched From chz_nakl_items Where chz_nakl_items.chz_nakl_id = @chz_nakl_id"; var parameter = new NaklIdParameter() { Id = naklId }; var transaction = Transact <NaklItem> .Create(ConnectionString, commandText, parameter : parameter); return(transaction.ExecuteReader()); }
public IEnumerable <NaklItem> Get(int naklId) { const string procedureName = "chz_get_nakl_items"; var parameter = new NaklIdParameter() { Id = naklId }; var procedure = StorageProcedure <NaklItem> .Create(ConnectionString, procedureName, parameter : parameter); return(procedure.ExecuteReader()); }
public void Delete(int naklItemId) { var commandText = @"Delete chz_gtins Where chz_gtin_id =@chz_nakl_id"; var parameter = new NaklIdParameter() { NaklId = naklItemId }; var transaction = Transact <object> .Create(ConnectionString, commandText, parameter : parameter); transaction.ExecuteNonQuery(); }
public IEnumerable <NaklItemModel> Get(int naklId) { const string commandText = @"Select chz_gtins.chz_gtin_id, chz_gtins.prod_sell_name As sell_name, (Select Count(*) From chz_sgtins Where chz_gtins.chz_gtin_id = chz_sgtins.chz_gtin_id) As sgtin_count, (Select Sum(chz_sgtins.cost) From chz_sgtins Where chz_gtins.chz_gtin_id = chz_sgtins.chz_gtin_id) As sum, (Select Sum(chz_sgtins.vat_value) From chz_sgtins Where chz_gtins.chz_gtin_id = chz_sgtins.chz_gtin_id) As nds, (Select Sum(chz_sgtins.cost - chz_sgtins.vat_value) From chz_sgtins Where chz_gtins.chz_gtin_id = chz_sgtins.chz_gtin_id) As price, (Select chz_gtin_statuses.name From chz_gtin_statuses Where chz_gtins.gtin_status_id = chz_gtin_statuses.gtin_status_id) as status, (Select chz_gtin_statuses.color From chz_gtin_statuses Where chz_gtins.gtin_status_id = chz_gtin_statuses.gtin_status_id) as color From chz_gtins Where chz_gtins.chz_nakl_id =@chz_nakl_id"; var parametr = new NaklIdParameter() { NaklId = naklId }; var transact = Transact <NaklItemModel> .Create(ConnectionString, commandText, parameter : parametr); return(transact.ExecuteReader()); }