示例#1
0
        /// <summary>
        /// this function will update a bank account
        /// </summary>
        /// <param name="bankAccount">the given bank account</param>
        public void UpdateBankAccountByAccount(BankAccount bankAccount)
        {
            #region ActionLog
            //we initialy generate the action log and command
            String LogAction  = $"S-a actualizat contul bancar cu ID: {bankAccount.ID}";
            String LogCommand = "UPDATE seller.conturi_bancare_furnizori " +
                                $"SET banca = {bankAccount.Bank} " +
                                $"WHERE cont = {bankAccount.Account}";
            //before retrieving the ip of the current instance
            String IP = MentorBilling.Miscellaneous.IPFunctions.GetWANIp();
            #endregion

            ConturiBancareFurnizori contBancarFurnizor = base.ConturiBancareFurnizori.Where(element => element.Cont == bankAccount.Account).FirstOrDefault();

            contBancarFurnizor.Banca = bankAccount.Bank;
            contBancarFurnizor.Cont  = bankAccount.Account;
            contBancarFurnizor.Activ = true;

            base.Update(contBancarFurnizor);
            base.LogActiuni.Add(ActionLog.LogAction(LogAction, IP, LogCommand));
            base.SaveChanges();
        }
示例#2
0
 /// <summary>
 /// this function will add a bew bank account for the given seller to the database
 /// </summary>
 /// <param name="seller">the given seller</param>
 /// <param name="bankAccount">the new bank account</param>
 void AddNewBankAccountForSellerWithoutSave(ObjectStructures.Invoice.Seller seller, BankAccount bankAccount)
 {
     #region ActionLog
     //we generate the log action
     String LogAction = $"Adaugat un nou cont bancar la banca {bankAccount.Bank} pentru societatea {seller.Name}";
     //and the log command
     String LogCommand = "INSERT INTO seller.conturi_bancare_furnizori(furnizor_id,cont,banca) " +
                         $"VALUES({seller.ID}, {bankAccount.Account}, {bankAccount.Bank}) " +
                         "ON CONFLICT(cont) " +
                         $"DO UPDATE SET banca= {bankAccount.Bank} RETURNING id";
     //before retriving the ip
     String IP = Miscellaneous.IPFunctions.GetWANIp();
     #endregion
     ConturiBancareFurnizori contBancarFurnizor = new ConturiBancareFurnizori
     {
         FurnizorId = seller.ID,
         Cont       = bankAccount.Account,
         Banca      = bankAccount.Bank
     };
     base.ConturiBancareFurnizori.Add(contBancarFurnizor);
     base.LogActiuni.Add(ActionLog.LogAction(LogAction, IP, LogCommand));
     bankAccount.ID = contBancarFurnizor.Id;
 }