Esempio n. 1
0
 public ServerService(CaseService caseService, DonorService donorService, VolunteerService volunteerService, DonationService donationService)
 {
     _caseService      = caseService;
     _donorService     = donorService;
     _volunteerService = volunteerService;
     _donationService  = donationService;
 }
Esempio n. 2
0
        public ActionResult NewDonation(Donation donation)
        {
            if (!ModelState.IsValid)
            {
                return(View(donation));
            }

            var donations = new Donation()
            {
                Mobile      = donation.Mobile,
                Amount      = donation.Amount,
                Transaction = donation.Transaction,
                UserID      = donation.UserID,
                PostID      = donation.PostID,
                Type        = "Bkash"
            };

            var result = DonationService.Save(donations);

            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                return(View(donation));
            }

            return(RedirectToAction("Index", "RegisteredPost", new { sid = -1 }));
        }
Esempio n. 3
0
        private void PrefillDropdownLists()
        {
            DonationService service = new DonationService();
            PageData        data    = service.GetPageData("CNZ");

            if (data != null)
            {
                this.titles.DataSource     = data.Salutations;
                this.titles.DataTextField  = "Value";
                this.titles.DataValueField = "Key";
                this.titles.DataBind();

                this.campaigns.DataSource     = data.Campaigns;
                this.campaigns.DataTextField  = "Name";
                this.campaigns.DataValueField = "CampaignId";
                this.campaigns.DataBind();

                this.frequencies.DataSource     = data.PaymentFrequencies;
                this.frequencies.DataTextField  = "Value";
                this.frequencies.DataValueField = "Key";
                this.frequencies.DataBind();

                this.reasonsforhelping.DataSource     = data.ReasonsForHelping;
                this.reasonsforhelping.DataTextField  = "Name";
                this.reasonsforhelping.DataValueField = "ReasonForHelpingId";
                this.reasonsforhelping.DataBind();
            }
        }
Esempio n. 4
0
        public DonationServiceTests()
        {
            _testDb        = GetTestData().ToList();
            _validCheckout = new LiqPayCheckoutDto()
            {
                Data      = "eyJhY3Rpb24iOiJwYXkiLCJwYXltZW50X2lkIjoxMjUzMTU2NzE2LCJzdGF0dXMiOiJzdWNjZXNzIiwidmVyc2lvbiI6MywidHlwZSI6ImJ1eSIsInBheXR5cGUiOiJjYXJkIiwicHVibGljX2tleSI6InNhbmRib3hfaTQyODU5OTk4OTE0IiwiYWNxX2lkIjo0MTQ5NjMsIm9yZGVyX2lkIjoiSElVQjY1QlQxNTgyNTU1MTQyMTYyMDY1IiwibGlxcGF5X29yZGVyX2lkIjoiMEpYTDZVU1ExNTgyNTU1MTUwMjgyNjM2IiwiZGVzY3JpcHRpb24iOiJibGFnb2RpeW5pc3QiLCJzZW5kZXJfY2FyZF9tYXNrMiI6IjQyNDI0Mio0MiIsInNlbmRlcl9jYXJkX2JhbmsiOiJUZXN0Iiwic2VuZGVyX2NhcmRfdHlwZSI6InZpc2EiLCJzZW5kZXJfY2FyZF9jb3VudHJ5Ijo4MDQsImlwIjoiMTk1LjE2MC4yMzIuMjQ4IiwiYW1vdW50IjoxMDAuMCwiY3VycmVuY3kiOiJVU0QiLCJzZW5kZXJfY29tbWlzc2lvbiI6MC4wLCJyZWNlaXZlcl9jb21taXNzaW9uIjoyLjc1LCJhZ2VudF9jb21taXNzaW9uIjowLjAsImFtb3VudF9kZWJpdCI6MjQ1MC45OCwiYW1vdW50X2NyZWRpdCI6MjQ1MC45OCwiY29tbWlzc2lvbl9kZWJpdCI6MC4wLCJjb21taXNzaW9uX2NyZWRpdCI6NjcuNCwiY3VycmVuY3lfZGViaXQiOiJVQUgiLCJjdXJyZW5jeV9jcmVkaXQiOiJVQUgiLCJzZW5kZXJfYm9udXMiOjAuMCwiYW1vdW50X2JvbnVzIjowLjAsIm1waV9lY2kiOiI3IiwiaXNfM2RzIjpmYWxzZSwibGFuZ3VhZ2UiOiJ1ayIsImNyZWF0ZV9kYXRlIjoxNTgyNTU1MTUwMjg0LCJlbmRfZGF0ZSI6MTU4MjU1NTE1MDg3MSwidHJhbnNhY3Rpb25faWQiOjEyNTMxNTY3MTZ9",
                Signature = "unholN06qwKFFl/LB3tc1qegq4E="
            };

            _liqPayKeysOptions = Options.Create(new LiqPayKeys()
            {
                PrivateKey = "testPrivateKey",
                PublicKey  = "testPublicKey"
            });

            var repoMock = new Mock <IRepository <Donation> >();

            repoMock.Setup(r => r.Get(It.IsAny <Expression <Func <Donation, bool> > >()))
            .ReturnsAsync((Expression <Func <Donation, bool> > predicate) => _testDb
                          .AsQueryable()
                          .Where(predicate)
                          .FirstOrDefault());
            repoMock.Setup(r => r.Add(It.IsAny <Donation>()))
            .Callback((Donation donation) =>
            {
                donation.Id = new Guid();
                _testDb.Add(donation);
            });

            _unitOfWorkMock = new Mock <IUnitOfWork>();
            _unitOfWorkMock.Setup(u => u.Repository <Donation>()).Returns(repoMock.Object);
            _unitOfWorkMock.Setup(u => u.SaveChangesAsync());

            _donationService = new DonationService(_unitOfWorkMock.Object, _liqPayKeysOptions);
        }
