public RecievePay(PaymentOrder payment) { using (VistaDBConnection connection = new VistaDBConnection(new Connection().ConnectionString)) { try { connection.Open(); using (VistaDBCommand command = new VistaDBCommand()) { command.Connection = connection; command.CommandText = $"UPDATE dbo.PaymentOrder SET Status = 'Recieved',RecievedBy ={LoginUser.UserId},RecievedDate = GETDATE() WHERE Id = {payment.Id}"; command.ExecuteNonQuery(); connection.Close(); MessageBox.Show(@"successfully Recieved"); } } catch (VistaDBException exception) { Log.Error(exception); } } }
public void Save(PaymentOrder paymentOrder) { using (VistaDBConnection connection = new VistaDBConnection(new Connection().ConnectionString)) { try { connection.Open(); using (VistaDBCommand command = new VistaDBCommand()) { command.Connection = connection; command.CommandText = $"INSERT INTO dbo.PaymentOrder(PoNumber,Beneficiary,Payee,Phone,Amount,Interest,SchoolId,UserId)VALUES('{paymentOrder.PoNumber}','{paymentOrder.Beneficiary}','{paymentOrder.Payee}','{paymentOrder.Phone}',{paymentOrder.Amount},{paymentOrder.Interest},{SchoolId},{UserId})"; command.ExecuteNonQuery(); connection.Close(); MessageBox.Show(@"successfully Saved Payment"); } } catch (VistaDBException exception) { MessageBox.Show("Something went wrong"); Log.Error(exception); } } }
public void Payment(PaymentOrder payment, School school, User user) { using (VistaDBConnection connection = Connection.Connexion) { try { connection.Open(); using (VistaDBCommand command = new VistaDBCommand()) { command.Connection = connection; command.CommandText = $"INSERT INTO dbo.PaymentOrder(PoNumber,Beneficiary,Payee,Phone,Amount,Interest,SchoolId,UserId)VALUES('{payment.PoNumber}','{payment.Beneficiary}','{payment.Payee}','{payment.Phone}',{payment.Amount},{payment.Interest},{school.Id},{user.Id},)"; command.ExecuteNonQuery(); connection.Close(); MessageBox.Show($"Successfully added Payment for {school.SchoolName}"); } } catch (VistaDBException exception) { MessageBox.Show("Something went wrong"); Log.Error(exception); } } }