public AdHocJobCmdsVM(MainWindowVM mainWindowVM) { _main = mainWindowVM; _dir = _main.AppArgs; AdHocJobCmd1 = R2Command.Relay(_ => RunAdHoc(1), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 1"); AdHocJobCmd2 = R2Command.Relay(_ => RunAdHoc(2), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 2"); AdHocJobCmd3 = R2Command.Relay(_ => RunAdHoc(3), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 3"); }
public static Action SetYearsBack_1(ITenantDBsDir dir, out string jobDesc, out bool canRun) { canRun = dir.CanRunAdHocTask(false); jobDesc = "Set YearsBackCount to [1]"; return(() => { dir.MarketState.YearsBackCount = 1; }); }
public static Action ApplyTo(string branchName, ITenantDBsDir dir, out string desc, out bool canRun) { canRun = dir.CanRunAdHocTask(false); desc = $"Apply Rate increase for {branchName}"; return(() => { var activs = dir.MarketState.ActiveLeases.GetAll(); var filtrd = RemoveExemptions(activs, branchName); foreach (var lse in filtrd) { ExecuteRateIncrease(lse, dir); } }); }
public static Action SetNoBackRent(ITenantDBsDir dir, out string jobDesc, out bool canRun) { canRun = dir.CanRunAdHocTask(false); jobDesc = "Zero-Backrent for Night Market leases"; return(() => { var mkt = dir.MarketState; var secId = 13062; EditStallTemplate(mkt, secId); EditAndRecompute(dir, secId, mkt.ActiveLeases); EditAndRecompute(dir, secId, mkt.InactiveLeases); }); }
public static Action SetStallDefaults(ITenantDBsDir dir, out string jobDesc, out bool canRun) { canRun = dir.CanRunAdHocTask(false); jobDesc = "Set Stall Defaults"; return(() => { var repo = dir.MarketState.Stalls; foreach (var stall in repo.GetAll()) { if (stall.DefaultRent == null || stall.DefaultRights == null) { var tupl = FindStallDefaults(stall, dir); stall.DefaultRent = tupl.Rent; stall.DefaultRights = tupl.Rights; repo.Update(stall); } } }); }