private void ButtonPay_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateActivities())
                {
                    labelError.Text = string.Empty;
                    IPaymentLogic paymentOperations = Provider.GetInstance.GetPaymentOperations();
                    IStudentLogic studentOperations = Provider.GetInstance.GetStudentOperations();

                    int             selectedStudentNumber = Convert.ToInt32(comboBoxStudentsNumbers.SelectedItem);
                    Student         student            = studentOperations.GetStudentByNumber(selectedStudentNumber);
                    List <Activity> activitiesToBePaid = GetCheckedActivities();
                    paymentOperations.PayAndAddStudentActivities(activitiesToBePaid, student);

                    labelSuccess.Text = Constants.SUCCESS_ACTIVITY_REGISTRATION_AND_PAYMENT;
                    CleanForm();
                }
            }
            catch (CoreException ex)
            {
                CleanLists();
                labelSuccess.Text    = string.Empty;
                this.labelError.Text = ex.Message;
            }
            catch (Exception ex)
            {
                CleanLists();
                labelSuccess.Text    = string.Empty;
                this.labelError.Text = Constants.ERROR_UNEXPECTED;
            }
        }
Esempio n. 2
0
 public PaymentsController(GymTestContext context, ISendEmail sendEmail, IPaymentLogic payLogic, IOptionsSnapshot <AppSettings> app)
 {
     _context      = context;
     _appSettings  = app;
     _sendEmail    = sendEmail;
     _paymentLogic = payLogic;
 }
Esempio n. 3
0
 public ReportLogic(IPositionLogic positionLogic, IOrderLogic orderLogic, IFurnitureModelLogic furnitureModelLogic, IPaymentLogic paymentLogic)
 {
     this.positionLogic       = positionLogic;
     this.orderLogic          = orderLogic;
     this.furnitureModelLogic = furnitureModelLogic;
     this.paymentLogic        = paymentLogic;
 }
Esempio n. 4
0
 public EducationController(IEducationLogic educationLogic, ICourseLogic doctorLogic, IPaymentLogic paymentLogic, ReportLogic reportLogic)
 {
     _educationLogic = educationLogic;
     _courseLogic    = doctorLogic;
     _paymentLogic   = paymentLogic;
     _reportLogic    = reportLogic;
 }
