public bool addUserItem(string _user, string _full_name) { if (this.IsDenyUserBill(_user)) { return(false); } if (this.getSettingDenyUserManyBill() == true && this.IsManyBillByUser(_user)) { return(false); } if (this.getCountInTPUserItems(_user) >= this.getSettingUserMaxBillCount()) { return(false); } TP_ITEM tpI = this.findTPItem(_full_name); if (tpI != null) { this.tpUserItem.Add(new TP_USER_ITEM(tpI.id, _user)); this.tpItem[this.tpItem.IndexOf(tpI)].count++; this.showTPInfo(); if (this.getSettingSuccessSendDM()) { this._tpj.AddDM("用户[" + _user.Trim() + "] 投票 [" + tpI.item + "] 成功"); } return(true); } return(false); }
private string TP_getResult(out long Count, out string lastName, out long lastCount) { TP_ITEM current = new TP_ITEM(0, "", -1); TP_ITEM last = null; foreach (TP_ITEM i in this.tpItem) { if (i.count > current.count) { last = current; current = i; } } Count = current.count; if (current != null) { lastName = current.item; lastCount = current.count; } else { lastCount = 0; lastName = ""; } return(current.item); }
private void showTPInfo() { this.dgv_tp_info.Rows.Clear(); foreach (TP_USER_ITEM i in this.tpUserItem) { TP_ITEM current = this.findTPItem(i.tp_id); this.dgv_tp_info.Rows.Add(i.user_name, current == null ? Convert.ToString(i.tp_id) : current.item); } }