Exemple #1
0
        public static void AddTallies(string vote_id, string user_name, string sbjt_mat, TallyData[] tallies)
        {
            foreach (TallyData tally_data in tallies)
            {
                addTally(vote_id, user_name, sbjt_mat, tally_data);

                TotalStore.AddTotal(vote_id, sbjt_mat, tally_data);
            }
        }
Exemple #2
0
        public ActionResult GetTotals(string vote_id)
        {
            IEnumerable <TallyInfo> totals = TotalStore.GetTotals(vote_id);

            return(Json(new
            {
                code = ResultCode.Success,
                totals = totals,
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public override void ExecuteResult(ControllerContext context)
        {
            TextWriter writer = context.HttpContext.Response.Output;

            IEnumerable <TallyInfo> totals = TotalStore.GetTotals(this.voteId);

            string output = JsonConvert.SerializeObject(totals);

            writer.Write(output);
        }
Exemple #4
0
        public static void ResetTallies(string vote_id, string user_name, string sbjt_mat)
        {
            string partition_key = vote_id + Consts.NAME_CONCAT + user_name;

            Warehouse.TalliesTable.EnumerateRowPrefix(partition_key, sbjt_mat,
                                                      entity =>
            {
                Warehouse.TalliesTable.Execute(TableOperation.Delete(entity));

                TotalStore.SubtractTotal(vote_id, sbjt_mat, entity);
            });
            Warehouse.TalliesPartitionPond.Notify(partition_key);
        }