private List <int> ProcessSM() { SM_MsgBLL smBLL = new SM_MsgBLL(); smBLL.Model.Sender = (string)Session["UserName"]; smBLL.Model.SendTime = DateTime.Now; smBLL.Model.Content = "您从" + (string)Session["UserName"] + "处收到了一封新的邮件"; smBLL.Model.Type = 1; smBLL.Model.IsDelete = "N"; int id = smBLL.Add(); string recipients = Request.Form["hdnTxtSendTo"].ToString() + Request.Form["hdnTxtCcTo"].ToString() + Request.Form["hdnTxtBccTo"].ToString(); string[] separators = new string[] { "," }; string[] senders; senders = recipients.Split(separators, StringSplitOptions.RemoveEmptyEntries); SM_ReceiverBLL _bll = new SM_ReceiverBLL(); List <int> receiverList = new List <int>(); foreach (string s in senders) { _bll.Model.MsgID = id; _bll.Model.IsRead = "N"; _bll.Model.IsDelete = "N"; _bll.Model.Receiver = s; receiverList.Add(_bll.Add()); } return(receiverList); }
/// <summary> /// 发送短讯 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSend_Click(object sender, EventArgs e) { SendTo = Request.Form["hdnTxtSendTo"].ToString(); string recipients = this.SendTo; if (recipients.EndsWith(",")) recipients = recipients.Substring(0, recipients.Length - 1); recipients = recipients.Replace(",", ","); string[] separators = new string[] { "," }; string[] senders; senders = recipients.Split(separators, StringSplitOptions.RemoveEmptyEntries); SM_MsgBLL bll = new SM_MsgBLL(); bll.Model.Sender = (string)Session["UserName"]; bll.Model.Content = this.ckedit_content.Text; bll.Model.SendTime = DateTime.Now; bll.Model.Type = 1; bll.Model.IsDelete = "N"; int id = bll.Add(); SM_ReceiverBLL _receiverbll = new SM_ReceiverBLL(); foreach (string s in senders) { _receiverbll.Model.MsgID = id; _receiverbll.Model.IsRead = "N"; _receiverbll.Model.IsDelete = "N"; _receiverbll.Model.Receiver = s; int i = _receiverbll.Add(); } MessageBox.ShowAndClose(this, "站内短讯发送成功!"); }
/// <summary> /// 新信息页面 /// </summary> /// protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] == null) { int _id = 0; ViewState["ID"] = SM_ReceiverBLL.GetNextID(_id, (string)Session["UserName"]); } else { ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); } if ((int)ViewState["ID"] > 0) { hasNext(); SM_ReceiverBLL r = new SM_ReceiverBLL((int)ViewState["ID"]); SM_MsgBLL _m = new SM_MsgBLL(r.Model.MsgID); ViewState["MsgID"] = r.Model.MsgID; this.txtRealName.Text = _m.Model.Sender.ToString(); this.ltlContent.Text = _m.Model.Content.ToString(); this.txt_msgtime.Text = _m.Model.SendTime.ToString(); this.btnReply.Enabled = true; } else { MessageBox.Show(this, "没有新短讯需要读取!"); RegisterClientScriptBlock("Close", "<script language='JavaScript'>window.close();</script>"); } }
private void SendSM(string Receiver, string Content) { SM_MsgBLL bll = new SM_MsgBLL(); bll.Model.Sender = Session["UserName"].ToString(); bll.Model.Content = Content; bll.Model.SendTime = DateTime.Now; bll.Model.Type = 1; bll.Model.IsDelete = "N"; int id = bll.Add(); SM_ReceiverBLL _receiverbll = new SM_ReceiverBLL(); _receiverbll.Model.MsgID = id; _receiverbll.Model.IsRead = "N"; _receiverbll.Model.IsDelete = "N"; _receiverbll.Model.Receiver = Receiver; _receiverbll.Add(); }
/// <summary> /// 绑定SendMsg /// </summary> public void BindGridSendMsg() { string sender = (string)Session["UserName"]; DataTable dt = SM_MsgBLL.GetSendMsg(sender); if (ViewState["Sort"] != null) { dt.DefaultView.Sort = ViewState["Sort"].ToString() + " " + ViewState["SortDirect"]; } if (ViewState["PageIndex"] != null) { ud_Grid_Send.PageIndex = Int32.Parse(ViewState["PageIndex"].ToString()); } if (tbx_SelectContent.Text != "") { dt.DefaultView.RowFilter = "" + ddl_sampleSelect.SelectedValue + " like '" + tbx_SelectContent.Text.Trim() + "%'"; } ud_Grid_Send.DataSource = dt.DefaultView; ud_Grid_Send.DataBind(); }
/// <summary> /// 发送短讯 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSend_Click(object sender, EventArgs e) { SendTo = Request.Form["hdnTxtSendTo"].ToString(); string recipients = this.SendTo; if (recipients.EndsWith(",")) { recipients = recipients.Substring(0, recipients.Length - 1); } recipients = recipients.Replace(",", ","); string[] separators = new string[] { "," }; string[] senders; senders = recipients.Split(separators, StringSplitOptions.RemoveEmptyEntries); SM_MsgBLL bll = new SM_MsgBLL(); bll.Model.Sender = (string)Session["UserName"]; bll.Model.Content = this.ckedit_content.Text; bll.Model.SendTime = DateTime.Now; bll.Model.Type = 1; bll.Model.IsDelete = "N"; int id = bll.Add(); SM_ReceiverBLL _receiverbll = new SM_ReceiverBLL(); foreach (string s in senders) { _receiverbll.Model.MsgID = id; _receiverbll.Model.IsRead = "N"; _receiverbll.Model.IsDelete = "N"; _receiverbll.Model.Receiver = s; int i = _receiverbll.Add(); } MessageBox.ShowAndClose(this, "站内短讯发送成功!"); }
private List<int> ProcessSM() { SM_MsgBLL smBLL = new SM_MsgBLL(); smBLL.Model.Sender = (string)Session["UserName"]; smBLL.Model.SendTime = DateTime.Now; smBLL.Model.Content = "您从" + (string)Session["UserName"] + "处收到了一封新的邮件"; smBLL.Model.Type = 1; smBLL.Model.IsDelete = "N"; int id = smBLL.Add(); string recipients = Request.Form["hdnTxtSendTo"].ToString() + Request.Form["hdnTxtCcTo"].ToString() + Request.Form["hdnTxtBccTo"].ToString(); string[] separators = new string[] { "," }; string[] senders; senders = recipients.Split(separators, StringSplitOptions.RemoveEmptyEntries); SM_ReceiverBLL _bll = new SM_ReceiverBLL(); List<int> receiverList = new List<int>(); foreach (string s in senders) { _bll.Model.MsgID = id; _bll.Model.IsRead = "N"; _bll.Model.IsDelete = "N"; _bll.Model.Receiver = s; receiverList.Add(_bll.Add()); } return receiverList; }
protected void bt_SendDeleteAll_Click(object sender, EventArgs e) { SM_MsgBLL.DeleteAll((string)Session["UserName"]); BindGridSendMsg(); }