protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (string.IsNullOrEmpty(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId))) { MessageBox.ShowAndRedirects(this, "请重新登录!", "/admin/Login.aspx"); } else { bindMenu(); litAvatar.Text = "<img id=\"user_avatar\" alt=\"image\" width=\"64px\" height=\"64px\" class=\"img-circle\" src=\"" + Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_Avatar) + "\" />"; litUserInfo.Text = "<span class=\"block m-t-xs\"><strong class=\"font-bold\">" + DESEncrypt.Decrypt(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_TrueName)) + "</strong></span><span class=\"text-muted text-xs block\">" + DESEncrypt.Decrypt(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_RoleName)) + "<b class=\"caret\"></b></span>"; litTopinfo.Text = "今天是" + DateTime.Now.ToString("yyyy年MM月dd日") + Common.CommonHelper.getDayOfWeek(DateTime.Now) + " 欢迎您!<span>您上次的登录日期是:" + Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_LastLoginTime) + "</span>"; BLL.message mbll = new BLL.message(); int unreadCount = mbll.GetList("receiverId=" + Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId) + " and status=" + StatusHelpercs.Message_Status_UnRead).Tables[0].Rows.Count; int readCount = mbll.GetList("receiverId=" + Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId) + " and status=" + StatusHelpercs.Message_Status_Read).Tables[0].Rows.Count; litMessageCount.Text = unreadCount.ToString(); litUnReadCount.Text = unreadCount.ToString(); litReadCount.Text = readCount.ToString(); } } }
private void stu_message_Load(object sender, EventArgs e) { BLL.message bll = new BLL.message(); Model.message model = bll.GetModel(id);//绑定账号 if (model == null) { MessageBox.Show("数据查询出错"); return; } else { name_stu.Text = model.name; sex_stu.Text = model.sex; number_stu.Text = model.id; major_stu.Text = model.major; grade.Text = model.grade; ban.Text = model.Class; phone.Text = model.phone; email.Text = model.email; textBox1.Text = model.introduce; } }
/// <summary> /// 发送消息 /// </summary> /// <param name="title"></param> /// <param name="remark"></param> /// <param name="receiverId">接收者</param> /// <param name="senderId">发送者0为系统</param> /// <param name="type">类型0系统1站内信</param> /// <returns></returns> public static bool sendMessage(string title,string remark,int receiverId,int senderId,int type ) { try { BLL.message mbll = new BLL.message(); Model.message model = new Model.message(); model.receiverId = receiverId; model.receiverName = new BLL.users().GetModel(receiverId).userName; model.senderId = senderId; if (senderId == 0) { model.senderName = "系统"; } else { model.senderName = new BLL.users().GetModel(senderId).userName; } model.title = title; model.remark = remark; model.type = type; model.addTime = DateTime.Now; model.status = StatusHelpercs.Message_Status_UnRead; mbll.Add(model); return true; } catch { return false; } }