Example #1
0
        private void classRepeater_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            Business.Debug.Trace("WEBUI", "Begin classRepeater_ItemCreated", Business.DebugSeverity.Low);

            Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar gridToolBar = (Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar)e.Item.FindControl("gridToolBar");
            DataGrid costGrid     = (DataGrid)e.Item.FindControl("costGrid");
            Label    avgProjects  = (Label)e.Item.FindControl("avgProjects");
            Label    avgLanguages = (Label)e.Item.FindControl("avgLanguages");

            if (costGrid != null)
            {
                gridToolBar.Visible        = !translationManager;
                gridToolBar.ButtonClicked += new Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar.ButtonClickedEventHandler(gridToolBar_ButtonClicked);
                //add necessary columns
                for (int i = 1; i <= PeriodRange; i++)
                {
                    TemplateColumn newCol     = new TemplateColumn();
                    DateTime       date       = DateTime.UtcNow.AddMonths(i);
                    string         columnName = "M" + date.Year.ToString() + date.Month.ToString();

                    newCol.HeaderText = DateTime.UtcNow.AddMonths(i).ToString("y");
                    CostTemplate iTemplate = new CostTemplate(columnName, !translationManager);
                    newCol.ItemTemplate = iTemplate;
                    costGrid.Columns.AddAt(i, newCol);
                }
            }

            Business.Debug.Trace("WEBUI", "End classRepeater_ItemCreated", Business.DebugSeverity.Low);
        }
        /// <summary>
        /// 加载Toolbar样式和判断权限
        /// </summary>
        /// <param name="page"></param>
        public static void LoadToolbar(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar toolBar)
        {
            if (toolBar == null)
            {
                return;                 //没有需要校验权限的控件
            }
            //添加按钮样式
            foreach (object obj in toolBar.Items)
            {
                if (obj.GetType().GetInterface("Infragistics.WebUI.UltraWebToolbar.ITBarButton") == null)
                {
                    continue;
                }

                Infragistics.WebUI.UltraWebToolbar.ITBarButton tButton = (Infragistics.WebUI.UltraWebToolbar.ITBarButton)obj;
                AddToolBarButtonStyle(tButton);
            }

            //if (WebUI.SessionState.IsAdmin) return;//管理员不需要校验权限

            //string userID = SessionState.UserID.ToString();

            //string pageName = HttpContext.Current.Request.RawUrl;
            //int index = pageName.LastIndexOf("/");
            //pageName = pageName.Substring(index + 1, pageName.Length - index - 1);

            //long menuID = new Nandasoft.BaseModule.RightRule().GetMenuIDByPageName(pageName);

            ////得到所有权限
            //DataTable dt = new RightRule().GetAllowControlRightsItems(menuID);
            //if (dt.Rows.Count < 1) return;//没有需要校验的权限

            //List<string> rights = new List<string>();
            //foreach (DataRow dr in dt.Rows)
            //{
            //    rights.Add(dr["ItemKey"].ToString());
            //}

            ////得到拥有权限
            //dt = new RightRule().GetPageKeyRight(userID, menuID.ToString(), pageName, "");
            //List<string> myRights = new List<string>();
            //foreach (DataRow dr in dt.Rows)
            //{
            //    myRights.Add(dr["ItemKey"].ToString());
            //}

            ////根据权限显示控件
            //foreach (object obj in toolBar.Items)
            //{
            //    if (obj.GetType().GetInterface("Infragistics.WebUI.UltraWebToolbar.ITBarButton") == null) continue;
            //    Infragistics.WebUI.UltraWebToolbar.ITBarButton tButton = (Infragistics.WebUI.UltraWebToolbar.ITBarButton)obj;

            //    if (!rights.Contains(tButton.Button.Key)) continue;
            //    tButton.Button.Visible = myRights.Contains(tButton.Button.Key);
            //}
        }
        private void RecursionLoadUltraWebToolbar(ControlCollection controls)
        {
            if (controls.Count == 0)
            {
                return;
            }
            foreach (Control ctl in controls)
            {
                if (ctl is Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar)
                {
                    Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar toolbar = (Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar)ctl;
                    PageHelper.LoadToolbar(toolbar);
                }

                RecursionLoadUltraWebToolbar(ctl.Controls);
            }
        }
Example #4
0
 public static void ShowToolBarSeparator(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string sepKey)
 {
     uwToolbar.Items.FromKeySeparator(sepKey).Width = Unit.Pixel(8);
 }
Example #5
0
 public static void ShowToolBarCustom(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string lblKey)
 {
     uwToolbar.Items.FromKeyCustom(lblKey).Visible = true;
 }
Example #6
0
 public static void ShowToolBarLabel(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string lblKey)
 {
     uwToolbar.Items.FromKeyLabel(lblKey).DefaultStyle.Width = uwToolbar.ItemWidthDefault;
 }
Example #7
0
 public static void ShowToolBarButton(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string btnKey, int width)
 {
     ShowToolBarButton(uwToolbar.Items.FromKeyButton(btnKey), width);
 }
Example #8
0
 public static void HideToolBarSeparator(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string sepKey)
 {
     HideToolBarSeparator(uwToolbar.Items.FromKeySeparator(sepKey));
 }
Example #9
0
 public static void HideToolBarLabel(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string lblKey)
 {
     uwToolbar.Items.FromKeyLabel(lblKey).DefaultStyle.Width = Unit.Pixel(0);
 }
Example #10
0
 public static void HideToolBarButton(Infragistics.WebUI.UltraWebToolbar.UltraWebToolbar uwToolbar, string btnKey)
 {
     //uwToolbar.Items.FromKeyButton(btnKey).DefaultStyle.CustomRules = "display:none";
     //uwToolbar.Items.FromKeyButton(btnKey).DefaultStyle.Width = Unit.Pixel(0);
     HideToolBarButton(uwToolbar.Items.FromKeyButton(btnKey));
 }