public override bool PreExecute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); //--- Do Some Sanity Checks //--- if some problems => return true; return(base.PreExecute(ctx)); }
public bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); td.taxparams.TaxLiability = 1000; td.taxparams.Computed = true; return(true); }
public override bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); //---- Compute the Tax for Senior Citizens //---- They belong to different Slabs td.taxparams.TaxLiability = 1500; return(true); }
public override bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); //---- Compute the Tax for Others //---- They belong to different Slabs //----- After computation 5000 was assigned :) td.taxparams.TaxLiability = 5000; return(true); }
public bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); //---- Instead of computation, we are assigning //---- constant tax for each arcetypes td.taxparams.TaxLiability = 1000; td.taxparams.Computed = true; return(true); }
public static bool Compute(TaxableEntity te) { string archetype = ComputeArchetype(te); COMPUTATION_CONTEXT ctx = new COMPUTATION_CONTEXT(); TaxDTO td = new TaxDTO { id = te.id, taxparams = te.taxparams }; ctx.Put("tax_cargo", td); return(CommandDispatcher.Dispatch(archetype, ctx)); }
public bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); double accum = td.taxparams.Basic + td.taxparams.DA + td.taxparams.Allowance + td.taxparams.HRA; double net = accum - td.taxparams.Deductions - td.taxparams.Surcharge; //---- Flat 10% Tax td.taxparams.TaxLiability = net * 0.1; td.taxparams.Computed = true; return(true); }
public override bool Execute(COMPUTATION_CONTEXT ctx) { TaxDTO td = (TaxDTO)ctx.Get("tax_cargo"); //---- Compute the Tax for Senior Females //---- They belong to different Slabs double accum = td.taxparams.Basic + td.taxparams.DA + td.taxparams.Allowance + td.taxparams.HRA; double net = accum - td.taxparams.Deductions - td.taxparams.Surcharge; //---- Flat 10% Tax td.taxparams.TaxLiability = net * 0.1; return(true); }
public static bool Dispatch(string archetype, COMPUTATION_CONTEXT ctx) { ComputationCommand cmd = obj.Get(archetype); if (cmd == null) { return(false); } if (cmd.PreExecute(ctx)) { bool rs = cmd.Execute(ctx); cmd.PostExecute(ctx); return(rs); } return(false); }
public static bool Dispatch(string archetype, COMPUTATION_CONTEXT ctx) { if (archetype == "SeniorCitizen") { SeniorCitizenCommand cmd = new SeniorCitizenCommand(); return(cmd.Execute(ctx)); } else if (archetype == "OrdinaryCitizen") { OrdinaryCitizenCommand cmd = new OrdinaryCitizenCommand(); return(cmd.Execute(ctx)); } else { return(false); } }
public virtual bool Execute(COMPUTATION_CONTEXT ctx) { return(true); }
public override bool PostExecute(COMPUTATION_CONTEXT ctx) { //--- Do the Check on Invariants //--- Retrun false, if there is violation return(base.PostExecute(ctx)); }
public static bool Dispatch(string archetype, COMPUTATION_CONTEXT ctx) { ComputationCommand cmd = obj.Get(archetype); return((cmd == null) ? false : cmd.Execute(ctx)); }