发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
/// <summary>
/// 获取Cookies里面的用户信息
/// </summary>
/// <param name="iUserSplitNum">split编号</param>
/// <returns></returns>
public string SwayGetUser(int iUserSplitNum)
{
string sUserID = User.Identity.Name.ToString();
string sUserInfo = string.Empty;
sUserInfo = Request.Cookies[FormsAuthentication.FormsCookieName].Value.ToString();
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(sUserInfo);
sUserInfo = ticket.UserData.ToString();
string[] sZ;
sZ = sUserInfo.Split("|".ToCharArray());
sUserID = sZ[iUserSplitNum].ToString();
return sUserID;
}
/// <summary>
/// 获取用户的编号
/// </summary>
/// <returns>用户信息</returns>
public string SwayGetLoginUser()
{
return SwayGetUser(4);
}
/// <summary>
/// 获取用户部门
/// </summary>
/// <returns>部门编号</returns>
public string SwayGetLoginUserDepartMent()
{
return SwayGetUser(2);
}
/// <summary>
/// 获取用户级别
/// </summary>
/// <param name="drp">已经按照特殊格式制定的DropDownList</param>
/// <returns>用户深度</returns>
public string SwayGetLoginUserDepartMent(DropDownList drp)
{
string sUserID = SwayGetLoginUserDepartMent();
string sInfo = string.Empty;
string sTmp = string.Empty;
int i, j;
for (i = 0; i < drp.Items.Count; i++)
{
if (drp.Items[i].Value.ToString() == sUserID)
{
sInfo = drp.Items[i].Text.ToString();
}
}
j = 0;
if (sInfo != string.Empty)
{
for ( i = 0; i < sInfo.Length; i++)
{
sTmp = sInfo.Substring(i, 1);
if (sTmp == "┖" || sTmp == "─")
{
++j;
}
}
}
return j.ToString();
}
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。