Пример #1
0
        private string GetExtenalConditions(UConditionGridControl gridControl)
        {
            List <string> CascadingConditional = new List <string>();

            try
            {
                foreach (DataRow rowItem in ((ListModelSettings)gridControl.Tag).ExtenalConditions.Tables[DictSet.TableName].Rows.OfType <DataRow>().Where(cm => new ExtenalConditionItem(cm).FilterConditionFlag&& new ExtenalConditionItem(cm).HostForm.Action.EndsWith(GetFullName())))
                {
                    ExtenalConditionItem condition = new ExtenalConditionItem(rowItem);
                    switch (condition.TagValue)
                    {
                    case "代理商列表.当前代理商编号":
                        object curAgentCode = this.GetItem(condition.TagValue);
                        if (curAgentCode != null)
                        {
                            CascadingConditional.Add(ListModelSettings.GetConditionalStr(condition, curAgentCode));
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GetControl().WriteError(string.Format("执行方法:{0};错误描述:{1}。", GetFullName(), ex.ToString()));
                CascadingConditional.Add("1=2");
            }

            return(string.Join(" AND ", CascadingConditional));
        }
Пример #2
0
        private void InitControls(string dictSeed, UConditionGridControl gridControl)
        {
            // 从程序的缓存中找到是否已经载入当前TableAttributes信息;如果没找到则从数据库中获取并更新到程序缓存中
            DataSet dsAttributes = PickParam(GetControl().GetContext().MyInfo).GetValueAsDataSet(dictSeed);

            if (dsAttributes == null)
            {
                dsAttributes = AEntryDic.Pick(GetControl()).GetDic(dictSeed);
                PickParam(GetControl().GetContext().MyInfo).SetParam(dictSeed, dsAttributes);
            }

            ListModelSettings ListViewModel = new ListModelSettings(dsAttributes);

            // 得到ICON资源
            AssemblyLoader  assemblyLoader  = GetControl().GetContext().GetAssemblyLoader(ListViewModel.IconResource);
            ResourceManager resourceManager = null;

            if (assemblyLoader != null)
            {
                resourceManager = assemblyLoader.GetInstance <ResourceManager>("Properties.Resources");
            }

            // 配置工具栏和列表控件、条件区域
            gridControl.Tag = ListViewModel;
            gridControl.InitVars(ListViewModel, resourceManager);
            gridControl.SetCurrentProfile(ListViewModel.ListProfile1);
            gridControl.Init();
        }