Example #1
0
        public static void 生成凭证(ArchiveOperationForm masterForm)
        {
            IList <费用> list = GetSelectedFee4Pz(masterForm);

            if (list.Count == 0)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择未出对帐单和凭证的费用!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否要生成选中项相应的凭证?", "确认"))
            {
                return;
            }

            ArchiveOperationForm masterFormKj = ServiceProvider.GetService <IApplication>().ExecuteAction("资金票据_凭证") as ArchiveOperationForm;

            if (masterFormKj != null)
            {
                if (masterFormKj.DoAdd())
                {
                    ArchiveDetailForm detailFormKj = masterFormKj.ArchiveDetailForm as ArchiveDetailForm;

                    IControlManager <凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailFormKj).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>;
                    IRelationalDao           masterDao  = masterFormKj.ControlManager.Dao as IRelationalDao;
                    MemoryDao <凭证费用明细>       memoryBll  = (masterDao.GetRelationalDao(0) as IMemoriedRelationalDao).DetailMemoryDao as MemoryDao <凭证费用明细>;
                    //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMemoriedMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

                    (masterFormKj.DisplayManager.CurrentItem as 凭证).凭证类别 = 凭证类别.付款凭证;
                    detailFormKj.UpdateContent();

                    process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj);
                }
            }
        }
        /// <summary>
        /// 生成子Dao(继续生成subsubDao)
        /// </summary>
        /// <param name="daoParent"></param>
        /// <param name="tabInfo"></param>
        public static void GenerateBusinessLayer(IRelationalDao daoParent, WindowTabInfo tabInfo)
        {
            if (string.IsNullOrEmpty(tabInfo.BusinessLayerClassName))
            {
                throw new ArgumentException("WindowTabInfo of " + tabInfo.Name + " 's BusinessLayerClassName must not be null!");
            }

            if (!string.IsNullOrEmpty(tabInfo.BusinessLayerClassParams))
            {
                IRelationalDao subDao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(tabInfo.BusinessLayerClassParams) as IRelationalDao;

                IEventDao subRelationDao = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.BusinessLayerClassName), subDao) as IEventDao;
                daoParent.AddRelationalDao(subRelationDao);

                foreach (WindowTabInfo childTab in tabInfo.ChildTabs)
                {
                    GenerateBusinessLayer(subDao, childTab);
                }
            }
            else
            {
                IEventDao subDao = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.BusinessLayerClassName)) as IEventDao;
                daoParent.AddRelationalDao(subDao);

                foreach (WindowTabInfo childTab in tabInfo.ChildTabs)
                {
                    GenerateBusinessLayer(subDao, childTab);
                }
            }
        }
        /// <summary>
        /// 生成子Dao(继续生成subsubDao)
        /// </summary>
        /// <param name="daoParent"></param>
        /// <param name="tabInfo"></param>
        public static void GenerateBusinessLayer(IRelationalDao daoParent, WindowTabInfo tabInfo)
        {
            if (string.IsNullOrEmpty(tabInfo.BusinessLayerClassName))
            {
                throw new ArgumentException("WindowTabInfo of " + tabInfo.Name + " 's BusinessLayerClassName must not be null!");
            }

            if (!string.IsNullOrEmpty(tabInfo.BusinessLayerClassParams))
            {
                IRelationalDao subDao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(tabInfo.BusinessLayerClassParams) as IRelationalDao;

                IEventDao subRelationDao = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.BusinessLayerClassName), subDao) as IEventDao;
                daoParent.AddRelationalDao(subRelationDao);

                foreach (WindowTabInfo childTab in tabInfo.ChildTabs)
                {
                    GenerateBusinessLayer(subDao, childTab);
                }
            }
            else
            {
                IEventDao subDao = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.BusinessLayerClassName)) as IEventDao;
                daoParent.AddRelationalDao(subDao);

                foreach (WindowTabInfo childTab in tabInfo.ChildTabs)
                {
                    GenerateBusinessLayer(subDao, childTab);
                }
            }
        }
Example #4
0
 public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IRelationalDao daoParent)
 {
     return(GenerateArchiveDetailForm(windowInfo, cmParent, daoParent, null));
 }
        public static IArchiveGrid AssociateArchiveDetailGrid(Control container, string windowTabName, IControlManager cmParent, IRelationalDao daoParent)
        {
            WindowTabInfo windowTabInfo = ADInfoBll.Instance.GetWindowTabInfo(windowTabName);
            if (windowTabName == null)
                return null;

            GeneratedArchiveUnboundGrid grid = new GeneratedArchiveUnboundGrid(windowTabInfo, cmParent);

            IWindowControlManager subCm = grid.ControlManager as IWindowControlManager;
            //ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent.DisplayManager);
            //IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(windowTabInfo, subSm) as IWindowControlManager;
            //subCm.Name = windowTabInfo.Name;
            //grid.SetControlManager(subCm, windowTabInfo.GridName);
            //ManagerFactory.GenerateBusinessLayer(daoParent, windowTabInfo);

            int i = 0;
            IBaseDao subDao = daoParent.GetRelationalDao(i);
            if (subDao is IMemoriedRelationalDao)
            {
                IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).DetailMemoryDao;
                subCm.Dao = subMemoryDao;

                //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent));
                ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager);
            }
            else
            {
                subCm.Dao = subDao;
            }

            AddControl(container, grid);
            grid.LoadLayout();

            grid.IsInDetailMode = true;
            cmParent.StateControls.Add(grid);
            cmParent.CheckControls.Add(grid);

            return grid;
        }
 public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IRelationalDao daoParent)
 {
     return GenerateArchiveDetailForm(windowInfo, cmParent, daoParent, null);
 }
Example #7
0
        public static IArchiveGrid AssociateArchiveDetailGrid(Control container, string windowTabName, IControlManager cmParent, IRelationalDao daoParent)
        {
            WindowTabInfo windowTabInfo = ADInfoBll.Instance.GetWindowTabInfo(windowTabName);

            if (windowTabName == null)
            {
                return(null);
            }

            GeneratedArchiveUnboundGrid grid = new GeneratedArchiveUnboundGrid(windowTabInfo, cmParent);

            IWindowControlManager subCm = grid.ControlManager as IWindowControlManager;
            //ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent.DisplayManager);
            //IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(windowTabInfo, subSm) as IWindowControlManager;
            //subCm.Name = windowTabInfo.Name;
            //grid.SetControlManager(subCm, windowTabInfo.GridName);
            //ManagerFactory.GenerateBusinessLayer(daoParent, windowTabInfo);

            int      i      = 0;
            IBaseDao subDao = daoParent.GetRelationalDao(i);

            if (subDao is IMemoriedRelationalDao)
            {
                IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).DetailMemoryDao;
                subCm.Dao = subMemoryDao;

                //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent));
                ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager);
            }
            else
            {
                subCm.Dao = subDao;
            }

            AddControl(container, grid);
            grid.LoadLayout();

            grid.IsInDetailMode = true;
            cmParent.StateControls.Add(grid);
            cmParent.CheckControls.Add(grid);

            return(grid);
        }