| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using Gs.User.Modes; |
| | | using System.Diagnostics; |
| | | |
| | | namespace Gs.User.Service |
| | | { |
| | |
| | | System.Data.DataRow row = dset.Tables[0].Rows[0]; |
| | | m.loginGuid = Guid.Parse(row["loginGuid"].ToString()); |
| | | m.loginOrgGuid = row["loginOrgGuid"].ToString(); |
| | | System.Text.StringBuilder sbR = new StringBuilder(); |
| | | if (dset.Tables.Count > 1 && dset.Tables[1].Rows.Count > 1) |
| | | { |
| | | foreach (System.Data.DataRow r in dset.Tables[1].Rows) |
| | | { |
| | | if (sbR.Length > 0) |
| | | sbR.Append(","); |
| | | sbR.Append(r["rightGuid"].ToString()); |
| | | } |
| | | } |
| | | m.loginRightList = sbR.ToString(); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "登录成功!"); |
| | | } |
| | | } |
| | |
| | | } |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, "登录失败!"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取用户登录信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<System.Dynamic.ExpandoObject> GetUserInfo([FromBody] UserLogin model) |
| | | { |
| | | Guid userGuid = model.userGuid; |
| | | DataSet dset = new DataSet(); |
| | | dynamic m = new System.Dynamic.ExpandoObject(); |
| | | using (SqlConnection conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (SqlCommand cmd = new SqlCommand("[prc_user_info]", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = new SqlParameter[] { |
| | | new SqlParameter("@userGuid",userGuid), |
| | | }; |
| | | foreach (SqlParameter parameter in parameters) |
| | | { |
| | | cmd.Parameters.Add(parameter); |
| | | } |
| | | using (SqlDataAdapter dt = new SqlDataAdapter(cmd)) |
| | | { |
| | | dt.Fill(dset, "0"); |
| | | } |
| | | if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0) |
| | | { |
| | | System.Data.DataRow row = dset.Tables[0].Rows[0]; |
| | | m.loginGuid = Guid.Parse(row["loginGuid"].ToString()); |
| | | m.loginOrgGuid = row["loginOrgGuid"].ToString(); |
| | | m.list = new List<MenuAction>(); |
| | | if (dset.Tables.Count > 1 && dset.Tables[1].Rows.Count > 1) |
| | | { |
| | | foreach (DataRow dr in dset.Tables[1].Rows) |
| | | { |
| | | m.list.Add( |
| | | new MenuAction() |
| | | { |
| | | guid = Guid.Parse(dr["rightGuid"].ToString()), |
| | | upGuid = dr["upGuid"].ToString().Length > 0 ? Guid.Parse(dr["upGuid"].ToString()) : null, |
| | | name = dr["name"].ToString(), |
| | | icon = dr["icon"].ToString(), |
| | | formPath = dr["formPath"].ToString(), |
| | | category = int.Parse(dr["category"].ToString()), |
| | | } |
| | | ); |
| | | } |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "登录成功!"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(this.ToString(), "GetUserInfo error:" + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, "登录失败!"); |
| | | } |
| | | } |
| | | } |