Ejemplo n.º 1
0
        /// <summary>Khai báo quyền đòi hỏi trên một Control
        /// </summary>
        public static void ApplyPermissionCtrl(List<Control> list, Control ctrl, PermissionItem item)
        {
            object obj = ctrl.Tag;
            TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", item);
            ctrl.Tag = obj;

            list.Add(ctrl);
        }
Ejemplo n.º 2
0
 public _MenuItem(string[] _captions, string[] _imageNames, string _fieldName, DelegationLib.CallFunction_MulIn_NoOut[] _funcs, PermissionItem[] pers)
 {
     captionNames = _captions;
     imageNames = _imageNames;
     fieldName = _fieldName;
     funcs = _funcs;
     permissions = pers;
 }
Ejemplo n.º 3
0
        private string TR_LG_FIELD; //??

        #endregion Fields

        #region Constructors

        public PhieuType(long ID, string TABLE_NAME, string DO_NAME, string TITLE, PermissionItem AllowAdd, 
            string FORM_CLASS_NAME, string IMAGE_NAME, string ID_FIELD)
        {
            this.ID = ID;
            this.NHOM_PHIEU = ID;
            this.TABLE_NAME = TABLE_NAME;
            this.DO_NAME = DO_NAME;
            this.TITLE = TITLE;
            this.AllowAdd = AllowAdd;
            this.FORM_CLASS_NAME = FORM_CLASS_NAME;
            this.IMAGE_NAME = IMAGE_NAME;
            this.ID_FIELD = ID_FIELD;
            this.SO_LG_FIELD = "SO_LUONG";
            this.TR_LG_FIELD = "TRONG_LUONG";
            PhieuTypeStore.Add(this);
        }
Ejemplo n.º 4
0
 public static void AddMenuToGridView(PivotGridControl grid, string fieldName,
     string[] captions, string[] images, DelegationLib.CallFunction_MulIn_NoOut[] delegates,
     PermissionItem[] pers)
 {
     EventHandler handler = null;
     if (captions != null)
     {
         ContextMenuStrip strip = new ContextMenuStrip();
         int index = 0;
         foreach (string str in captions)
         {
             bool? nullable;
             if (((pers != null) && (pers[index] != null)) &&
                 !(ApplyPermissionAction.checkPermission(pers[index]).HasValue &&
                 !(!(nullable = ApplyPermissionAction.checkPermission(pers[index])).GetValueOrDefault() && nullable.HasValue)))
             {
                 index++;
             }
             else
             {
                 Image image = null;
                 image = ResourceMan.getImage16(images[index]);
                 ToolStripMenuItem item = new ToolStripMenuItem(str, image);
                 item.Name = index.ToString();
                 if (handler == null)
                 {
                     handler = new EventHandler(delegate(object sender, EventArgs e)
                     {
                         List<object> data = new List<object>();
                         foreach (Point point in grid.Cells.MultiSelection.SelectedCells)
                         {
                             data.Add(point);
                         }
                         delegates[(int)((IntPtr)HelpNumber.ParseInt64(((ToolStripMenuItem)sender).Name))](data);
                     });
                 }
                 item.Click += handler;
                 strip.Items.Add(item);
                 index++;
             }
         }
         grid.ContextMenuStrip = strip;
     }
 }
Ejemplo n.º 5
0
 public static _MenuItem GetBusinessMenuList(XtraForm FormQL, PhieuType Phieu, DelegationLib.CallFunction_MulIn_SinOut DOData)
 {
     List<PhieuType> Phieus = Phieu.CanCreateList;
     DelegationLib.CallFunction_MulIn_NoOut[] Actions = new DelegationLib.CallFunction_MulIn_NoOut[Phieus.Count];
     string[] Titles = new string[Phieus.Count];
     string[] ImageNames = new string[Phieus.Count];
     PermissionItem[] Permissions = new PermissionItem[Phieus.Count];
     for (int i = 0; i < Phieus.Count; i++)
     {
         PhieuType PhieuTo = Phieus[i];
         Titles[i] = "Tạo " + PhieuTo.GetTitle();
         ImageNames[i] = PhieuTo.GetImageName();
         Permissions[i] = PhieuTo.AllowAdd;
         Actions[i] = delegate(List<object> ids)
         {
             if (ids != null && ids.Count > 0)
             {
                 ProtocolForm.ShowModalForm(FormQL, PhieuTo.GetFormClassName(), DOData(ids));
             }
         };
     }
     return new _MenuItem(Titles, ImageNames, Phieu.GetIDField(), Actions, Permissions);
 }
