public static void SubtractTotal(string vote_id, string sbjt_mat, DynamicTableEntity e) { string partition_key = vote_id; string row_key = e.RowKey; TallyInfo info = new TallyInfo(e); TableResult result = Warehouse.TotalsTable.Execute(TableOperation.Retrieve(partition_key, row_key)); DynamicTableEntity entity = (DynamicTableEntity)result.Result; if (entity != null) { //int tpt = (int)e[Consts.TPT_PROP_NAME].Int32Value; int tpt = info.tpt; entity[Consts.TPT_PROP_NAME].Int32Value -= tpt; Warehouse.TotalsTable.Execute(TableOperation.Replace(entity)); Warehouse.TotalsPartitionPond.AddOrUpdate(partition_key, row_key, entity); TotalsDamper.Update(vote_id, new TallyInfo() { sbjt_mat = sbjt_mat, ansr_mat = info.ansr_mat, tpt = (int)entity[Consts.TPT_PROP_NAME].Int32Value }); } }
public static void Update(string vote_id, TallyInfo tally_info) { lock (dict) { List <TallyInfo> list; if (!dict.TryGetValue(vote_id, out list)) { list = new List <TallyInfo>(); dict.Add(vote_id, list); } list.Add(tally_info); } }