/// <summary> /// 修改用户信息 /// </summary> /// <returns></returns> public string ModifyUserInfo(string uid, string uName, string uPass, string gid, string rName, int BH) { NetUserInfo uInfo = new NetUserInfo(); UserInfo info = new UserInfo(); info.UserID = int.Parse(uid); info.UserName = uName; info.RealName = rName; info.GroupID = gid; info.UserModTime = System.DateTime.Now; info.NetPass = uPass; if (info.GroupID == "1") { info.IsManager = "0";; } else { info.IsManager = "1"; } info.UserOrder = BH; if (uInfo.Update(info)) { return("1"); } else { return("0"); } }
/// <summary> /// 获取用户列表 /// </summary> public void GetUserList() { NetUserInfo uInfo = new NetUserInfo(); UserInfo info = new UserInfo(); DataSet ds = uInfo.GetUserInfos("", "", 0, 1, true); drop_UserList.Items.Clear(); DropDownList_s_user.Items.Clear(); drop_UserList.Items.Add(new ListItem("所有人", "-1")); DropDownList_s_user.Items.Add(new ListItem("请选择", "-2")); DropDownList_s_user.Items.Add(new ListItem("所有人", "-1")); if (ds != null) { int dsCount = ds.Tables[0].Rows.Count; if (dsCount > 0) { for (int i = 0; i < dsCount; i++) { string value = ds.Tables[0].Rows[i][0].ToString(); string text = ds.Tables[0].Rows[i][3].ToString(); drop_UserList.Items.Add(new ListItem(text, value)); DropDownList_s_user.Items.Add(new ListItem(text, value)); } } } this.drop_UserList.SelectedValue = UserId; this.DropDownList_s_user.SelectedValue = UserId; }
/// <summary> /// 建立树状结构 /// </summary> public void BuildTree() { NetUserInfo uInfo = new NetUserInfo(); DataSet ds = uInfo.GetUserInfos("", "", 0, 1, true); string htmlstr = ""; if (ds != null) { int dsCount = ds.Tables[0].Rows.Count; if (dsCount > 0) { htmlstr += "<script type=\"text/javascript\"><!--\n d = new dTree('d');\n"; htmlstr += "d.add(0,-1,' 分组列表(" + dsCount + ")');\n"; for (int i = 0; i < dsCount; i++) { htmlstr += "d.add(" + (i + 1) + ",0,'" + ds.Tables[0].Rows[i]["realName"] + "','viewMission.aspx?st=0&uid=" + ds.Tables[0].Rows[i]["userId"] + "','分组列表','_parent');"; } htmlstr += "document.write(d);//--></script>"; } } this.navi.InnerHtml = htmlstr;//赋值到前台 }
/// <summary> /// 删除用户操作 /// </summary> /// <param name="id"></param> /// <returns></returns> public string delData(int id) { NetUserInfo nUser = new NetUserInfo(); if (nUser.Delete(id)) { return("1"); } else { return("0"); } }
public void GetDetailByUid() { UserId = Request.QueryString["uid"]; if (!string.IsNullOrEmpty(UserId)) { this.hid_userid.Value = UserId; NetUserInfo uInfo = new NetUserInfo(); UserInfo info = uInfo.GetNetUserInfo(UserId); hidgid.Value = info.GroupID; this.txt_UserName.Text = info.UserName; this.txt_RealName.Text = info.RealName; hidOrder.Value = info.UserOrder.ToString(); } }
/// <summary> /// 添加用户信息 /// </summary> public void AddUserInfo() { NetUserInfo nUser = new NetUserInfo(); UserInfo info = new UserInfo(); info.GroupID = this.drop_groupList.SelectedValue; //分组 info.UserName = this.txt_UserName.Text; //用户名 info.RealName = this.txt_RealName.Text; //真实姓名 info.NetPass = this.txt_Pass.Text; //密码 info.UserModTime = System.DateTime.Now; if (info.GroupID == "1") { info.IsManager = "0";; } else { info.IsManager = "1"; } info.UserOrder = Convert.ToInt32(this.txt_XH.Text.ToString()); if (!nUser.CheckUserByUserName(info.UserName)) { this.lit_Message.Text = "<font color=red>该用户已经存在!</font>"; } else { if (nUser.Insert(info)) { this.lit_Message.Text = "<font color=red>添加用户成功!</font>"; } else { this.lit_Message.Text = "<font color=red>添加用户失败!</font>"; } } this.txt_UserName.Text = ""; this.txt_RealName.Text = ""; this.txt_Pass.Text = ""; GetUserList(false); }
protected void imgBtn_Login_Click(object sender, ImageClickEventArgs e) { //NetUserInfo user = new NetUserInfo(); UserInfo info = NetUserInfo.CheckUserAndPass(this.txtUserName.Text, this.txtPwd.Text); if (info != null) { if (info.GroupID == "1") { Session["uname"] = this.txtUserName.Text; Session["groupId"] = info.GroupID; Session["realName"] = info.RealName; //Session["IsManager"] = info.IsManager; Session["userid"] = info.UserID; Response.Redirect("/user/viewList.aspx"); } else if (info.GroupID == "2") { Session["uname"] = this.txtUserName.Text; Session["groupId"] = info.GroupID; Session["realName"] = info.RealName; //Session["IsManager"] = info.RealName; Session["userid"] = info.UserID; Response.Redirect("/manage/JournalList.aspx"); } else if (info.GroupID == "4") { Session["uname"] = this.txtUserName.Text; Session["groupId"] = info.GroupID; Session["realName"] = info.RealName; //Session["IsManager"] = info.RealName; Session["userid"] = info.UserID; Response.Redirect("/filemanage/default.aspx"); } } else { this.errMessage.Text = "<span style='color:red;font-size:12px;'>温馨提示:身份验证失败!</span>"; } }
/// <summary> /// 获取用户列表 /// </summary> public void GetUserList() { NetUserInfo uInfo = new NetUserInfo(); UserInfo info = new UserInfo(); DataSet ds = uInfo.GetUserInfos("", "", 0, 1, true); this.radio_UserList.Items.Clear(); if (ds != null) { int dsCount = ds.Tables[0].Rows.Count; if (dsCount > 0) { radio_UserList.Items.Add(new ListItem("空", "0")); for (int i = 0; i < dsCount; i++) { string value = ds.Tables[0].Rows[i][0].ToString(); string text = ds.Tables[0].Rows[i][3].ToString(); radio_UserList.Items.Add(new ListItem(text, value)); } //this.radio_UserList.SelectedValue = ds.Tables[0].Rows[0][0].ToString(); } } }
/// <summary> /// 获取用户列表 /// </summary> public void GetUserList(bool IsSearch) { NetUserInfo uInfo = new NetUserInfo(); string currentGroupId = string.Empty; int currentPage = 1; int userCount = 0; #region 判断是否为搜索 if (IsSearch) { currentGroupId = this.drop_Group.SelectedValue; //获取当前选中的分组 this.drop_groupList.SelectedValue = currentGroupId; userCount = uInfo.GetUserFYCount("", currentGroupId); //获取分页总数 } else { if (Request.QueryString["gid"] != null) { currentGroupId = Request.QueryString["gid"]; this.drop_Group.SelectedValue = currentGroupId; this.drop_groupList.SelectedValue = currentGroupId; } else { currentGroupId = this.drop_Group.SelectedValue; //获取当前选中的分组 } userCount = uInfo.GetUserFYCount("", currentGroupId); //获取分页总数 try { currentPage = Convert.ToInt32(Request.QueryString["page"]); if (currentPage > (userCount + PageSize - 1) / PageSize) { currentPage = (userCount + PageSize - 1) / PageSize; } if (currentPage <= 0) { currentPage = 1; } } catch { currentPage = 1; } } #endregion DataSet ds = uInfo.GetUserInfos("", currentGroupId, PageSize, currentPage, false); if (ds != null) { int uCount = ds.Tables[0].Rows.Count; if (uCount > 0) { HtmlTableRow hrow = null; string tempOpreator = string.Empty; for (int j = 0; j < uCount; j++) { hrow = new HtmlTableRow(); int tempBH = (currentPage - 1) * PageSize + j + 1; hrow.Cells.Add(GetHCell(tempBH.ToString())); //编号 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j][2].ToString())); //用户名 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j][3].ToString())); //真实姓名 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j][4].ToString())); //密码 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j][5].ToString())); //修改时间 string tempGroup = this.drop_Group.SelectedItem.Text; hrow.Cells.Add(GetHCell(tempGroup)); //分组 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j]["userOrder"].ToString())); // tempOpreator = string.Empty; tempOpreator = "<a href=\"javascript:void(0);\" name=\"modify\" onclick=\"showDiv('" + ds.Tables[0].Rows[j][0].ToString() + "')\">修改</a> | <a href=\"javascript:void(0)\" onclick=\"del('" + ds.Tables[0].Rows[j][0].ToString() + "','" + ds.Tables[0].Rows[j][1].ToString() + "')\">删除</a>"; hrow.Cells.Add(GetHCell(tempOpreator));//操作内容 tbl_list.Rows.Add(hrow); } } } string parms = "&gid=" + currentGroupId; GetPage(userCount, PageSize, currentPage, parms);//获取分页文字 }