Esempio n. 5
0
 public OrderController(IOrderLogic orderLogic, IServiceLogic serviceLogic, IPaymentLogic paymentLogic, ReportLogic reportLogic)
 {
     _orderLogic   = orderLogic;
     _serviceLogic = serviceLogic;
     _paymentLogic = paymentLogic;
     _reportLogic  = reportLogic;
 }
        private void buttonPay_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateFeesToBePaid())
                {
                    labelError.Text = string.Empty;
                    IPaymentLogic paymentOperations = Provider.GetInstance.GetPaymentOperations();

                    List <Fee> feesToBePaid = this.checkedListBoxNotPaidFees.CheckedItems.Cast <Fee>().ToList();
                    paymentOperations.PayFees(feesToBePaid);

                    labelSuccess.Text = Constants.FEES_WHERE_SUCCESSFULLY_PAID;
                    CleanForm();
                    this.comboBoxStudentNumbers.SelectedIndex = -1;
                }
            }
            catch (CoreException ex)
            {
                CleanForm(true);
                this.labelError.Text = ex.Message;
            }
            catch (Exception ex)
            {
                CleanForm(true);
                this.labelError.Text = Constants.ERROR_UNEXPECTED;
            }
        }
        public void PayFees()
        {
            try
            {
                IStudentLogic studentOperations = DummyProvider.GetInstance.GetStudentOperations();
                IPaymentLogic paymentOperations = DummyProvider.GetInstance.GetPaymentOperations();

                var newStudent = Utility.CreateRandomStudent();
                newStudent.Fees          = Utility.GenerateYearFees();
                newStudent.StudentNumber = 1;

                studentOperations.AddStudent(newStudent);

                List <Fee> feesToBePaid = newStudent.Fees.Take(3).ToList();
                paymentOperations.PayFees(feesToBePaid);

                List <Fee> studentFees   = paymentOperations.GetCurrentYearFeesByStudentNumber(newStudent.StudentNumber);
                List <Fee> checkFeesPaid = studentFees.Take(3).ToList();
                foreach (var fee in checkFeesPaid)
                {
                    Assert.IsTrue(fee.IsPaid);
                }
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
 public OrderController(IOrderLogic orderLogic, IProductLogic productLogic, IPaymentLogic paymentLogic, ReportLogic reportLogic)
 {
     _orderLogic   = orderLogic;
     _productLogic = productLogic;
     _paymentLogic = paymentLogic;
     _reportLogic  = reportLogic;
 }
        public void PayAndAddStudentActivities()
        {
            IStudentLogic  studentOperations  = DummyProvider.GetInstance.GetStudentOperations();
            IPaymentLogic  paymentOperations  = DummyProvider.GetInstance.GetPaymentOperations();
            IActivityLogic activityOperations = DummyProvider.GetInstance.GetActivityOperations();

            var newStudent = Utility.CreateRandomStudent();

            newStudent.Fees          = Utility.GenerateYearFees();
            newStudent.StudentNumber = 1;

            studentOperations.AddStudent(newStudent);

            var activityOne = new Activity("Yoga", new DateTime(2017, 11, 14), 100);

            activityOne.Id = 1;
            var activityTwo = new Activity("Karate", new DateTime(2017, 10, 22), 150);

            activityTwo.Id = 2;
            activityOperations.AddActivity(activityOne);
            activityOperations.AddActivity(activityTwo);

            List <Activity> activitiesToBePaid = activityOperations.GetActivities();

            paymentOperations.PayAndAddStudentActivities(activitiesToBePaid, newStudent);

            List <Activity> studentActivities = newStudent.Activities;

            Assert.IsNotNull(studentActivities);// Si no se agregaron
            Assert.AreNotEqual(studentActivities.Count, 0);
        }
 public OrderController(IPositionLogic positionLogic, IOrderLogic orderLogic, IFurnitureModelLogic furnitureModelLogic, IPaymentLogic paymentLogic, ReportLogic reportLogic)
 {
     _positionLogic       = positionLogic;
     _orderLogic          = orderLogic;
     _furnitureModelLogic = furnitureModelLogic;
     _paymentLogic        = paymentLogic;
     _reportLogic         = reportLogic;
 }
Esempio n. 11
0
 public ReportLogic(IOrderLogic orderLogic, IPaymentLogic paymentLogic,
                    IServiceLogic serviceLogic, IClientLogic clientLogic)
 {
     this.orderLogic   = orderLogic;
     this.paymentLogic = paymentLogic;
     this.serviceLogic = serviceLogic;
     this.clientLogic  = clientLogic;
 }
Esempio n. 12
0
 public IPaymentLogic GetPaymentLogic()
 {
     if (_paymentLogic == null)
     {
         _paymentLogic = new PaymentLogic(_configuration);
     }
     return(_paymentLogic);
 }
Esempio n. 13
0
 private Provider()
 {
     this.teachersLogic   = new TeacherLogic(new TeacherPersistance());
     this.studentsLogic   = new StudentLogic(new StudentPersistance());
     this.subjectsLogic   = new SubjectLogic(new SubjectPersistance());
     this.vehiclesLogic   = new VehicleLogic(new VehiclePersistance());
     this.activitiesLogic = new ActivityLogic(new ActivityPersistance());
     this.paymentsLogic   = new PaymentLogic(new PaymentPersistence());
 }
        public void GetStudentFees()
        {
            IStudentLogic studentOperations = DummyProvider.GetInstance.GetStudentOperations();
            IPaymentLogic paymentOperations = DummyProvider.GetInstance.GetPaymentOperations();

            var newStudent = Utility.CreateRandomStudent();

            newStudent.Fees          = Utility.GenerateYearFees();
            newStudent.StudentNumber = 1;

            studentOperations.AddStudent(newStudent);

            List <Fee> studentFees = paymentOperations.GetCurrentYearFeesByStudentNumber(newStudent.StudentNumber);

            Assert.IsNotNull(studentFees);
            Assert.AreEqual(studentFees.Count, 12);
        }
Esempio n. 15
0
        public PaymentViewModel(ref MainViewModel parent,
                                Schedule selectedSchedule,
                                IList <SelectionViewModel <TakenSeatViewModel> > selectedSeats,
                                IPaymentLogic paymentLogic,
                                IReservationLogic reservationLogic)
        {
            this.parent           = parent;
            this.selectedSeats    = selectedSeats;
            this.paymentLogic     = paymentLogic;
            this.reservationLogic = reservationLogic;
            this.selectedSchedule = selectedSchedule;

            this.PaymentInProgress = false;

            PayCommand = new AsyncDelegateCommand(ExecuteAsync, CanExecute);

            _ = InitializeAsync();
        }
        private void FillFormWithStudentData(Student student)
        {
            textBoxDocumentNumber.Text = student.GetDocumentNumber();
            textBoxFullName.Text       = student.GetFullName();

            IPaymentLogic paymentOperations = Provider.GetInstance.GetPaymentOperations();
            List <Fee>    studentFees       = paymentOperations.GetCurrentYearFeesByStudentNumber(student.StudentNumber);

            foreach (Fee f in studentFees)
            {
                if (f.IsPaid)
                {
                    checkedListBoxPaidFees.Items.Add(f);
                }
                else
                {
                    checkedListBoxNotPaidFees.Items.Add(f);
                }
            }
        }
 // Moq
 // - http://hamidmosalla.com/2017/08/03/moq-working-with-setupget-verifyget-setupset-verifyset-setupproperty/
 // Setup ASPNET using DI registry with s
 // - http://mscodingblog.blogspot.com/2015/11/making-setup-phase-of-unit-testing.html
 // - https://weblogs.asp.net/garrypilkington/setting-up-ioc-with-mvc-quickly
 // Custom DI container
 // - https://asp.net-hacker.rocks/2017/05/08/add-custom-ioc-in-aspnetcore.html
 protected T CreateTestControllerWith <T>(IPaymentLogic payment = null) where T : ApiController, new()
 {
     payment = payment != null ? payment : _paymentLogic;
     return(new PaymentController(payment) as T);
 }
 public void SetUp()
 {
     _paymentLogic = GetInst <IPaymentLogic>();
     base.Setup();
 }
 public void UpdatePaymentStatus(IList <int> paymentIds, IPaymentLogic paymentLogic)
 {
     paymentLogic.GeneratePaymentStatus(paymentIds);
 }
Esempio n. 20
0
 public PaymentsController(GymTestContext context, ISendEmail sendEmail, IPaymentLogic payLogic)
 {
     _context      = context;
     _sendEmail    = sendEmail;
     _paymentLogic = payLogic;
 }
Esempio n. 21
0
 public ReportLogic(ICourseLogic doctorLogic, IEducationLogic visitLogic, IPaymentLogic paymentLogic)
 {
     this.doctorLogic  = doctorLogic;
     this.visitLogic   = visitLogic;
     this.paymentLogic = paymentLogic;
 }
Esempio n. 22
0
 public IPaymentModule SetPaymentLogic(IPaymentLogic paymentLogic)
 {
     _paymentLogic = paymentLogic;
     return(this);
 }
 public ReportLogic(IProductLogic productLogic, IOrderLogic orderLogic, IPaymentLogic paymentLogic)
 {
     this.productLogic = productLogic;
     this.orderLogic   = orderLogic;
     this.paymentLogic = paymentLogic;
 }
Esempio n. 24
0
 public PaymentsController(IPaymentLogic iPaymentLogic)
 {
     _iPaymentLogic = iPaymentLogic;
 }