protected void btnSend_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <string> userList = this.GetUserList(); System.Collections.Generic.IEnumerable <string> enumerable = userList.Distinct <string>(); System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>(); if (enumerable.Count <string>() > 0) { System.Collections.Generic.List <Mail> list = new System.Collections.Generic.List <Mail>(); string value = string.Empty; int num = 0; foreach (string current in enumerable) { value = System.Guid.NewGuid().ToString(); dictionary.Add(current, value); string toMailId = System.Guid.NewGuid().ToString(); list.Add(new Mail { MailId = value, ToMailId = toMailId, MailName = this.txtName.Text.Trim(), MailFrom = base.UserCode, MailTo = current, AllMailToCode = this.hfldTo.Value, AllMailTo = this.txtTo.Text, AllCopytoCode = this.hfldCopyto.Value, AllCopyto = this.txtCopyto.Text, MailContent = this.txtContent.Value, IsValid = true, IsReaded = false, MailType = "I", AnnexId = (string)this.ViewState["annexId"], InputDate = System.DateTime.Now.AddSeconds((double)num) }); list.Add(new Mail { MailId = System.Guid.NewGuid().ToString(), ToMailId = toMailId, MailName = this.txtName.Text.Trim(), MailFrom = base.UserCode, MailTo = current, AllMailToCode = this.hfldTo.Value, AllMailTo = this.txtTo.Text, AllCopytoCode = this.hfldCopyto.Value, AllCopyto = this.txtCopyto.Text, MailContent = this.txtContent.Value, IsValid = true, IsReaded = false, MailType = "O", AnnexId = (string)this.ViewState["annexId"], InputDate = System.DateTime.Now.AddSeconds((double)num) }); num++; } if (!string.IsNullOrEmpty(this.mailId) && this.edit == "1") { this.mailService.Delete(this.mailId); } this.mailService.AddOrUpdate(list); if (this.chkMobileMsg.Checked) { this.SendMobileMsg(); } if (this.chkDbsj.Checked) { this.SendDbsj(dictionary); } this.hfldMailId.Value = value; base.RegisterScript("selectSend();"); return; } base.RegisterScript("alert('收件人不能为空!');"); }