/// <summary> /// 发放单人礼包按钮点击响应 /// </summary> protected void singleGiftButton_Click(object sender, EventArgs e) { if (this.selectListBox.Items.Count != 1 || string.IsNullOrEmpty(this.selectListBox.Items[0].Value)) { this.errorLabel.Text = TableManager.GetGMTText(720); return; } if (string.IsNullOrEmpty(this.uidTextBox.Text)) { this.errorLabel.Text = TableManager.GetGMTText(721); return; } string account = Session["user"] as string; gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[0].Value); int giftId = 0; if (!int.TryParse(this.giftOptionDropDownList.SelectedValue, out giftId)) { return; } uint playerId = this.GetPlayerId(); if (playerId == 0) { return; } string gmcmd = string.Format("GIFT({0},{1})", playerId, giftId); bool isGiftTimeOn = (Request.Form["gift_timer_checker"] == "on") ? true : false; string give_time = this.datetimepicker_1.Value; if (isGiftTimeOn) { STTimedMail stMailInfo = new STTimedMail(); stMailInfo.uid = playerId; stMailInfo.mailId = giftId; stMailInfo.serverName = this.selectListBox.Items[0].Value; stMailInfo.sendTime = CUtils.GetTimestamp(Convert.ToDateTime(give_time)); stMailInfo.cmd = gmcmd; TimedMailSender.AddTimedMail(stMailInfo); } else { AGmPage.ExecuteGmCommand(account, server, playerId.ToString(), gmcmd, "", true, text => this.errorLabel.Text += text); } }
public static bool AddTimedMail(STTimedMail stMail) { bool bRet = false; lock (m_dicTimedMails) { //if (m_dicTimedMails.Count() <= 10) //{ int id = _GenMailId(); stMail.id = id; m_dicTimedMails.Add(id, stMail); _dirty = true; bRet = true; //} } return(bRet); }
/// <summary> /// 发放全员礼包按钮点击响应 /// </summary> protected void wholeGiftButton_Click(object sender, EventArgs e) { int giftId = 0; if (!int.TryParse(this.giftOptionDropDownList.SelectedValue, out giftId)) { return; } uint playerId = 0; bool isGiftTimeOn = (Request.Form["gift_timer_checker"] == "on") ? true : false; string give_time = this.datetimepicker_1.Value; string gmcmd = string.Format("GIFT({0},{1})", playerId, giftId); string account = Session["user"] as string; for (int i = 0; i < selectListBox.Items.Count; ++i) { gmt.Server server = gmt.Server.GetServer(selectListBox.Items[i].Text); if (server == null) { this.errorLabel.Text += TableManager.GetGMTText(733) + ":" + selectListBox.Items[i].Text; continue; } if (isGiftTimeOn) { STTimedMail stMailInfo = new STTimedMail(); stMailInfo.uid = playerId; stMailInfo.mailId = giftId; stMailInfo.serverName = selectListBox.Items[i].Text; stMailInfo.sendTime = CUtils.GetTimestamp(Convert.ToDateTime(give_time)); stMailInfo.cmd = gmcmd; TimedMailSender.AddTimedMail(stMailInfo); } else { AGmPage.ExecuteGmCommand(account, server, playerId.ToString(), gmcmd, "", true, text => this.errorLabel.Text += text); } } }
private static bool _SendMail(STTimedMail stMail) { Server server = Server.GetServer(stMail.serverName); return(AGmPage.ExecuteGmCommand("SYSTEM", server, "0", stMail.cmd, "", true, null)); }