示例#1
0
        //Chú ý tên table trong DataTable phải giống như tên table mà mình cần thao tác thêm xóa
        public static PLGridViewUpdate ToPLGridViewUpdate(GridControl grid, PLGridView gridView,
            DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission,
            PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc,
            PLDelegation.ProcessDataRow UpdateFunc, int RowPerPage)
        {
            PLGridViewUpdate update = new PLGridViewUpdate();
            for (int i = 0; i < gridView.Columns.Count; i++)
            {
                update.gridView.Columns.Add(gridView.Columns[i]);
            }

            update._init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule,
                        permission, InsertFunc, DeleteFunc, UpdateFunc);

            PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(update.gridControl, RowPerPage, update);
            page.AddFunction = update.AddAction;
            page.DeleteFunction = update.DeleteAction;
            page.EditFunction = update.EditAction;
            page.NoSaveFunction = update.NoSaveAction;
            page.PrintFunction = update.PrintAction;
            page.SaveFunction = update.SaveAction;

            update.Dock = grid.Dock;
            update.Location = grid.Location;

            return update;
        }
        public RepositoryItemSelectDMGridTemplate(GroupElementType type, GridView gridView, string TableName, string columnField, string IDField, string DislayField, string getField, string[] NameFields,
            string[] Subjects, string FilterField, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, params string[] readOnlyField)
        {
            CotAo = columnField + getField + "_PLV";
            this.ShowPopupShadow = true;
            dmGridTemplate1 = new DMGrid();
            popupControl = new PopupContainerControl();
            this.CloseOnOuterMouseClick = false;
            this.PopupControl = popupControl;
            popupControl.Controls.Add(dmGridTemplate1);
            popupControl.Size = dmGridTemplate1.Size;
            this.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
            this.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(RepositoryItemSelectDMGridTemplate_EditValueChanging);
            //dmGridTemplate1._init(type, TableName, IDField, DislayField, NameFields, Subjects, InitGridCol, Rule, permission, readOnlyField);
            this.Popup += new EventHandler(RepositoryItemSelectDMGridTemplate_Popup);
            this.CloseUp += new DevExpress.XtraEditors.Controls.CloseUpEventHandler(popupContainerEdit1_CloseUp);
            this.Closed += new DevExpress.XtraEditors.Controls.ClosedEventHandler(popupContainerEdit1_Closed);
            this.KeyDown += new KeyEventHandler(popupContainerEdit1_KeyDown);
            this.DislayField = DislayField;
            this.FilterField = FilterField;

            gridView.GridControl.DataSourceChanged += delegate(object sender, EventArgs e)
            {
                if (gridView.GridControl.DataSource != null &&
                    !((DataTable)gridView.GridControl.DataSource).Columns.Contains(CotAo))
                {

                    DataTable dt = (DataTable)gridView.GridControl.DataSource;
                    dt.Columns.Add(new DataColumn(CotAo));
                    SetValueTable(ref dt, columnField, CotAo, TableName, "ID", getField);
                }
            };

            long idValue;

            gridView.CellValueChanging += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
            {
                if (e.Column.FieldName.Equals(CotAo))
                {
                    idValue = _getSelectedID();
                    if (e.RowHandle < 0)
                    {
                        gridView.EditingValue = idValue;
                        gridView.SetFocusedRowCellValue(gridView.Columns.ColumnByFieldName(columnField), idValue);
                    }
                    else
                    {
                        DataTable dt = ((DataTable)gridView.GridControl.DataSource);
                        DataRow row = dt.Rows[e.RowHandle];
                        row[columnField] = idValue;
                        row[CotAo] = e.Value;
                    }
                }
            };
            gridView.InitNewRow += delegate(object sender, InitNewRowEventArgs e)
            {
                gridView.SetRowCellValue(e.RowHandle, columnField,_getSelectedID());
            };
        }
示例#3
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;
 }
示例#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;
     }
 }
示例#5
0
 /// <summary>Unique: N Field, Phân quyền: Có (Chưa xây dựng)
 /// </summary>
 public DMBasicGrid(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
     InitGridColumns InitGridCol, GetRule Rule,
     DelegationLib.DefinePermission permission,
     PLDelegation.ProcessDataRow InsertFunc,
     PLDelegation.ProcessDataRow DeleteFunc,
     PLDelegation.ProcessDataRow UpdateFunc)
 {
     InitializeComponent();
     _init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission,
          InsertFunc,  DeleteFunc,  UpdateFunc);
 }
