/// <summary>
 /// 根据用户名获得用户信息
 /// </summary>
 /// <param name="loginId">用户名</param>
 /// <returns>UserMsg</returns>
 public UserMsg GetUeserBaseMsgByLoginId(string loginId)
 {
     UserMsg um = null;
     string sql = "select CC_AutoID,CC_LoginPassword,CC_UserName from T_Seats where CC_LoginId=@uid";
     using (SqlDataReader reader=SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text,new SqlParameter("@uid",loginId)))
     {
         //如果用用户名获得了数据,才把um实例化
         if (reader.HasRows)
         {
             um = new UserMsg();
             if (reader.Read())
             {
                 um.AutoId = reader.GetInt32(0);
                 um.LoginId = loginId;//用传入值赋值
                 um.Psw = reader.GetString(1);
                 um.UserName = reader.GetString(2);
             }
         }
     }
     return um;
 }
 /// <summary>
 /// 有三种状态:登入成功,密码错误,用户名不存在,故使用枚举单做返回值,如果登入成功返回用户信息
 /// </summary>
 /// <param name="uid">用户名</param>
 /// <param name="psw">密码</param>
 /// <param name="usermg">输出参数:用户信息</param>
 /// <returns></returns>
 public LoginReasult Login2(string uid, string psw, out UserMsg usermg)
 {
     UserMsg um = dal.GetUeserBaseMsgByLoginId(uid);
     usermg = null;
     if (um == null)
     {
         return LoginReasult.UserNameNoExist;
     }
     else if (um.Psw == CommonHelper.GetMD5FromString(psw))
     {
         usermg = um;
         return LoginReasult.Succeed;
     }
     else
     {
         return LoginReasult.PswError;
     }
 }