コード例 #1
0
ファイル: ExportExcelCommand.cs プロジェクト: Ocun/VSTool
        /// <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);
        }
コード例 #2
0
        private void init(object sender, EventArgs e)
        {
            ICurrentDocumentWindow currentDocumentWin = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>();

            if (currentDocumentWin == null)
            {
                return;
            }

            IFindControlService ser = this.GetService <IFindControlService>();
            Control             c;

            if (ser.TryGet("XdesignerGrid1XMO_AB_D2", out c))
            {
                _dgGrid3 = c as DigiwinGrid;
                _dgGrid3.InnerGridView.MouseDown += new MouseEventHandler(InnerGridView_MouseDown);
            }
            Control d;

            if (ser.TryGet("XdesignerGrid1XMO_AB_D1", out d))
            {
                _dgGrid1 = d as DigiwinGrid;
                _dgGrid1.InnerGridView.MouseDown += new MouseEventHandler(_dgGrid1_InnerGridView_MouseDown);
            }
        }
コード例 #3
0
ファイル: ExportExcelCommand.cs プロジェクト: Ocun/VSTool
        public override void Execute()
        {
            ICurrentDocumentWindow     win        = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>();
            ServiceControl             serControl = win.EditController.EditorView as ServiceControl;
            DependencyObject           entity     = win.EditController.EditorView.DataSource as DependencyObject;
            DependencyObjectCollection XMO_AA_D2  = entity["XMO_AA_D2"] as DependencyObjectCollection;
            IFindControlService        findSer    = serControl.GetService <IFindControlService>();

            if (XMO_AA_D2.Count == 0)
            {
                DigiwinMessageBox.ShowInfo("无导出数据!");
                return;
            }
            Control control;

            if (findSer.TryGet("XdesignerGrid1XMO_AA_D1", out control))
            {
                DigiwinGrid gridControl = control as DigiwinGrid;
                if (gridControl != null)
                {
                    BindingSource bs = gridControl.DataSource as BindingSource;
                    DependencyObjectCollection entityDColl = ((DependencyObjectCollectionView <DependencyObjectView>)bs.List).DependencyObjectCollection;

                    using (var form = new ExportExcelForm(gridControl.InnerGridView, this.ResourceServiceProvider, this.ServiceCallContext))
                    {
                        DialogResult log = form.ShowDialog();
                        if (log == DialogResult.OK)
                        {
                            DigiwinMessageBox.ShowInfo("资料导出成功!");
                        }
                        form.Dispose();
                    }
                }
            }



            return;

            using (var form = new ExportExcelForm(entity, this.ResourceServiceProvider, this.ServiceCallContext))
            {
                DialogResult log = form.ShowDialog();
                if (log == DialogResult.OK)
                {
                    DigiwinMessageBox.ShowInfo("资料导出成功!");
                }
                form.Dispose();
            }
        }
コード例 #4
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);
        }
コード例 #5
0
        private void CreateUIControls(object sender, EventArgs e)
        {
            IFindControlService findControlSrv = this.GetService <IFindControlService>();
            Control             control        = null;

            if (findControlSrv.TryGet("pickListCOMPANY_TYPE", out control))
            {
                if (control != null)
                {
                    DigiwinPickListLookUpEdit pick = control as DigiwinPickListLookUpEdit;
                    if (pick != null)
                    {
                        ICurrentDocumentWindow win = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>();
                        if (win != null)
                        {
                            string           id    = win.EditController.EditorView.Id;
                            DependencyObject dataS = win.EditController.Document.DataSource as DependencyObject;
                            if (dataS != null && dataS.ExtendedProperties.Contains("TFL") && //只有在E10中的公式录入界面才执行下面的逻辑,才依据此扩展属性修改过滤条件,在Excel中不控制
                                (id.Contains("QC") || id.Contains("QM") || id.Contains("FS") ||
                                 id.Contains("LFS")
                                ))
                            {
                                pick.FilterExpression = "\"[Id] In (2)\"";
                            }

                            if (dataS != null && dataS.ExtendedProperties.Contains("TFL_FormulaView") && //只有在E10中的公式查看按钮才执行下面的逻辑
                                (id.Contains("QC") || id.Contains("QM") || id.Contains("FS") ||
                                 id.Contains("LFS")
                                ))
                            {
                                SetFINReadOnly(sender as EditorView);
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
        private void CreateUIControls22(object sender, EventArgs e)
        {
            ICurrentDocumentWindow win = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>();

            if (win != null)
            {
                string           id    = win.EditController.EditorView.Id;
                DependencyObject dataS = win.EditController.Document.DataSource as DependencyObject;
                if (dataS != null && dataS.ExtendedProperties.Contains("TFL_FormulaView") && //只有在E10中的公式查看按钮才执行下面的逻辑
                    (id.Contains("QC") || id.Contains("QM") || id.Contains("FS") ||
                     id.Contains("LFS")
                    ))
                {
                    DependencyObject obj = win.EditController.EditorView.DataSource as DependencyObject;

                    bool isLS = false;  //是否存在离散的条件
                    if (obj["FILER_MODE1"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiADMIN_UNIT_CODE"] = obj["uiADMIN_UNIT_NAME"] = obj["ADMIN_UNITS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE6"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiCUSTOMER_CODE"] = obj["uiCUSTOMER_NAME"] = obj["CUSTOMERS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE4"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiSUPPLIER_CODE"] = obj["uiSUPPLIER_NAME"] = obj["SUPPLIERS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE2"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiEMPLOYEE_CODE"] = obj["uiEMPLOYEE_NAME"] = obj["EMPLOYEES"].ToStringExtension();
                    }
                    if (obj["FILER_MODE5"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiSALES_CENTER_CODE"] = obj["uiSALES_CENTER_NAME"] = obj["SALES_CENTERS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE3"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiSUPPLY_CENTER_CODE"] = obj["uiSUPPLY_CENTER_NAME"] = obj["SUPPLY_CENTERS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE7"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiPLANT_CODE"] = obj["uiPLANT_NAME"] = obj["PLANTS"].ToStringExtension();
                    }
                    if (obj["FILER_MODE8"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiAUXILIARY_ITEM_CODE"] = obj["uiAUXILIARY_ITEM_NAME"] = obj["AUXILIARY_ITEM1S"].ToStringExtension();
                    }
                    if (obj["FILER_MODE9"].ToInt32() == 2)
                    {
                        isLS = true;
                        obj["uiAUXILIARY_ITEM_CODE_02"] = obj["uiAUXILIARY_ITEM_NAME_02"] = obj["AUXILIARY_ITEM2S"].ToStringExtension();
                    }

                    if (isLS && !obj.ExtendedProperties.Contains("TFL_IN"))    //第一次通过业务的入口进去时,要初始化各参数的值
                    {
                        obj.ExtendedProperties.Add("TFL_IN", "TFL");
                    }

                    EditorView ev    = sender as EditorView;
                    Control[]  ctrls = ev.Control.Controls.Find("TabControl1", true);
                    if (ctrls.Length > 0)
                    {
                        TabControl tc = ctrls[0] as TabControl;
                        if (tc != null)
                        {
                            SetFINReadOnly(tc.TabPages["HeaderTab_2"]);  // 公式查看各参数只读
                        }
                    }
                }
            }
        }
コード例 #7
0
 public override void Execute()
 {
     ICurrentDocumentWindow window = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>();
     DependencyObject       entity = (DependencyObject)window.EditController.EditorView.DataSource;
 }