示例#6
0
        /// <summary>
        /// Unique:     N Field
        /// Phân quyền: Có (Chưa xử lý), 
        /// Cho thêm    Có Nếu readOnlyField = null hoặc không truyền vào
        ///             Không Nếu readOnlyFiled !=null (chỉ cập nhật)
        /// VISIBLE_BIT:Không
        /// </summary>
        public DMGrid(string TableName, string IDField, string DislayField, string[] NameFields, string[] Subjects, 
            DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule,
            DelegationLib.DefinePermission permission,
            params string[] readOnlyField)
        {
            InitializeComponent();

            _init(GroupElementType.ONLY_INPUT, TableName, IDField, DislayField, NameFields, Subjects,
                InitGridCol, Rule,
                permission,
                readOnlyField);
        }
示例#7
0
 /// <summary>Thực hiện hành động trong action và hiện thông điệp chờ.
 /// Chú ý: Khi dùng các hành động trong action ko có phần MessageBox.
 /// </summary>
 public static void showMsgForm(XtraForm parent, DelegationLib.CallFunction_MulIn_NoOut action)
 {
     WaitingMsg msg = new WaitingMsg(parent);
     try
     {
         action(new List<object>());
     }
     catch { }
     finally
     {
         msg.Finish();
     }
 }
示例#8
0
        public void Doing(DelegationLib.CallFunction_MulIn_NoOut func, List<object> input)
        {
            Cursor currentCursor = null;
            try
            {
                parent.Refresh();
                stop = false;
                thread = new Thread(new ThreadStart(StartAction));
                thread.Start();
                currentCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;

                func(input);
            }
            catch { }
            finally
            {
                EndAction();
                Cursor.Current = currentCursor;
            }
        }
示例#9
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);
 }
示例#10
0
        public PermissionType permissionType; //Loại phân quyền

        #endregion Fields

        #region Constructors

        public PermissionItem(string featureName, PermissionType permissionType,
            PermissionHow permissionHow, DelegationLib.CallFunction_NoIn_NoOut failAction)
        {
            this.featureName = featureName;
            this.permissionType = permissionType;
            this.permissionHow = permissionHow;
            this.failAction = failAction;
        }
示例#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;
 }
示例#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)
 {
     AddMenuToGridView(grid, fieldName, captions, images, delegates, null);
 }
示例#13
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;
        }
示例#14
0
 /// <summary>Thực hiện hành động trong action và hiện thông điệp chờ.
 /// Chú ý: Khi dùng các hành động trong action ko có phần MessageBox.
 /// </summary>
 public static void showMsgForm(XtraForm parent, DelegationLib.CallFunction_NoIn_NoOut action)
 {
     WaitingMsg.LongProcess(action);
 }
示例#15
0
        public void _init(
            string TableName, string IDField,
            string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission, int RowPerPage)
        {
            base._init(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission);

            PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(gridControl, RowPerPage, this);
            page.AddFunction = AddAction;
            page.DeleteFunction = DeleteAction;
            page.EditFunction = EditAction;
            page.NoSaveFunction = NoSaveAction;
            page.PrintFunction = PrintAction;
            page.SaveFunction = SaveAction;
        }
示例#16
0
        /// <summary>
        /// Unique:     N Field
        /// Phân quyền: Có (Chưa xử lý), 
        /// Cho thêm:   Có Nếu readOnlyField = null hoặc không truyền vào
        ///             Không Nếu readOnlyFiled !=null (chỉ cập nhật)
        /// VISIBLE_BIT:Không
        /// GroupElementType: Chọn kiểu chọn lựa ( Chỉ chọn , Chọn và Thêm )
        /// </summary>
        public void _init(GroupElementType type, 
            string TableName, string IDField, string DislayField, string[] NameFields, string[] Subjects,
            DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule,
            DelegationLib.DefinePermission permission,
            params string[] readOnlyField)
        {
            this.btnAdd.Image = FWImageDic.ADD_IMAGE20;
            this.btnDel.Image = FWImageDic.DELETE_IMAGE20;
            this.btnUpdate.Image = FWImageDic.EDIT_IMAGE20;
            this.btnSelect.Image = FWImageDic.CHOICE_IMAGE20;
            this.btnNoSelect.Image = FWImageDic.NO_CHOICE_IMAGE20;
            this.btnInfo.Image = FWImageDic.DETAIL_IMAGE20;
            this.btnClose.Image = FWImageDic.CLOSE_IMAGE20;
            this.btnSave.Image = FWImageDic.SAVE_IMAGE20;
            this.btnNoSave.Image = FWImageDic.NO_SAVE_IMAGE20;

            _DMCore = new DMBasicGrid(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission);
            _DMCore.Dock = DockStyle.Fill;
            this.Controls.Add(_DMCore);
            if (popupContainer != null) _DMCore.SupportDoubleClick = false;

            this.Controls.Add(this.btnBar);
            this.IDField = IDField;
            this.DislayField = DislayField;
            btnExport = HelpGrid.addXuatRaFileItem(this.btnBar, this.Grid);
            btnPrint = HelpGrid.addInLuoiItem(this.btnBar, this.Grid);
            SetMode(type);
            EditMode(readOnlyField);
            Grid.KeyDown += new KeyEventHandler(Grid_KeyDown);
            Grid.DoubleClick += new EventHandler(Grid_DoubleClick);
            _DMCore.SetDMGridOwner(this);

            if (Grid is PLGridView)
            {
                ((PLGridView)Grid)._SetPermissionElement(btnPrint, btnExport);
            }
        }
