private void Initialize(WindowTabInfo windowTabInfo, IControlManager cmParent)
        {
            ISearchManager        smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent == null ? null : cmParent.DisplayManager);
            IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(windowTabInfo, smMaster) as IWindowControlManager;

            if (cmParent != null && cmParent.Dao is IRelationalDao)
            {
                ManagerFactory.GenerateBusinessLayer(cmParent.Dao as IRelationalDao, windowTabInfo);
            }
            else
            {
                IBaseDao daoMaster = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(windowTabInfo);
                cmMaster.Dao = daoMaster;
            }

            this.SetControlManager(cmMaster, windowTabInfo.GridName);

            //ArchiveSearchForm searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]);
            //this.SearchPanel = searchForm;
            //cmMaster.StateControls.Add(searchForm);

            // daoParent's subDao is inserted in detailForm
            if (this is IBoundGridWithDetailGridLoadOnDemand)
            {
                ArchiveFormFactory.GenerateDetailGrids(this as IBoundGridWithDetailGridLoadOnDemand, windowTabInfo);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (!string.IsNullOrEmpty(this.Context.Request.QueryString["window"]))
                {
                    string windowId = this.Context.Request.QueryString["window"];

                    WindowInfo            windowInfo = ADInfoBll.Instance.GetWindowInfo(windowId);
                    IList <WindowTabInfo> tabInfos   = null;
                    if (windowInfo != null)
                    {
                        this.Title = windowInfo.Text;
                        tabInfos   = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Id);
                    }
                    if (tabInfos != null && tabInfos.Count > 0)
                    {
                        ISearchManager sm = ArchiveFormFactory.GenerateSearchManager(tabInfos[0], null) as ISearchManager;

                        IDisplayManager dm = ReflectionHelper.CreateInstanceFromType(ReflectionHelper.GetTypeFromName(tabInfos[0].DisplayManagerClassName), sm) as IDisplayManager;

                        ReportInfo reportInfo = ADInfoBll.Instance.GetReportInfo(windowInfo.Id);
                        CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = ReflectionHelper.CreateInstanceFromName(reportInfo.ReportDocument) as CrystalDecisions.CrystalReports.Engine.ReportDocument;
                        Feng.Web.MyCrystalReportViewer reportViewer = this.CrystalReportViewer1;
                        reportViewer.CrystalHelper.ReportSource = reportDocument;

                        //string[] ss = reportInfo.ConnectionInfo.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        //if (ss.Length != 4)
                        //{
                        //    throw new ArgumentException("Invalid ConnectionInfo format!");
                        //}
                        //reportViewer.CrystalHelper.ServerName = ss[0].Trim();
                        //reportViewer.CrystalHelper.DatabaseName = ss[1].Trim();
                        //reportViewer.CrystalHelper.UserId = ss[2].Trim();
                        //reportViewer.CrystalHelper.Password = ss[3].Trim();

                        if (!string.IsNullOrEmpty(this.Context.Request.QueryString["se"]))
                        {
                            string searchExpression = this.Context.Request.QueryString["se"];
                            SetParameter(SearchExpression.Parse(searchExpression), reportViewer);
                        }

                        reportViewer.OpenReport();
                    }
                }
                else
                {
                    return;
                }
            }
        }
Exemplo n.º 3
0
        private void Initialize(WindowTabInfo windowTabInfo, IDisplayManager dmParent)
        {
            ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(windowTabInfo, dmParent);

            IDisplayManager dmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(windowTabInfo, smMaster);

            this.SetDisplayManager(dmMaster, windowTabInfo.GridName);

            //ArchiveSearchForm searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]);
            //this.SearchPanel = searchForm;

            if (this is IBoundGridWithDetailGridLoadOnDemand)
            {
                ArchiveFormFactory.GenerateDetailGrids((IBoundGridWithDetailGridLoadOnDemand)this, windowTabInfo);
            }
        }
Exemplo n.º 4
0
        private void SetTopGrid()
        {
            if (用途分类.SelectedDataValue == null)
            {
                return;
            }

            凭证用途分类 ytfl = (凭证用途分类)用途分类.SelectedDataValue;

            if (ytfl == 凭证用途分类.业务应付)
            {
                if (付款对象.SelectedDataValue == null)
                {
                    return;
                }
                ArchiveFormFactory.SetupDataUnboundGrid(grdTop, ADInfoBll.Instance.GetWindowTabInfo("资金票据_应收应付当前"));
                grdTop.DisplayManager.SearchManager.LoadData(SearchExpression.And(SearchExpression.Eq("相关人", 付款对象.SelectedDataValue),
                                                                                  SearchExpression.Eq("收付标志", Hd.Model.收付标志.付)), null);
            }
        }
