Beispiel #1
0
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlItemInfo htmlItem      = e.Item.DataItem as HtmlItemInfo;
         HyperLink    hlnkName      = e.Item.FindControl("hlnkName") as HyperLink;
         Image        imgNew        = e.Item.FindControl("imgNew") as Image;
         Label        lblUpdateTime = e.Item.FindControl("lblUpdateTime") as Label;
         hlnkName.Text = htmlItem.Name;
         string p = "";
         if (!string.IsNullOrEmpty(Request["m1"]))
         {
             p += "&m1=" + Request["m1"];
         }
         if (!string.IsNullOrEmpty(Request["m2"]))
         {
             p += "&m2=" + Request["m2"];
         }
         hlnkName.NavigateUrl = string.Format("ShowContent.aspx?id={0}{1}", htmlItem.Id, p);
         if (htmlItem.LastUpdateTime.AddDays(7) > DateTime.Now)
         {
             imgNew.ToolTip  = "new";
             imgNew.ImageUrl = "Images/new.gif";
         }
         else
         {
             imgNew.Visible = false;
         }
         lblUpdateTime.Text = htmlItem.LastUpdateTime.ToString("(yyyy-MM-dd HH:mm:ss)");
     }
 }
Beispiel #2
0
    public string GetMenuInfo(string menuId)
    {
        PageFacade   facade   = PageHelper.GetPageFacade(this.Page);
        MenuItemInfo menuItem = facade.GetMenuById(menuId);

        if (menuItem == null)
        {
            return("");
        }
        string[] menuInfos = new string[9];
        menuInfos[0] = menuItem.Name;
        menuInfos[1] = menuItem.Index.ToString();
        menuInfos[2] = menuItem.ParentId;
        menuInfos[3] = menuItem.IsInner ? "1" : "0";
        menuInfos[4] = menuItem.IsListType ? "1" : "0";
        menuInfos[5] = menuItem.InnerId;
        menuInfos[6] = "";  // parent list id
        menuInfos[7] = menuItem.OuterUrl;
        menuInfos[8] = menuItem.IsOpenNewWindow ? "1" : "0";
        if (!string.IsNullOrEmpty(menuItem.ParentId))
        {
            if (menuItem.IsInner)
            {
                if (!menuItem.IsListType && !string.IsNullOrEmpty(menuItem.InnerId))
                {
                    HtmlItemInfo htmlItem = facade.GetHtmlItemById(menuItem.InnerId);
                    if (!string.IsNullOrEmpty(htmlItem.ItsListId))
                    {
                        menuInfos[6] = htmlItem.ItsListId;
                    }
                }
            }
        }
        return(string.Join(SplitChar3, menuInfos));
        //txtName.Text = menuItem.Name;
        //txtIndex.Text = menuItem.Index.ToString();
        //if (string.IsNullOrEmpty(menuItem.ParentId))
        //{
        //    ddlTopMenu.SelectedValue = "";
        //}
        //else
        //{
        //    ddlTopMenu.SelectedValue = menuItem.ParentId;
        //    if (menuItem.IsInner)
        //    {
        //        rbtnInner.Checked = true;
        //        if (menuItem.IsListType)
        //        {
        //            if (!string.IsNullOrEmpty(menuItem.InnerId))
        //            {
        //                ddlLinkList.SelectedValue = menuItem.InnerId;
        //            }
        //        }
        //        else
        //        {
        //            if (!string.IsNullOrEmpty(menuItem.InnerId))
        //            {
        //                HtmlItemInfo htmlItem = facade.GetHtmlItemById(menuItem.InnerId);
        //                if (!string.IsNullOrEmpty(htmlItem.ItsListId))
        //                {
        //                    ddlLinkList.SelectedValue = htmlItem.ItsListId;
        //                    ddlLinkHtml.SelectedValue = htmlItem.Id;
        //                }
        //            }
        //        }
        //    }
        //    else
        //    {
        //        rbtnOuter.Checked = true;
        //        txtOuterUrl.Text = menuItem.OuterUrl;
        //    }
        //}
        //cbOpenNewWindow.Checked = menuItem.IsOpenNewWindow;
    }