public ActionResult History(int contributorId)
        {
            var cManager     = new ContributorManager(Settings.Default.Constr);
            var contributors = cManager.GetContributionsByContributorID(contributorId);
            var deposits     = cManager.GetDepositByContributorId(contributorId);

            IEnumerable <History> historys = contributors.Select(c => new History
            {
                Action = $"Contribution to {c.SimchaName}",
                Date   = c.SimchaDate,
                Amount = c.Amount
            }).Concat(deposits.Select(d => new History
            {
                Action = "Deposit",
                Date   = d.Date,
                Amount = d.DepositAmount
            }));

            var vm = new ShowHistoryViewModel
            {
                Historys    = historys,
                Contributor = cManager.GetContributorById(contributorId)
            };

            return(View(vm));
        }
        public ActionResult UpdateContributor(Contributor contributor)
        {
            var cManager = new ContributorManager(Settings.Default.Constr);

            cManager.UpdateContributor(contributor);
            return(RedirectToAction("Index"));
        }
        public ActionResult AddDeposit(Deposit deposit)
        {
            var cManager = new ContributorManager(Settings.Default.Constr);

            cManager.AddDeposit(deposit);
            return(RedirectToAction("Index"));
        }
        // GET: Contributor
        public ActionResult Index()
        {
            var cManager = new ContributorManager(Settings.Default.Constr);
            var vm       = new ContributorIndexViewModel
            {
                Contributors = cManager.GetContributors()
            };

            vm.TotalBalance = vm.Contributors.Sum(c => c.Balance);
            return(View(vm));
        }
        public ActionResult EmailOrganizer(int simchaId)
        {
            var cManager = new ContributorManager(Settings.Default.Constr);
            var sManager = new SimchaManager(Settings.Default.Constr);
            var vm       = new EmailOrganizerViewModel()
            {
                Contributors = cManager.GetContributorsBySimchaId(simchaId),
                Simcha       = sManager.GetSimchaById(simchaId)
            };

            return(View(vm));
        }
        public ActionResult Contributions(int simchaId)
        {
            var cManager = new ContributorManager(Settings.Default.Constr);
            var sManager = new SimchaManager(Settings.Default.Constr);
            var vm       = new ContributionViewModel
            {
                Simcha       = sManager.GetSimchaById(simchaId),
                Contributors = cManager.GetContributorContributions(simchaId)
            };

            return(View(vm));
        }
        // GET: Simcha
        public ActionResult Index()
        {
            var cManager = new ContributorManager(Settings.Default.Constr);
            var sManager = new SimchaManager(Settings.Default.Constr);
            var vm       = new SimchaIndexViewModel
            {
                Simchos          = sManager.GetSimchos(),
                ContributorCount = cManager.GetContributorCount()
            };

            return(View(vm));
        }
Beispiel #8
0
        void OnInitialize(EventArgs e)
        {
            #region Config

            string path = Path.Combine(TShock.SavePath, "CTRSystem", "CTRS-Config.json");
            Config    = Configuration.ConfigFile.Read(path);
            Formatter = new TextFormatter(this, Config);

            #endregion

            #region Commands

            Commands = new CommandManager(this);

            Action <Command> Add = c =>
            {
                TShockAPI.Commands.ChatCommands.RemoveAll(c2 => c2.Names.Exists(s => c.Names.Contains(s)));
                TShockAPI.Commands.ChatCommands.Add(c);
            };

            Add(new Command(Permissions.Admin, Commands.CAdmin, "cadmin")
            {
                HelpText = "Perform administrative actions across the Contributions Track & Reward System."
            });

            Add(new Command(Permissions.Commands, Commands.Contributions,
                            new List <string>(Config.AdditionalCommandAliases)
            {
                "ctrs"
            }.ToArray())
            {
                HelpText = "Manages contributor settings. You must have contributed at least once before using this command."
            });

            Add(new Command(Permissions.Auth, Commands.Authenticate, "auth", "authenticate")
            {
                DoLog    = false,
                HelpText = "Connects your Xenforo account to your TShock account. Enter your forum credentials OR generate an auth code first by visiting your user control panel."
            });

            #endregion

            _tierUpdateTimer          = new Timer(Config.TierRefreshMinutes * 60 * 1000);
            _tierUpdateTimer.Elapsed += UpdateTiers;
            _tierUpdateTimer.Start();

            Contributors     = new ContributorManager(this);
            CredentialHelper = new LoginManager(this);
            Rests            = new RestManager(this);
            Tiers            = new TierManager(this);
            XenforoUsers     = new XenforoManager(this);
        }