//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 ps_manager_log bll = new ps_manager_log(); 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++; } else { errorCount++; } } } mym.AddAdminLog("删除", "删除用户操作日志成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 mym.JscriptMsg(this.Page, " 删除用户操作日志成功" + sucCount + "条,失败" + errorCount + "条", Utils.CombUrlTxt("manager_log.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success"); }
private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; ps_manager_log bll = new ps_manager_log(); 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("manager_log.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 写入管理日志 /// </summary> /// <param name="action_type"></param> /// <param name="remark"></param> /// <returns></returns> public bool AddAdminLog(string action_type, string remark) { //写入日志 ps_manager_log mylog = new ps_manager_log(); mylog.user_id = Convert.ToInt32(Session["AID"]); mylog.user_name = Session["RememberName"].ToString(); mylog.action_type = action_type; mylog.add_time = DateTime.Now; mylog.remark = remark; mylog.user_ip = AXRequest.GetIP(); int newId = mylog.Add(); if (newId > 0) { return(true); } return(false); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Value.Trim(); string userPwd = txtPassword.Value.Trim(); //判断登录信息 ps_manager myuser = new ps_manager(); string sqlGetUserID = "select id from [ps_manager] where user_name='" + userName + "'"; int userid = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID)); myuser.GetModel(userid); if (myuser.password != null) { userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5"); if (myuser.password.Trim() != userPwd) { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } //判断账号是否被禁用 if (Convert.ToInt32(myuser.is_lock) == 2) { MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!"); return; } ps_depot myd = new ps_depot(); myd.GetModel(Convert.ToInt32(myuser.depot_id)); //判断账号对应的商家是否被禁用 if (Convert.ToInt32(myuser.depot_id) != 0 && Convert.ToInt32(myd.status) == 2) { MessageBox.errorShow(this.Page, "您所在商家被禁用,请联系客服!"); return; } //写入登录日志 ps_manager_log mylog = new ps_manager_log(); mylog.user_id = userid; mylog.user_name = userName; mylog.action_type = "登陆"; mylog.add_time = DateTime.Now; mylog.remark = "登陆系统"; mylog.user_ip = AXRequest.GetIP(); mylog.Add(); //写入Cookies Utils.WriteCookie("RememberName", userName, 14400); Utils.WriteCookie("AdminName", userName, 14400); Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400); Utils.WriteCookie("AID", myuser.id.ToString(), 14400); Utils.WriteCookie("RealName", myuser.real_name, 14400); Utils.WriteCookie("DepotID", myuser.depot_id.ToString(), 14400); Utils.WriteCookie("DepotCatID", myuser.depot_category_id.ToString(), 14400); //写入Session Session["RememberName"] = userName; Session["AdminName"] = userName; Session["RoleID"] = myuser.role_id.ToString(); Session["AID"] = myuser.id.ToString(); Session["RealName"] = myuser.real_name; Session["DepotID"] = myuser.depot_id.ToString(); Session["DepotCatID"] = myuser.depot_category_id.ToString(); Session.Timeout = 45; Response.Redirect("main.aspx"); return; } else { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } }