Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="callContext"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override bool QueryEnabled(Digiwin.Common.Advanced.IResourceServiceProvider provider, Digiwin.Common.ServiceCallContext callContext, System.Windows.Forms.IDataObject context)
        {
            bool result = base.QueryEnabled(provider, callContext, context);
            bool flag   = true;

            if (result)
            {
                ICurrentDocumentWindow window = provider.GetService(typeof(ICurrentDocumentWindow), callContext.TypeKey) as ICurrentDocumentWindow;
                if (window != null)
                {
                    DependencyObject entity = window.EditController.Document.DataSource as DependencyObject;
                    if (entity != null)
                    {
                        if (window.EditController.Document.EditState != EditState.Edit &&
                            window.EditController.Document.EditState != EditState.Create &&
                            window.EditController.Document.EditState != EditState.Open
                            )
                        {
                            return(false);
                        }
                    }

                    return(flag);
                }
                return(flag);
            }
            return(flag);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="callContext"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override bool QueryEnabled(Digiwin.Common.Advanced.IResourceServiceProvider provider, Digiwin.Common.ServiceCallContext callContext, System.Windows.Forms.IDataObject context)
        {
            ICurrentBrowseWindow win = provider.GetService(typeof(ICurrentBrowseWindow), "SALES_ORDER_DOC") as ICurrentBrowseWindow;

            if (win == null || win.BrowseView.DataSource == null)
            {
                return(false);
            }
            bool flag = true;
            //^_^ 20171010 MODI BY HEHF FOR CBBM11709199  ↓
            //DependencyObjectCollection coll = win.BrowseView.DataSource as DependencyObjectCollection;
            //var selectedColl = coll.Where(a => Convert.ToBoolean(a["IsSelected"], CultureInfo.InvariantCulture)).Select(b => b);
            var selectedColl = win.BrowseView.SelectObjects;

            //^_^ 20171010 MODI BY HEHF FOR CBBM11709199  ↑
            selectedColl.ToList().ForEach(p =>
            {
                if (3.Equals(((DependencyObject)p)["XSOURCE_TYPE"]))
                {
                    flag = false;
                }
            });


            return(flag);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="callContext"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override bool QueryEnabled(Digiwin.Common.Advanced.IResourceServiceProvider provider, Digiwin.Common.ServiceCallContext callContext, System.Windows.Forms.IDataObject context)
        {
            ICurrentDocumentWindow win = provider.GetService(typeof(ICurrentDocumentWindow), "SALES_ORDER_DOC") as ICurrentDocumentWindow;

            if (win == null || win.EditController.Document.DataSource == null)
            {
                return(false);
            }
            bool             flag = true;
            DependencyObject coll = win.EditController.Document.DataSource as DependencyObject;

            if (3.Equals(coll["XSOURCE_TYPE"]))
            {
                flag = false;
            }
            return(flag);
        }