Esempio n. 5
0
 public TelaDoacao()
 {
     InitializeComponent();
     ConfigurarCombobox();
     donationService = new DonationService();
     doadorServico   = new DoadorServico();
 }
Esempio n. 6
0
        public async Task RepositoryIsEmpty()
        {
            var service = new DonationService(new MockRepository(), new MockCacheService());

            var donations = await service.GetAllDonations();

            Assert.IsEmpty(donations);
        }
Esempio n. 7
0
        public void ItHasGetAll()
        {
            // Arrange
            var sut = new DonationService();

            // Act
            // Assert
            sut.GetAll();
        }
 // GET: Donate
 public TransfusionController()
 {
     _donationAppointmentService = new DonationAppointmentService(new DonationAppointmentRepo());
     _donationService            = new DonationService(new DonationRepo());
     _bloodSeparation            = new BloodSeparationService(new BloodSeparationRepo());
     _thrombocytesService        = new ThrombocytesService(new ThrombocytesRepo());
     _redCellService             = new RedCellService(new RedCellRepo());
     _plasmaService    = new PlasmaService(new PlasmaRepo());
     _labResultService = new LabResultService(new LabResultRepo());
 }
Esempio n. 9
0
        public void Setup()
        {
            var settings = Options.Create(new AppSettings
            {
                TaxRate         = 20,
                MinimumDonation = 2,
                MaximumDonation = 100000
            });

            service = new DonationService(settings, repository);
        }
Esempio n. 10
0
        public void ItReturnsCollectionOfDonations()
        {
            // Arrange
            var sut = new DonationService();

            // Act
            var result = sut.GetAll();

            // Assert
            result.Should().BeAssignableTo <IEnumerable <Donation> >();
        }
Esempio n. 11
0
        public async Task AddedItemsAmountMatches()
        {
            var service = new DonationService(new MockRepository(), new MockCacheService());

            await service.Donate(new Donation { Amount = 500 });

            await service.Donate(new Donation { Amount = 150 });

            var totalDonationsAmount = await service.GetTotalDonationsAmount();

            Assert.AreEqual(650, totalDonationsAmount);
        }
Esempio n. 12
0
        private void PaymentButton_Click(object sender, EventArgs e)
        {
            DonationService donationDataAccess = new DonationService();

            //int result1 = donationDataAccess.DonateByBkash(Convert.ToInt64(PhoneNumberTextBox.Text),Convert.ToInt32(AmountTextBox.Text), Convert.ToInt32(PinTextBox.Text));
            int result = donationDataAccess.CheckAmountBkash(Convert.ToInt32(DonorIDTextBox.Text), Convert.ToInt32(OrganisationIDTextBox.Text));

            if (result > Convert.ToInt32(AmountTextBox.Text))
            {
                donationDataAccess.MakeDonation(Convert.ToInt32(DonorIDTextBox.Text), Convert.ToInt32(OrganisationIDTextBox.Text), Convert.ToInt32(AmountTextBox.Text), null);
            }
            MessageBox.Show("You don't have sufficient balance!");
        }
