public static string CategoryIdToName(string strWhere) { CategoryDto dto = new CategoryDto(); DataTable dt = CMSService.SelectOne("Category", "CMSCategory", strWhere); foreach (DataRow dr in dt.Rows) { dto = CategoryMapping.getDTO(dr); } return(dto.CategoryName); }
public static string UserIdToName(string strWhere) { UserDto dto = new UserDto(); DataTable dt = CMSService.SelectOne("User", "CMSUser", strWhere); foreach (DataRow dr in dt.Rows) { dto = UserMapping.getDTO(dr); } return(dto.UserName); }
public static double GetFenshuByCategory(int categoryId) { double fenshu = 0; CategoryDto dto = new CategoryDto(); DataTable dt = CMSService.SelectOne("Category", "CMSCategory", "CategoryId=" + categoryId); foreach (DataRow dr in dt.Rows) { dto = CategoryMapping.getDTO(dr); } try { fenshu = double.Parse(dto.CategoryDescription); } catch { fenshu = 0; } return(fenshu); }
//多个用户角色,从ID转化成名字 public static string RolesIdToRolesName(string RoesId) { string userRoles = ""; string roleName = ""; string s = RoesId; string[] sArray = s.Split(','); foreach (string i in sArray) { DataTable dt = CMSService.SelectOne("Role", "CMSRole", "RoleId=" + int.Parse(i)); foreach (DataRow dataRow in dt.Rows) { RoleDto roleDto = new RoleDto(); roleDto = RoleMapping.getDTO(dataRow); roleName = roleDto.RoleName; } userRoles = userRoles + roleName + ","; } userRoles = userRoles.Substring(0, userRoles.Length - 1); return(userRoles); }