登录成功
登录成功
posts - 5,comments - 5,trackbacks - 1

*未经允许不得传载

      在访问区域时,我们可以通过如下代码得到区域的对象,
    
public Area GetArea(string AreaName)
        
{
            Area area3 ;
            
this.CurrentPortalContext = PortalApplication.GetContext();
            
try
            
{
                Guid guid1 
= AreaManager.GetSystemAreaGuid(this.CurrentPortalContext,0);
                Area area1 
= AreaManager.GetArea(this.CurrentPortalContext,guid1);
                Area area2 
= null;
                area2 
= this.SearchArea(area1, AreaName);
                area3 
= area2;
            }

            
catch (Exception ex)
            
{
                
throw ex;
            }

            
return area3;
        }

        
private Area SearchArea(Area ObjectArea, string AreaName)
        
{
            Area area2 
= null;
            
try
            
{
                
if (ObjectArea.Areas.Count > 0)
                
{
                    
foreach (Area area1 in ObjectArea.Areas)
                    
{
                        
string ff = area1.Title.ToString();
                        
if (area1.Title.Trim() == AreaName.Trim())
                        
{
                            area2 
= area1;
                        }

                    }

                }

            }

            
catch (Exception exception1)
            
{
                
throw exception1;
            }

            
string tt = area2.Title.ToString();
            
return area2;
        }
posted on 2005-09-02 11:08 鸟人狼图腾 阅读(...) 评论(...) 编辑 收藏