Ejemplo n.º 6
0
        public static void CreateBusinessMenu(
            GridView gridViewMaster,
            DevExpress.XtraBars.BarSubItem barSubItem1,
            string fieldName,
            string[] captions,
            string[] ImageNames,
            DelegationLib.CallFunction_MulIn_NoOut[] delegates,
            PermissionItem[] pers)
        {
            if (captions == null)
            {
                //barSubItem1.Enabled = false;
                barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                return;
            }

            int index = 0;
            foreach (string s in captions)
            {
                //Start Check Permission
                if (pers != null)
                {
                    if (pers[index] != null)
                    {
                        if (ApplyPermissionAction.checkPermission(pers[index]) == null ||
                            ApplyPermissionAction.checkPermission(pers[index]) == false)
                        {
                            index++;
                            continue;
                        }
                    }
                }
                //End Check Permission

                DevExpress.XtraBars.BarButtonItem temp = new DevExpress.XtraBars.BarButtonItem();
                temp.Caption = captions[index];
                temp.Name = index.ToString();
                if (!ImageNames[index].Equals(""))
                {
                    temp.Glyph = ResourceMan.getImage16(ImageNames[index]);
                }
                temp.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph;
                temp.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
                {
                    if (gridViewMaster.SelectedRowsCount < 1)
                    {
                        HelpMsgBox.ShowNotificationMessage("Vui lòng chọn dữ liệu !");
                        return;
                    }
                    //Lấy danh sách các giá trị (row[fieldName]) đang chọn
                    List<object> objs = new List<object>();
                    foreach (int i in gridViewMaster.GetSelectedRows())
                    {
                        DataRow row = gridViewMaster.GetDataRow(i);
                        objs.Add(row[fieldName]);
                    }

                    //Chọn xử lý tương ứng với chọn lựa
                    delegates[HelpNumber.ParseInt32(e.Item.Name)](objs);
                };

                barSubItem1.ItemLinks.Add(temp);
                index++;
            }
            //Không có chọn lựa ẩn luôn.
            if (barSubItem1.ItemLinks == null || barSubItem1.ItemLinks.Count == 0)
                barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
        }