示例#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;
         }
     }
 }
示例#18
0
 public static void showProgressForm(XtraForm parent, DelegationLib.CallFunction_MulIn_NoOut action)
 {
     new frmProgressWaitHelp(parent).Doing(action, new List<object>());
 }
示例#19
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
        }
示例#20
0
        public void _init(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission,
            PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc)
        {
            this.TableName = null;
            this.DataSource = DataSource;
            this.InsertFunc = InsertFunc;
            this.DeleteFunc = DeleteFunc;
            this.UpdateFunc = UpdateFunc;

            this.IDField = IDField;
            this.NameFields = NameFields;
            this.Subjects = Subjects;
            this.InitGridCol = InitGridCol;
            this.Rule = Rule;
            InitGrid();
            InitDataGrid();
            InitEventGrid();
            this.permission = permission;
            this.gridView.DoubleClick += new EventHandler(gridView_DoubleClick);
        }
示例#21
0
 public HotKeyItem(ProtocolVN.Framework.Win.ModifierKeys modifier, Keys key, DelegationLib.CallFunction_SinIn_SinOut func)
 {
     this.modifier = modifier;
     this.key = key;
     this.func = func;
 }
示例#22
0
 public _MenuItem(string[] _captions, string[] _imageNames, string _fieldName, DelegationLib.CallFunction_MulIn_NoOut[] _funcs)
     : this(_captions, _imageNames, _fieldName, _funcs, null)
 {
 }
示例#23
0
 public PermissionItem(string featureName, PermissionType permissionType,
     DelegationLib.CallFunction_NoIn_NoOut failAction)
     : this(featureName, permissionType, PermissionHow.HIDE, failAction)
 {
 }
示例#24
0
 public static void showProcessFile(XtraForm parent, DelegationLib.CallFunction_MulIn_NoOut action, List<object> input)
 {
     new frmProcessFileWaitFormHelp(parent).Doing(action, input);
 }
示例#25
0
 public void DefinePermission(DelegationLib.DefinePermission permission)
 {
     this.permission = permission;
 }
示例#26
0
 public _MenuItem(string[] _captions, string[] _imageNames, DelegationLib.CallFunction_MulIn_NoOut[] _funcs, PermissionItem[] pers)
     : this(_captions, _imageNames, null, _funcs, pers)
 {
 }
示例#27
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;
        }
示例#28
0
 /// <summary>Unique: N Field, Phân quyền: Có (Chưa xây dựng)
 /// </summary>
 public DMBasicGrid(string TableName, string IDField, string[] NameFields, string[] Subjects, 
     InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission)
 {
     InitializeComponent();
     _init(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission);
 }
示例#29
0
 public DMBasicGrid(string TableName, DelegationLib.DefinePermission permission, bool IsVisible)
 {
     InitializeComponent();
     if (IsVisible)
     {
         _init(TableName, "ID", new string[]{ "NAME" }, new string[] { "Tên" }
             , CreateDM_BASIC_V, GetRuleDM_BASIC, null);
     }
     else
     {
         _init(TableName, "ID", new string[] { "NAME" }, new string[] { "Tên" }
             , CreateDM_BASIC_No_V, GetRuleDM_BASIC, null);
     }
 }
示例#30
0
 public static RepositoryItemSelectDMGridTemplate CotPLDMGrid(GridView gridView, GridColumn column, GroupElementType type, string TableName,
     string IDField, string DislayField, string getField, string[] NameFields,
     string[] Subjects, string FilterField,
     DMBasicGrid.InitGridColumns InitGridCol,
     DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission,
     string ColumnField,
     DataSet dataTable0,
     params string[] readOnlyField)
 {
     column.FieldName = ColumnField + getField + "_PLV";
     RepositoryItemSelectDMGridTemplate dmGrid =
         new RepositoryItemSelectDMGridTemplate(type, gridView, TableName, ColumnField, IDField, DislayField, getField,
             NameFields, Subjects, FilterField, InitGridCol, Rule, permission, dataTable0, readOnlyField);
     column.ColumnEdit = dmGrid;
     gridView.OptionsBehavior.AutoExpandAllGroups = true;
     return dmGrid;
 }