private bool DoAdd() { bool result = true; Model.user_message model = new Model.user_message(); BLL.user_message bll = new BLL.user_message(); model.title = txtTitle.Text.Trim(); model.content = txtContent.Value; string[] arrUserName = txtUserName.Text.Trim().Split(','); if (arrUserName.Length > 0) { foreach (string username in arrUserName) { if (new BLL.users().Exists(username)) { model.accept_user_name = username; if (bll.Add(model) < 1) { result = false; } } } } return result; }
/// <summary> /// 重写虚方法,此方法在Init事件执行 /// </summary> protected override void InitPage() { action = MXRequest.GetQueryString("action"); //获得最后登录日志 DataTable dt = new BLL.user_login_log().GetList(2, "user_name='" + userModel.user_name + "'", "id desc").Tables[0]; if (dt.Rows.Count == 2) { curr_login_ip = dt.Rows[0]["login_ip"].ToString(); pre_login_ip = dt.Rows[1]["login_ip"].ToString(); pre_login_time = dt.Rows[1]["login_time"].ToString(); } else if (dt.Rows.Count == 1) { curr_login_ip = dt.Rows[0]["login_ip"].ToString(); } //未完成订单 total_order = new BLL.orders().GetCount("user_name='" + userModel.user_name + "' and status<3"); //未读短信息 total_msg = new BLL.user_message().GetCount("accept_user_name='" + userModel.user_name + "' and is_read=0"); //退出登录========================================================== if (action == "exit") { //清险Session HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = null; //清除Cookies Utils.WriteCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF", -43200); Utils.WriteCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF", -43200); Utils.WriteCookie("UserName", "MxWeiXinPF", -1); Utils.WriteCookie("Password", "MxWeiXinPF", -1); //自动登录,跳转URL HttpContext.Current.Response.Redirect(linkurl("login")); } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_message", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.user_message bll = new BLL.user_message(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除站内短消息成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("message_list.aspx", "type_id={0}&keywords={1}", this.type_id.ToString(), this.keywords), "Success"); }
private void ShowInfo(int _id) { BLL.user_message bll = new BLL.user_message(); Model.user_message model = bll.GetModel(_id); div_view.Visible = true; div_add.Visible = false; btnSubmit.Visible = false; labType.Text = GetMessageType(model.type); if (!string.IsNullOrEmpty(model.post_user_name)) { labPostUserName.Text = model.post_user_name; } else { labPostUserName.Text = "-"; } labAcceptUserName.Text = model.accept_user_name; labPostTime.Text = model.post_time.ToString(); labIsRead.Text = model.is_read == 1 ? "已阅读" : "未阅读"; if (model.read_time != null) { labReadTime.Text = model.read_time.ToString(); } else { labReadTime.Text = "-"; } labTitle.Text = model.title; litContent.Text = model.content; }
/// <summary> /// 重写虚方法,此方法在Init事件执行 /// </summary> protected override void InitPage() { id = DTRequest.GetQueryInt("id"); BLL.user_message bll = new BLL.user_message(); if (!bll.Exists(id)) { HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")); return; } model = bll.GetModel(id); //设为已阅读状态 bll.UpdateField(id, "is_read=1,read_time='" + DateTime.Now + "'"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_message", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.user_message bll = new BLL.user_message(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("message_list.aspx", "type_id={0}&keywords={1}", this.type_id.ToString(), this.keywords), "Success"); }
//批次刪除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_message", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權 BLL.user_message bll = new BLL.user_message(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批次刪除成功!", Utils.CombUrlTxt("message_list.aspx", "type_id={0}&keywords={1}", this.type_id.ToString(), this.keywords), "Success"); }
/// <summary> /// 重写虚方法,此方法在Init事件执行 /// </summary> protected override void InitPage() { id = DTRequest.GetQueryInt("id"); BLL.user_message bll = new BLL.user_message(); if (!bll.Exists(id)) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!"))); return; } model = bll.GetModel(id); if (model.accept_user_name != userModel.user_name && model.post_user_name != userModel.user_name) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的短消息!"))); return; } //设为已阅读状态 bll.UpdateField(id, "is_read=1,read_time='" + DateTime.Now + "'"); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.type_id > 0) { this.ddlType.SelectedValue = this.type_id.ToString(); } this.txtKeywords.Text = this.keywords; BLL.user_message bll = new BLL.user_message(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("message_list.aspx", "type_id={0}&keywords={1}&page={2}", this.type_id.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.type_id > 0) { this.ddlType.SelectedValue = this.type_id.ToString(); } this.txtKeywords.Text = this.keywords; BLL.user_message bll = new BLL.user_message(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("message_list_post.aspx", "type_id={0}&keywords={1}&page={2}", this.type_id.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 重写虚方法,此方法在Init事件执行 /// </summary> protected override void InitPage() { base.InitPage(); id = DTRequest.GetQueryInt("id"); message_status = DTRequest.GetQueryInt("status", 0); BLL.user_message bll = new BLL.user_message(); if (!bll.Exists(id)) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"))); return; } model = bll.GetModel(id); if (model.accept_user_name != userModel.user_name || (model.type == 2 && model.post_user_name != userModel.user_name)) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您所查看的并非自己的短消息!"))); return; } //设为已阅读状态 bll.UpdateField(id, "is_read=1,read_time='" + DateTime.Now + "'"); //查找下一条 var messageDt = new DataTable(); if (message_status == 0) { messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and Id<{1}", userModel.user_name, id), "id desc").Tables[0]; } else if (message_status == 1) { messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and is_read=1 and Id<{1}", userModel.user_name, id), "id desc").Tables[0]; } else { messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and is_read=0 and Id<{1}", userModel.user_name, id), "id desc").Tables[0]; } next_id = messageDt != null && messageDt.Rows.Count > 0 ? (int)messageDt.Rows[0]["id"] : 0; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { admin_info = GetAdminInfo(); //管理员信息 Utils.GetDomainStr("dt_cache_domain_info", "http://www.dtcms.net/upgrade.ashx?u=" + Request.Url.DnsSafeHost + "&i=" + Request.ServerVariables["LOCAL_ADDR"]); //绑定待审核 BLL.job_order job_order = new BLL.job_order(); DataSet ds = new DataSet(); ds = job_order.GetUnreviewListForDesktop(admin_info.user_name); int iCount = ds.Tables[0].Rows.Count; if (iCount < 10) { for (int i = 0; i < 10 - iCount; i++) { DataRow dr = ds.Tables[0].NewRow(); ds.Tables[0].Rows.Add(dr); } } rptJobOrderList.DataSource = ds; rptJobOrderList.DataBind(); //绑定未读 BLL.user_message user_message = new BLL.user_message(); DataSet ds2 = new DataSet(); ds2 = user_message.GetUnreadListForDesktop(admin_info.user_name); int iCount2 = ds2.Tables[0].Rows.Count; if (iCount2 < 10) { for (int i = 0; i < 10 - iCount2; i++) { DataRow dr = ds2.Tables[0].NewRow(); ds2.Tables[0].Rows.Add(dr); } } rptMessageList.DataSource = ds2; rptMessageList.DataBind(); //绑定待处理任务 //BLL.user_message user_message = new BLL.user_message(); DataSet ds3 = new DataSet(); ds3 = job_order.GetRelevantListForDesktop(admin_info.user_name); int iCount3 = ds3.Tables[0].Rows.Count; if (iCount3 < 10) { for (int i = 0; i < 10 - iCount3; i++) { DataRow dr = ds3.Tables[0].NewRow(); ds3.Tables[0].Rows.Add(dr); } } rptRelevantJobList.DataSource = ds3; rptRelevantJobList.DataBind(); //绑定部门级任务 //BLL.user_message user_message = new BLL.user_message(); DataSet ds4 = new DataSet(); ds4 = job_order.GetDeptListForDesktop(admin_info.dept_id); int iCount4 = ds4.Tables[0].Rows.Count; if (iCount4 < 10) { for (int i = 0; i < 10 - iCount4; i++) { DataRow dr = ds4.Tables[0].NewRow(); ds4.Tables[0].Rows.Add(dr); } } rptDeptJobList.DataSource = ds4; rptDeptJobList.DataBind(); } }