Esempio n. 13
0
 public CommonController()
 {
     _cityRepo              = new CityRepo();
     _countyRepo            = new CountyRepo();
     _transfusionCenterRepo = new TransfusionCenterRepo();
     _requestRepo           = new RequestRepo();
     _profileRepo           = new ProfileRepo();
     _appointmentService    = new DonationAppointmentService(new DonationAppointmentRepo());
     _bloodTypeService      = new BloodTypeService(new BloodTypeRepo());
     _notificationService   = new NotificationService();
     _labResultService      = new LabResultService(new LabResultRepo());
     _donationService       = new DonationService(new DonationRepo());
 }
Esempio n. 14
0
        public ActionResult DonationReport()
        {
            if (Session["UserId"].ToString() != null)
            {
                int DonorId = Convert.ToInt32(Session["UserId"]);

                List <Donor_Details> data = DonationService.UserDonationReport(DonorId);
                return(View(data));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Esempio n. 15
0
        public ActionResult DonationStatus(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);

            ViewBag.Amount        = data1.Donation_Amount;
            ViewBag.Date          = data1.CreatedOn;
            ViewBag.DonationTitle = Donationdata.Donation_Title;
            ViewBag.DonorName     = UserDetails.FirstName;

            return(View());
        }
Esempio n. 16
0
        protected void submit_Click(object sender, EventArgs e)
        {
            Donation d = new Donation
            {
                Donor = new Contact
                {
                    FirstName        = this.firstname.Text,
                    LastName         = this.lastname.Text,
                    NameOnTaxReceipt = this.nameontaxreceipts.Text,
                    HomePhone        = this.homephone.Text,
                    MobilePhone      = this.mobilephone.Text,
                    EmailAddress     = this.emailaddress.Text,
                    Street           = this.street.Text,
                    Suburb           = this.suburb.Text,
                    City             = this.city.Text,
                    PostalCode       = this.postalcode.Text,
                    DateOfBirth      = ParseDateTime(this.dateofbirth.Text),
                    SalutationCode   = ParseInt(this.titles.SelectedValue),
                },
                IsRegularGift           = this.isregulargift.Checked,
                DpsTransactionReference = this.transactionreference.Text,
                CCExpiry             = this.ccexpirydate.Text,
                Comments             = this.comments.Text,
                Amount               = ParseDecimal(this.amount.Text),
                Date                 = DateTime.Now,
                DpsPaymentSuccessful = true,
                DpsResponseText      = this.dpsresponse.Text,
                CampaignId           = ParseGuid(this.campaigns.SelectedValue),
                ReasonForHelpingId   = ParseGuid(this.reasonsforhelping.SelectedValue),
                RegionCode           = "CNZ",
                Pledge               = new Pledge
                {
                    DpsBillingId         = this.dpsbillingid.Text,
                    PaymentFrequencyCode = ParseInt(this.frequencies.SelectedValue),
                    StartDate            = ParseDateTime(this.startdate.Text),
                    EndDate = ParseDateTime(this.enddate.Text)
                }
            };

            DonationService service = new DonationService();

            service.PostDonation(d);

            Response.Redirect("/_test/donations-test.aspx");
        }
        public static void Main(string[] args)
        {
            ICaseRepository      caseRepository      = new CaseDbRepository();
            IDonorRepository     donorRepository     = new DonorDbRepository();
            IVolunteerRepository volunteerRepository = new VolunteerDbRepository();
            IDonationRepository  donationRepository  = new DonationDbRepository();

            CaseService      caseService      = new CaseService(caseRepository);
            DonorService     donorService     = new DonorService(donorRepository);
            VolunteerService volunteerService = new VolunteerService(volunteerRepository);
            DonationService  donationService  = new DonationService(donationRepository);

            IService serverService = new ServerService(caseService, donorService, volunteerService, donationService);

            SerialConcurrentServer server = new SerialConcurrentServer("127.0.0.1", 55555, serverService);

            server.Start();
        }
        static void Main(string[] args)
        {
            VolunteerRepository volunteerRepository = new VolunteerRepository();
            VolunteerService    volunteerService    = new VolunteerService(volunteerRepository);

            DonorRepository    donorRepository    = new DonorRepository();
            DonationRepository donationRepository = new DonationRepository();
            CaseRepository     caseRepository     = new CaseRepository();
            DonationService    donationService    = new DonationService(caseRepository, donorRepository, donationRepository);

            // Volunteer volunteer = volunteerRepository.FindOne("admin", "admin");
            // Console.WriteLine("voluntar: "+volunteer.Username);

            ServerService serverService = new ServerService(volunteerService, donationService);
            SerialServer  server        = new SerialServer("127.0.0.1", 55555, serverService);

            server.Start();
            Console.WriteLine("Server started... ");
            //Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Esempio n. 19
0
 public DonationController(DonationService donationService)
 {
     _donationService = donationService;
 }
Esempio n. 20
0
 public List <Donation> GetByUserID(int uid)
 {
     return(DonationService.GetByUserID(uid));
 }
Esempio n. 21
0
 public DonationController(EFContext context, DonationService service)
 {
     Context = context;
     Service = service;
 }
Esempio n. 22
0
 public List <Donation> GetAll()
 {
     return(DonationService.GetAll());
 }
Esempio n. 23
0
 public List <Donation> GetByPostID(int pid)
 {
     return(DonationService.GetByPostID(pid));
 }
Esempio n. 24
0
 public DonationController(UserService userService, DonationService donationService)
 {
     _userService     = userService;
     _donationService = donationService;
 }
 public DonationController(DonationService database)
 {
     _database = database;
 }
Esempio n. 26
0
 public DonationController(DonationService donationService, ITransactional transactional)
 {
     _donationService = donationService;
     _transactional   = transactional;
 }
Esempio n. 27
0
 public ListarDoacao()
 {
     InitializeComponent();
     ConfigurarDatagrid();
     donationService = new DonationService();
 }
Esempio n. 28
0
        public ActionResult PaymentGateway(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);


            string hash_string = string.Empty;

            string[] hashVarsSeq;
            var      Key     = ConfigurationManager.AppSettings["MERCHANT_KEY"];
            Random   rnd     = new Random();
            string   strHash = Generatehash512(rnd.ToString() + DateTime.Now);

            txnid1 = strHash.ToString().Substring(0, 20);

            hashVarsSeq = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config
            hash_string = "";
            foreach (string hash_var in hashVarsSeq)
            {
                if (hash_var == "key")
                {
                    hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"];
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "txnid")
                {
                    hash_string = hash_string + txnid1;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "amount")
                {
                    hash_string = hash_string + Convert.ToDecimal(DonationAmount).ToString("g29");
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "productinfo")
                {
                    hash_string = hash_string + Donationdata.Donation_Title;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "firstname")
                {
                    hash_string = hash_string + UserDetails.FirstName;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "email")
                {
                    hash_string = hash_string + "*****@*****.**";
                    hash_string = hash_string + '|';
                }
                else
                {
                    hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else
                    hash_string = hash_string + '|';
                }
            }

            hash_string += ConfigurationManager.AppSettings["SALT"];                        // appending SALT
            hash1        = Generatehash512(hash_string).ToLower();                          //generating hash
            action1      = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL

            System.Collections.Hashtable data = new System.Collections.Hashtable();         // adding values in gash table for data post
            data.Add("hash", hash1);
            data.Add("txnid", txnid1);
            data.Add("key", Key);
            string AmountForm = Convert.ToDecimal(DonationAmount).ToString("g29");// eliminating trailing zeros

            data.Add("amount", AmountForm);
            data.Add("firstname", UserDetails.FirstName);
            data.Add("email", "*****@*****.**");
            data.Add("phone", "8985143792");
            data.Add("productinfo", Donationdata.Donation_Title);
            data.Add("surl", "http://www.google.com");
            data.Add("furl", "http://www.google.com");

            string strForm = PreparePOSTForm(action1, data);

            ViewBag.Form = strForm;
            return(View());
        }
Esempio n. 29
0
 public ServerService(VolunteerService volunteerService, DonationService donationService)
 {
     this.volunteerService = volunteerService;
     this.donationService  = donationService;
     observers             = new List <ITeledonObserver>();
 }
Esempio n. 30
0
 // GET: Donate
 public DonateController()
 {
     _donationAppointmentService = new DonationAppointmentService(new DonationAppointmentRepo());
     _donationService            = new DonationService(new DonationRepo());
 }