Exemplo n.º 5
0
        void DataRowTemplate_EditEnded(object sender, EventArgs e)
        {
            Xceed.Grid.DataRow row = sender as Xceed.Grid.DataRow;
            if (row.Cells["费用项"].Value != null)
            {
                if (row.Cells["费用项"].Value.ToString() == "011")
                {
                    ArchiveDetailForm detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_固定资产"));
                    if (detailForm != null)
                    {
                        detailForm.ControlManager.AddNew();
                        detailForm.UpdateContent();
                        detailForm.DisplayManager.DataControls["购入金额"].SelectedDataValue = row.Cells["金额"].Value;
                        Hd.Model.Kj.固定资产 entity = detailForm.DisplayManager.CurrentItem as Hd.Model.Kj.固定资产;
                        if (this.DisplayManager.DataControls["日期"].SelectedDataValue != null)
                        {
                            entity.购入时间 = (DateTime)this.DisplayManager.DataControls["日期"].SelectedDataValue;
                        }
                        else
                        {
                            entity.购入时间 = System.DateTime.Today;
                        }

                        detailForm.ShowDialog();
                    }
                }
                else if (row.Cells["费用项"].Value.ToString() == "012")
                {
                    ArchiveDataControlForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_结算期限")) as ArchiveDataControlForm;
                    if (form != null)
                    {
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            row.Cells["结算期限"].Value = form.DataControls["结算期限"].SelectedDataValue;
                            row.Cells["业务分类"].Value = form.DataControls["业务分类"].SelectedDataValue;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        private static void TestAction(ActionInfo actionInfo)
        {
            switch (actionInfo.ActionType)
            {
            case ActionType.Window:
            {
                WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(actionInfo.Window.Name);
                if (windowInfo == null)
                {
                    throw new ArgumentException("Invalid WindowID in menuInfo");
                }
                MyChildForm form = null;
                try
                {
                    form             = ServiceProvider.GetService <IWindowFactory>().CreateWindow(windowInfo) as MyChildForm;
                    form.WindowState = FormWindowState.Maximized;
                    var mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;
                    //form.Show();
                    mdiForm.ShowChildForm(form);
                    TestWindow(form);
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                }
                finally
                {
                    if (form != null)
                    {
                        form.Close();
                    }
                }
            }
            break;

            case ActionType.Form:
            {
                FormInfo formInfo = null;
                if (actionInfo.Form != null)
                {
                    formInfo = ADInfoBll.Instance.GetFormInfo(actionInfo.Form.Name);
                }

                if (formInfo == null)
                {
                    throw new ArgumentException("Invalid FormInfo in menuInfo");
                }
                Form form = null;
                try
                {
                    form             = ArchiveFormFactory.CreateForm(formInfo);
                    form.WindowState = FormWindowState.Maximized;
                    var mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;
                    //form.Show();
                    if (form is MyChildForm)
                    {
                        mdiForm.ShowChildForm(form as MyChildForm);
                    }
                    else
                    {
                        form.Show();
                    }
                    TestForm(form);
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                }
                finally
                {
                    if (form != null)
                    {
                        form.Close();
                    }
                }
            }
            break;

            case ActionType.Process:
                break;

            case ActionType.Url:
                break;

            default:
                throw new ArgumentException("menuInfo's MenuAction is Invalid");
            }
        }
Exemplo n.º 7
0
        private void Initialize(WindowInfo windowInfo)
        {
            this.Name = windowInfo.Name;
            this.Text = windowInfo.Text;

            IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);

            if (tabInfos == null)
            {
                throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name);
            }
            if (tabInfos.Count == 0)
            {
                throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }
            if (tabInfos.Count > 1)
            {
                throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }

            ISearchManager        smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null);
            IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster) as IWindowControlManager;

            IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]);

            cmMaster.Dao = daoParent;

            ((IArchiveGrid)base.MasterGrid).SetControlManager(cmMaster, tabInfos[0].GridName);

            // daoParent's subDao is inserted in detailForm
            if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand)
            {
                ArchiveFormFactory.GenerateDetailGrids(base.MasterGrid as IBoundGridWithDetailGridLoadOnDemand, tabInfos[0]);
            }

            // Load Additional Menus
            IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name);
            IList <WindowMenuInfo> masterWindowMenuInfos;
            IList <WindowMenuInfo> detailWindowMenuInfos;

            GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos);
            if (masterWindowMenuInfos.Count > 0)
            {
                this.GenerateWindowMenu(masterWindowMenuInfos);
            }

            if (windowInfo.GenerateDetailForm)
            {
                if (windowInfo.DetailForm != null)
                {
                    m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm;
                    if (windowInfo.DetailWindow == null)
                    {
                        ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent, null, m_detailForm);
                    }
                }
                // 和主窗体不关联
                else if (windowInfo.DetailWindow != null)
                {
                    WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name);
                    m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm;
                    var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm;
                    if (searchWindow != null)
                    {
                        searchWindow.EnableProgressForm = false;
                    }
                }
                else
                {
                    m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent as IRelationalDao);
                }

                if (m_detailForm != null)
                {
                    //m_detailWindow.ParentArchiveForm = this;
                    // Generate DetailForm's Menu
                    if (detailWindowMenuInfos.Count > 0)
                    {
                        m_detailForm.GenerateWindowMenu(detailWindowMenuInfos);

                        m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged);
                    }
                }
            }

            ArchiveSearchForm searchForm = null;

            this.SetSearchPanel(() =>
            {
                if (searchForm == null)
                {
                    searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]);
                    if (cmMaster != null)
                    {
                        cmMaster.StateControls.Add(searchForm);
                    }
                }
                return(searchForm);
            });

            m_attachmentForm = GeneratedArchiveSeeForm.CreateAttachmentWindow(this, windowInfo);

            GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this);

            m_windowInfo = windowInfo;
        }
        private void Initialize(WindowInfo windowInfo)
        {
            this.Name = windowInfo.Name;
            this.Text = windowInfo.Text;

            IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);

            if (tabInfos == null)
            {
                throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name);
            }
            if (tabInfos.Count == 0)
            {
                throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }
            if (tabInfos.Count > 1)
            {
                throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }

            ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null);

            IDisplayManager dmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(tabInfos[0], smMaster);

            (base.MasterGrid as IBoundGrid).SetDisplayManager(dmMaster, tabInfos[0].GridName);

            if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand)
            {
                ArchiveFormFactory.GenerateDetailGrids((IBoundGridWithDetailGridLoadOnDemand)base.MasterGrid, tabInfos[0]);
            }

            // Load Additional Menus
            IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name);
            IList <WindowMenuInfo> masterWindowMenuInfos;
            IList <WindowMenuInfo> detailWindowMenuInfos;

            GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos);
            if (masterWindowMenuInfos.Count > 0)
            {
                this.GenerateWindowMenu(masterWindowMenuInfos);
            }

            if (windowInfo.GenerateDetailForm)
            {
                // 自定义窗体
                if (windowInfo.DetailForm != null)
                {
                    m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm;
                    if (windowInfo.DetailWindow == null)
                    {
                        ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, null, null, dmMaster, m_detailForm);
                    }
                }
                // 跟主DisplayManager无关的DetailForm
                else if (windowInfo.DetailWindow != null)
                {
                    WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name);
                    m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm;
                    var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm;
                    if (searchWindow != null)
                    {
                        searchWindow.EnableProgressForm = false;
                    }
                }
                else
                {
                    // 当DetailFormId有值的时候,不一定是DetailForm,而只是其中的一部分
                    // 和主表一致的明细窗体
                    m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, dmMaster);
                }
                if (m_detailForm != null)
                {
                    //m_detailWindow.ParentArchiveForm = this;
                    //m_detailWindow = m_detailWindow;

                    // Generate DetailForm's Menu
                    if (detailWindowMenuInfos.Count > 0)
                    {
                        m_detailForm.GenerateWindowMenu(detailWindowMenuInfos);
                        m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged);
                    }
                }
            }

            ArchiveSearchForm searchForm = null;

            this.SetSearchPanel(() =>
            {
                if (searchForm == null)
                {
                    searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]);
                }
                return(searchForm);
            });

            m_attachmentForm = CreateAttachmentWindow(this, windowInfo);

            GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this);

            m_windowInfo = windowInfo;
        }