Exemple #1
0
        public ActionResult Contributors(int SimchaId)
        {
            ContributorsDB  CDB = new ContributorsDB(Properties.Settings.Default.ConStr);
            SimchasDB       SDB = new SimchasDB(Properties.Settings.Default.ConStr);
            UpdateViewModel uvm = new UpdateViewModel();

            uvm.Simcha = SDB.GetById(SimchaId);
            IEnumerable <Contributor> contributors = CDB.GetAllContributors();
            List <SimchaContributor>  result       = new List <SimchaContributor>();

            foreach (Contributor c in contributors)
            {
                SimchaContributor sc = new SimchaContributor
                {
                    ContributorId = c.Id,
                    Name          = c.FirstName + " " + c.LastName,
                    AlwaysInclude = c.AlwaysInclude,
                    Balance       = CDB.GetBalance(c.Id),
                    Include       = CDB.ContributedAlready(SimchaId, c.Id),
                    Amount        = CDB.ContributedAmount(SimchaId, c.Id)
                };
                result.Add(sc);
            }
            uvm.SimchaContributorList = result;
            return(View(uvm));
        }
Exemple #2
0
        public ActionResult addSimcha(Simcha s)
        {
            SimchasDB SDB = new SimchasDB(Properties.Settings.Default.ConStr);

            SDB.AddSimcha(s);
            TempData["SimchaAdded"] = s;
            return(RedirectToAction("/index"));
        }
Exemple #3
0
        public ActionResult List(int SimchaId)
        {
            SimchasDB             SDB = new SimchasDB(Properties.Settings.Default.ConStr);
            ContributorsViewModel cvm = new ContributorsViewModel();

            cvm.Contributors = ContributorToContributorPlus(SDB.GetContributorsForSimcha(SimchaId));
            cvm.Simcha       = SDB.GetById(SimchaId);
            return(View(cvm));
        }
Exemple #4
0
        public ActionResult Index()
        {
            SimchasDB            SDB     = new SimchasDB(Properties.Settings.Default.ConStr);
            ContributorsDB       CDB     = new ContributorsDB(Properties.Settings.Default.ConStr);
            SimchasViewModel     svm     = new SimchasViewModel();
            IEnumerable <Simcha> simchas = SDB.GetAllSimchas();

            svm.Simchas           = SimchaToSimchaPlus(simchas);
            svm.ContributorsCount = CDB.TotalNumberContributors();
            if (TempData["SimchaAdded"] != null)
            {
                svm.NewSimcha = (Simcha)TempData["SimchaAdded"];
            }
            return(View(svm));
        }
Exemple #5
0
        private IEnumerable <SimchaPlus> SimchaToSimchaPlus(IEnumerable <Simcha> simchas)
        {
            SimchasDB         SDB    = new SimchasDB(Properties.Settings.Default.ConStr);
            ContributorsDB    CDB    = new ContributorsDB(Properties.Settings.Default.ConStr);
            List <SimchaPlus> result = new List <SimchaPlus>();

            foreach (Simcha s in simchas)
            {
                SimchaPlus sp = new SimchaPlus
                {
                    Id             = s.Id,
                    Name           = s.Name,
                    Date           = s.Date,
                    TotalDonations = SDB.GetTotalDeposits(s.Id),
                    Contributors   = CDB.NumberContributorsForSimcha(s.Id)
                };
                result.Add(sp);
            }
            ;
            return(result);
        }