public NaklFull GetFullNaklById(int naklId) { const string commandText = @"Select chz_nakl_id, chz_address_id As provider_id, chz_companies.chz_company_id As company_id, operation_data, doc_data, doc_num, chz_receive_types.chz_receive_type_id As chz_receive_type_id, chz_source_types.chz_source_type_id As chz_source_type_id,chz_contract_types.chz_contract_type_id As chz_contract_type_id,chz_turnover_types.chz_turnover_tupe_id As chz_turnover_tupe_id, contract_num From chz_nakls Inner Join chz_addresses On chz_nakls.provider_chz_address_id = chz_addresses.chz_address_id Inner Join chz_companies On chz_companies.chz_company_id = chz_addresses.chz_company_id Inner Join chz_receive_types On chz_nakls.chz_receive_type_id = chz_receive_types.chz_receive_type_id Inner Join chz_source_types On chz_nakls.chz_source_type_id = chz_source_types.chz_source_type_id Inner Join chz_contract_types On chz_nakls.chz_contract_type_id = chz_contract_types.chz_contract_type_id Inner Join chz_turnover_types On chz_nakls.chz_turnover_tupe_id = chz_turnover_types.chz_turnover_tupe_id Where chz_nakls.chz_nakl_id = @chz_nakl_id"; var parameter = new NaklIdParameter() { Id = naklId }; var transaction = Transact <NaklFull> .Create(ConnectionString, commandText, parameter : parameter); return(transaction.ExecuteReader().FirstOrDefault()); }
public void Delete(int naklId) { const string commandText = @"Delete chz_nakls Where chz_nakl_id = @chz_nakl_id"; var parameter = new NaklIdParameter() { NaklId = naklId }; var transaction = Transact <object> .Create(ConnectionString, commandText, parameter : parameter); transaction.ExecuteNonQuery(); }
public int GetAccepTypeId(int nakId) { const string commandText = @"Select chz_nakls__list_of_accept_type_id From chz_nakls Where chz_nakls.chz_nakl_id=@chz_nakl_id"; var parameter = new NaklIdParameter() { Id = nakId }; var transaction = Transact <object> .Create(ConnectionString, commandText, parameter : parameter); return(transaction.ExecuteScalar <int>()); }
public void SaveChanges(CreateNaklModel createNaklModel) { const string commandText = @"Update chz_nakls Set subject_id= @subject_id,shipper_id= @shipper_id,operation_date= @operation_date,doc_num= @doc_num,doc_date= @doc_date,receive_type= @receive_type, source= @source,contract_type= @contract_type,contract_num= @contract_num,is_direct= 0,chz_nakl_status_id=1 Where chz_nakl_id=@chz_nakl_id"; var parameter = new NaklIdParameter() { NaklId = createNaklModel.Id }; var transaction = Transact <object> .Create(ConnectionString, commandText, parameter : createNaklModel); transaction.ExecuteNonQuery(); }
public void Cancel(int naklId) { const string commandText = @"Update chz_sgtins Set is_scened=0 Where chz_sgtin_id In ( Select chz_sgtin_id From chz_sgtins Inner Join chz_gtins On chz_sgtins.chz_gtin_id = chz_gtins.chz_gtin_id Inner Join chz_nakls On chz_gtins.chz_nakl_id = chz_nakls.chz_nakl_id Where chz_nakls.chz_nakl_id = @chz_nakl_id)"; var parameter = new NaklIdParameter() { NaklId = naklId }; var transact = Transact <NaklGridModel> .Create(ConnectionString, commandText, parameter : parameter); transact.ExecuteNonQuery(); }
public NaklModel Get(int naklId) { const string commandText = @"Select chz_nakl_id, Sc.org_name As provider_name,Sc.inn As provider_inn,Sa.text As provider_address,Rc.org_name As recesiver_name,Rc.inn As recesiver_inn, Ra.text As recesiver_address From chz_nakls Inner Join chz_addresses As Sa On chz_nakls.subject_id = Sa.chz_address_id Inner Join chz_addresses As Ra On chz_nakls.receiver_id = Ra.chz_address_id Inner Join chz_companys As Sc On Sa.chz_company_id = Sc.chz_company_id Inner Join chz_companys As Rc On Ra.chz_company_id = Rc.chz_company_id Where chz_nakls.chz_nakl_id =@chz_nakl_id"; var parametr = new NaklIdParameter() { NaklId = naklId }; var transact = Transact <NaklModel> .Create(ConnectionString, commandText, parameter : parametr); return(transact.ExecuteReader().First()); }
public Nak GetById(int id) { const string commandText = @"Select chz_nakls.chz_nakl_id As chz_nakl_id,doc_num,doc_data,ProviderCompany.inn As provider_inn,ProviderCompany.name As provider_name, ProviderAddresses.text As provider_address,ReceiverCompany.inn As receiver_inn,ReceiverCompany.name As receiver_name,ReceiverAddresses.text As receiver_address, chz_nakls.chz_nakl_status_id As nakl_status_id,chz_nakls__list_of_accept_types.value As acept_type From chz_nakls Inner Join chz_addresses ProviderAddresses On chz_nakls.provider_chz_address_id = ProviderAddresses.chz_address_id Inner Join chz_addresses ReceiverAddresses On chz_nakls.receiver_chz_address_id=ReceiverAddresses.chz_address_id Inner Join chz_companies ProviderCompany On ProviderAddresses.chz_company_id=ProviderCompany.chz_company_id Inner Join chz_companies ReceiverCompany On ReceiverAddresses.chz_company_id=ReceiverCompany.chz_company_id Inner Join chz_nakls__list_of_accept_types On chz_nakls.chz_nakls__list_of_accept_type_id=chz_nakls__list_of_accept_types.chz_nakls__list_of_accept_type_id Inner Join chz_nakl_statuses On chz_nakls.chz_nakl_status_id = chz_nakl_statuses.chz_nakl_status_id Where chz_nakls.chz_nakl_id = @chz_nakl_id"; var parameter = new NaklIdParameter() { Id = id }; var transaction = Transact <Nak> .Create(ConnectionString, commandText, parameter : parameter); return(transaction.ExecuteReader().FirstOrDefault()); }