Ejemplo n.º 7
0
 public static void ApplyPermissionObject(Object item, PermissionItem permission)
 {
     if (permission == null) return;
     #region Phân quyền trên các control hành động
     if ((item as ToolStripMenuItem) != null)
     {
         object obj = ((ToolStripMenuItem)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((ToolStripMenuItem)item).Tag = obj;
     }
     else if ((item as ToolStripButton) != null)
     {
         object obj = ((ToolStripButton)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((ToolStripButton)item).Tag = obj;
     } else if ((item as ToolStripDropDownButton) != null)
     {
         object obj = ((ToolStripDropDownButton)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((ToolStripDropDown)item).Tag = obj;
     }
     else if ((item as BarItem) != null)
     {
         object obj = ((BarItem)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((BarItem)item).Tag = obj;
     }
     else if ((item as SimpleButton) != null)
     {
         object obj = ((SimpleButton)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((SimpleButton)item).Tag = obj;
     }
     else if ((item as DropDownButton) != null)
     {
         object obj = ((DropDownButton)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((DropDownButton)item).Tag = obj;
     }
     #endregion
     #region Phân quyền trên các control thông tin
     else if ((item as CalcEdit) != null)
     {
         object obj = ((CalcEdit)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((CalcEdit)item).Tag = obj;
     }
     else if ((item as SpinEdit) != null)
     {
         object obj = ((SpinEdit)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((SpinEdit)item).Tag = obj;
     }
     else if ((item as TextEdit) != null)
     {
         object obj = ((TextEdit)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((TextEdit)item).Tag = obj;
     }
     else if ((item as GridColumn) != null)
     {
         object obj = ((GridColumn)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((GridColumn)item).Tag = obj;
     }
     else if ((item as XtraUserControl) != null)
     {
         object obj = ((XtraUserControl)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((XtraUserControl)item).Tag = obj;
     }
     else if ((item as Control) != null)
     {
         object obj = ((Control)item).Tag;
         TagPropertyMan.InsertOrUpdate(ref obj, "SECURITY", permission);
         ((Control)item).Tag = obj;
     }
     #endregion
     else
     {
         PLMessageBoxDev.ShowMessage("ApplyPermissionObject : Item: " + item.GetType().Name + " chưa được hỗ trợ phân quyền.");
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Kiem tra xem formName co nam trong danh sach Public Form khong.
        /// No khong bao gom cac Form la IPublic.
        /// </summary>
        /// <param name="formName"></param>
        /// <returns></returns>
        public static bool CanShowForm(String formName)
        {
            if (FrameworkParams.isPermision == null) return true;

            List<string> publicForms = ApplyPermissionAction.getPublicForm();
            if (publicForms.Contains(formName))
            {
                return true;
            }

            //Check Permission cho truy cập
            Dictionary<string, string> formFeatureMap = ApplyPermissionAction.getFormFeatureMap();
            string featureName = "";
            if (formFeatureMap.ContainsKey(formName))
            {
                featureName = formFeatureMap[formName];
                if (featureName == null)
                {
                    PLMessageBoxDev.ShowMessage("Lập danh sách featureMap bị sai tại form " + formName);
                }
                string per = "";
                if (featureName.Contains(";"))
                {
                    per = featureName.Substring(featureName.IndexOf(';') + 1).Trim();
                    featureName = featureName.Substring(0, featureName.IndexOf(';')).Trim();
                }

                PermissionType PerType = PermissionType.VIEW;
                if (per.Equals("VIEW"))
                {
                    PerType = PermissionType.VIEW;
                }
                else if (per.Equals("ADD"))
                {
                    PerType = PermissionType.ADD;
                }
                else if (per.Equals("DELETE"))
                {
                    PerType = PermissionType.DELETE;
                }
                else if (per.Equals("EDIT"))
                {
                    PerType = PermissionType.EDIT;
                }
                else if (per.Equals("PRINT"))
                {
                    PerType = PermissionType.PRINT;
                }
                else if (per.Equals("EXPORT"))
                {
                    PerType = PermissionType.EXPORT;
                }

                PermissionItem item = new PermissionItem(featureName, PerType);
                bool? flag = ApplyPermissionAction.checkPermission(item);
                if (flag == null || flag == false)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            PLException.AddException(new Exception("Tên " + formName + " không có trong featureMap. Thêm form này vào trong getFormFeatureMap của PLPermission"));
            return true;
        }
Ejemplo n.º 9
0
        /// <summary> Hàm kiểm tra quyền đối với một mục phân quyền  
        ///     False   Không có quyền trên nó, 
        ///     True    Có quyền trên nó
        ///     null    Không có quyền Read trên nó
        /// </summary>
        public static bool? checkPermission(PermissionItem item)
        {
            bool? result = null;
            if (!User.isAdmin(FrameworkParams.currentUser.username) && FrameworkParams.isPermision!=null)
            {
                if (item == null) return true;
                List<Feature> features = ApplyPermissionAction.GetPermissionFeatures();
                foreach (Feature feature in features)
                {
                    if (feature == null)
                        return false;
                    if (feature.featureName.Equals(item.featureName))
                    {
                        switch (item.permissionType)
                        {
                            case PermissionType.ADD:
                                result = feature.isInsert;
                                break;
                            case PermissionType.DELETE:
                                result = feature.isDelete;
                                break;
                            case PermissionType.EDIT:
                                result = feature.isUpdate;
                                break;
                            case PermissionType.ADD_EDIT:
                                if (feature.isInsert || feature.isUpdate)
                                    result = true;
                                else
                                    result = false;
                                break;
                            case PermissionType.ADD_EDIT_DELETE:
                                if (feature.isInsert || feature.isUpdate || feature.isDelete)
                                    result = true;
                                else
                                    result = false;
                                break;
                            case PermissionType.VIEW_ADD_DELETE_EDIT:
                                if (feature.isInsert || feature.isUpdate || feature.isDelete || feature.isRead)
                                    result = true;
                                else
                                    result = false;
                                break;
                            case PermissionType.EDIT_DELETE:
                                if (feature.isUpdate || feature.isDelete)
                                    result = true;
                                else
                                    result = false;
                                break;
                            case PermissionType.VIEW_HIDE:
                                result = feature.isRead;
                                break;
                            case PermissionType.VIEW:
                                if (feature.isRead == false)
                                   result = null;
                                else
                                   result = true;
                               break;
                            case PermissionType.PRINT:
                               result = feature.isPrint;
                               break;
                            case PermissionType.EXPORT:
                               result = feature.isExport;
                               break;
                        }

                        //Tùy vào kết quả sẽ xử lý tiếp.
                        if (result == false)
                        {
                            //Xử lý 1 item chấp nhận nhiều feature khác nhau.
                            foreach(PermissionItem orChildItem in item.OROtherItem){
                                result = checkPermission(orChildItem);
                                if (result == true){
                                    break;
                                }
                            }
                        }
                        else if (result == true) { }
                        else { }
                        return result;
                    }
                }
                PermissionStore.AddMissing(item.featureName);
                return false;
            }
            return true;
        }
Ejemplo n.º 10
0
 public static void ApplyPermissionObject(List<Object> list, Object[] items, PermissionItem[] permission)
 {
     if (items != null)
     {
         for (int i = 0; i < items.Length; i++)
         {
             ApplyPermissionAction.ApplyPermissionObject(list, items[i], permission[i]);
         }
     }
 }
Ejemplo n.º 11
0
 public ItemInfo(string caption, string image, DelegationLib.CallFunction_MulIn_NoOut delegates, PermissionItem per)
 {
     this.caption = caption;
     this.image = image;
     this.delegates = delegates;
     this.per = per;
 }
Ejemplo n.º 12
0
        /// <summary>Thêm ContextMenuStrip vào Grid
        /// </summary>
        /// <param name="grid">Grid cần gắn ContextMenuStrip</param>
        /// <param name="keyField">Tên field cần lấy dữ liệu (ví dụ: lấy giá trị của field ID)</param>
        /// <param name="captions">Mảng tên cho mỗi item trong ContextMenuStrip</param>
        /// <param name="images">Mảng hình ảnh gắng với mỗi item trong ContextMenuStrip</param>
        /// <param name="delegates">Mảng delegate gọi tới một phương thức, gắn với mỗi item trong ContextMenuStrip</param>
        public static void AddMenuToGridView(DevExpress.XtraGrid.GridControl grid, string fieldName, string[] captions, string[] images, DelegationLib.CallFunction_MulIn_NoOut[] delegates, PermissionItem[] pers)
        {
            if (captions == null)
                return;

            GridView gridView1 = (GridView)grid.MainView;
            ContextMenuStrip ctrContextMenuStrip = new ContextMenuStrip();
            //Chưa chỉnh lại Size
            int i = 0;
            foreach (string s in captions)
            {
                //Start Check Permission
                if (pers != null)
                {
                    if (pers[i] != null)
                    {
                        if (ApplyPermissionAction.checkPermission(pers[i]) == null ||
                            ApplyPermissionAction.checkPermission(pers[i]) == false)
                        {
                            i++;
                            continue;
                        }
                    }
                }
                //Tạo Item
                Image image = null;
                image = ResourceMan.getImage16(images[i]);
                ToolStripMenuItem itemI = new ToolStripMenuItem(s, image);
                itemI.Name = i.ToString();
                itemI.Click += delegate(object sender, EventArgs e)
                {
                    //Lấy giá trị chọn từ lưới
                    List<object> objs = new List<object>();
                    foreach (int index in gridView1.GetSelectedRows())
                    {
                        DataRow row = gridView1.GetDataRow(index);
                        objs.Add(row[fieldName]);
                    }

                    //Chọn xử lý tương ứng với chọn lựa
                    delegates[HelpNumber.ParseInt64(((ToolStripMenuItem)sender).Name)](objs);
                };
                ctrContextMenuStrip.Items.Add(itemI);
                i++;
            }
            grid.ContextMenuStrip = ctrContextMenuStrip;
        }
Ejemplo n.º 13
0
 public _MenuItem(string[] _captions, string[] _imageNames, DelegationLib.CallFunction_MulIn_NoOut[] _funcs, PermissionItem[] pers)
     : this(_captions, _imageNames, null, _funcs, pers)
 {
 }
Ejemplo n.º 14
0
        /// <summary>Xây dựng menu nghiệp vụ
        /// </summary>
        /// <param name="captions">Mảng (Array) tên các chọn lựa</param>
        /// <param name="formFullNames">
        ///     Mảng (Array) tên kiểu đầy đủ của form, bao gồm cả namespace
        ///     Form này phải có hàm dựng truyền vào một mảng object.
        /// </param>
        /// <param name="images">Mảng (Array) tên hình gắn vào các chọn lựa</param>
        private void createBusinessMenu(string[] captions, string fieldName, string[] ImageNames, DelegationLib.CallFunction_MulIn_NoOut[] delegates, PermissionItem[] pers)
        {
            PhieuQuanLyUtil.CreateBusinessMenu(that.gridViewMaster, that.barSubItem1, fieldName,
                captions, ImageNames, delegates, pers);
            #region Hàm cũ - Xóa
            //if (captions == null)
            //{
            //    //that.barSubItem1.Enabled = false;
            //    that.barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            //    return;
            //}

            //int index = 0;
            //foreach (string s in captions)
            //{
            //    //Start Check Permission
            //    if (pers != null)
            //    {
            //        if (pers[index] != null)
            //        {
            //            if (ApplyPermissionAction.checkPermission(pers[index])==null ||
            //                ApplyPermissionAction.checkPermission(pers[index])==false)
            //            {
            //                index++;
            //                continue;
            //            }
            //        }
            //    }
            //    //End Check Permission

            //    DevExpress.XtraBars.BarButtonItem temp = new DevExpress.XtraBars.BarButtonItem();
            //    temp.Caption = captions[index];
            //    temp.Name = index.ToString();
            //    if (!ImageNames[index].Equals(""))
            //    {
            //        temp.Glyph = ResourceMan.getImage16(ImageNames[index]);
            //    }
            //    temp.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph;
            //    temp.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            //    {
            //        if (that.gridViewMaster.SelectedRowsCount < 1)
            //        {
            //            HelpMsgBox.ShowNotificationMessage(that._msgChuaChonDuLieu);
            //            return;
            //        }
            //        //Lấy danh sách các giá trị (row[fieldName]) đang chọn
            //        List<object> objs = new List<object>();
            //        foreach (int i in that.gridViewMaster.GetSelectedRows())
            //        {
            //            DataRow row = that.gridViewMaster.GetDataRow(i);
            //            objs.Add(row[fieldName]);
            //        }

            //        //Chọn xử lý tương ứng với chọn lựa
            //        delegates[HelpNumber.ParseInt32(e.Item.Name)](objs);
            //    };

            //    that.barSubItem1.ItemLinks.Add(temp);
            //    index++;
            //}
            ////Không có chọn lựa ẩn luôn.
            //if (that.barSubItem1.ItemLinks == null || that.barSubItem1.ItemLinks.Count == 0)
            //    that.barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            #endregion
        }
Ejemplo n.º 15
0
 /// <summary> Hàm kiểm tra quyền đối với một mục phân quyền  
 ///     False   Không có quyền trên nó, 
 ///     True    Có quyền trên nó
 ///     Null    Không có quyền Read trên nó
 /// </summary>
 public static bool? Check(PermissionItem item)
 {
     return ApplyPermissionAction.checkPermission(item);
 }
Ejemplo n.º 16
0
        /// <summary>Load Quyền cho các menu
        /// </summary>
        private void loadCategory()
        {
            List<string> publicForms = ApplyPermissionAction.getPublicForm();
            Dictionary<string, string> formFeatureMap = ApplyPermissionAction.getFormFeatureMap();
            List<Feature> features = ApplyPermissionAction.GetPermissionFeatures();

            foreach (DataRow dr in ds.Tables[0].Select(""))
            {
                string id = dr["Id"].ToString();
                if (getEnable(id) == false) continue;

                string formName = getForm(id);
                formName = this.getFormClassName(formName);

                if (!formName.Equals(""))
                    setEnable(id, false);
                else
                    continue;

                if (getEnable(id) == false && publicForms.Contains(formName))
                {
                    setEnable(id, true);
                    continue;
                }

                //Check Permission cho truy cập
                string featureName = "";
                if (formFeatureMap.ContainsKey(formName)){
                    featureName = formFeatureMap[formName];
                    if (featureName == null) {
                        PLMessageBoxDev.ShowMessage("Lập danh sách featureMap bị sai tại form " + formName);
                    }
                    string per = "";
                    if (featureName.Contains(";"))
                    {
                        per = featureName.Substring(featureName.IndexOf(';') + 1).Trim();
                        featureName = featureName.Substring(0, featureName.IndexOf(';')).Trim();
                    }

                    PermissionType PerType = PermissionType.VIEW;
                    if(per.Equals("VIEW")){
                        PerType = PermissionType.VIEW;
                    }
                    else if (per.Equals("ADD")){
                        PerType = PermissionType.ADD;
                    }
                    else if (per.Equals("DELETE")){
                        PerType = PermissionType.DELETE;
                    }
                    else if(per.Equals("EDIT")){
                        PerType = PermissionType.EDIT;
                    }

                    PermissionItem item = new PermissionItem(featureName, PerType);
                    if (ApplyPermissionAction.checkPermission(item)==true)
                    {
                        setEnable(id, true);
                    }
                }
            }
        }
Ejemplo n.º 17
0
 public static void CreateBusinessMenu(PivotGridControl gridMaster, BarSubItem barSubItem1, 
     string fieldName, string[] captions, string[] ImageNames,
     DelegationLib.CallFunction_MulIn_NoOut[] delegates, PermissionItem[] pers)
 {
     ItemClickEventHandler handler = null;
     if (captions == null)
     {
         barSubItem1.Visibility = BarItemVisibility.Never;
     }
     else
     {
         int index = 0;
         foreach (string str in captions)
         {
             bool? nullable;
             if (((pers != null) && (pers[index] != null)) &&
                 !(ApplyPermissionAction.checkPermission(pers[index]).HasValue &&
                 !(!(nullable = ApplyPermissionAction.checkPermission(pers[index])).GetValueOrDefault() && nullable.HasValue)))
             {
                 index++;
             }
             else
             {
                 BarButtonItem item = new BarButtonItem();
                 item.Caption = captions[index];
                 item.Name=index.ToString();
                 if (!ImageNames[index].Equals(""))
                 {
                     item.Glyph=ResourceMan.getImage16(ImageNames[index]);
                 }
                 item.PaintStyle = BarItemPaintStyle.Standard;
                 if (handler == null)
                 {
                     handler += new ItemClickEventHandler(delegate(object sender,  ItemClickEventArgs e)
                     {
                         if (gridMaster.Cells.MultiSelection.SelectedCells.Count < 1)
                         {
                             HelpMsgBox.ShowNotificationMessage("");
                         }
                         else
                         {
                             List<object> data = new List<object>();
                             foreach (Point point in gridMaster.Cells.MultiSelection.SelectedCells)
                             {
                                 data.Add(point);
                             }
                             delegates[HelpNumber.ParseInt32(e.Item.Name)](data);
                         }
                     });
                 }
                 item.ItemClick += handler;
                 barSubItem1.ItemLinks.Add(item);
                 index++;
             }
         }
         if ((barSubItem1.ItemLinks == null) || (barSubItem1.ItemLinks.Count == 0))
         {
             barSubItem1.Visibility = BarItemVisibility.Never;
         }
     }
 }