/// <summary> /// 登录系统 /// </summary> /// <param name="loginName"></param> /// <param name="pwd"></param> /// <returns></returns> public Users GetLoginUser(string loginName, string pwd, string cCode) { Users user = new Users(); string strSql = "select * from users a left join company b on a.cCode = b.cCode " + " left join department c on c.DeptCode = a.DeptCode " + " where a.UserName = '******' and a.Password = '******' and substr(a.ccode,0,4) = '{2}'"; strSql = string.Format(strSql, loginName, EncryptHelper.EncryptString(pwd), cCode.Substring(0, 4)); DataTable dt = OracleHelper.ExecuteDataTable(strSql); if (dt.Rows.Count == 1) { user.UserId = dt.Rows[0]["UserId"].ToString(); ////单位 user.Company.CompanyCode = dt.Rows[0]["cCode"].ToString(); user.Company.Name = dt.Rows[0]["CName"].ToString(); user.Company.CompanyType = dt.Rows[0]["cType"].ToString(); ////部门 user.DepartMent.DeptCode = dt.Rows[0]["DeptCode"].ToString(); user.DepartMent.DeptName = dt.Rows[0]["DeptName"].ToString(); BusiUserService userService = new BusiUserService(); string[] roleAry = userService.GetUserRoles(dt.Rows[0]["UserId"].ToString()); ////角色 user.Role.RoleId = roleAry[0]; user.Role.RoleName = roleAry[1]; user.Role.RoleKey = roleAry[2]; ////用户基本信息 user.UserName = dt.Rows[0]["UserName"].ToString(); user.RealName = dt.Rows[0]["RealName"].ToString(); user.TelePhone = dt.Rows[0]["TelePhone"].ToString(); user.Sex = dt.Rows[0]["Sex"].ToString().Equals("0"); user.State = dt.Rows[0]["State"].ToString().Equals("0"); } else { user = null; } return(user); }
private void AddUserNode(TreeViewNode departmentNode, string departmentCode) { TreeViewOperation treeViewOperation = new TreeViewOperation(); BusiUserService user = new BusiUserService(); DataTable dtUser = user.GetUserByDeptCode(departmentCode); for (int j = 0; j < dtUser.Rows.Count; j++) { string provinceUserCompanyCode = dtUser.Rows[j]["CCODE"].ToString(); string provinceUserId = dtUser.Rows[j]["USERID"].ToString(); string provinceUserName = dtUser.Rows[j]["REALNAME"].ToString(); TreeViewNode userNode = treeViewOperation.BuildNode(Guid.NewGuid().ToString(), provinceUserId, provinceUserName, false, false); userNode.ServerXzdm = CommonHelper.GetSHICode(provinceUserCompanyCode); treeViewOperation.AddNode(departmentNode, userNode); } }