コード例 #1
0
        /// <summary>
        /// 获取绑定列表
        /// </summary>
        /// <param name="whereParam"></param>
        private void GetBinderList(WhereParam whereParam, ModuleQueryDTO m, IList <ModuleQueryDTO> mList, string userId)
        {
            switch (m.ControlType)
            {
            case (int)QueryConfig.ControlType.ComboTreeBox:
                whereParam.BinderList    = corporationService.FindTreeList();
                whereParam.AllBinderList = new List <string>();
                break;

            case (int)QueryConfig.ControlType.ComboMultipleBox:
            case (int)QueryConfig.ControlType.ComboRadioBox:
                if (!string.IsNullOrEmpty(m.RelationId_1) || !string.IsNullOrEmpty(m.RelationId_2))
                {
                    whereParam.AllBinderList = this.GetComboList(m.DropdownDataSource, m.DownListValue, userId);
                    whereParam.BinderList    = this.GetCurrentBinder(mList, m, whereParam);
                }
                else
                {
                    whereParam.BinderList    = this.GetComboList(m.DropdownDataSource, m.DownListValue, userId);
                    whereParam.AllBinderList = new List <string>();
                }
                break;

            default:
                whereParam.BinderList    = new List <string>();
                whereParam.AllBinderList = new List <string>();
                break;
            }
        }
コード例 #2
0
        protected override Expression VisitConstant(ConstantExpression c)
        {
            if (c == null)
            {
                return(c);
            }
            this.m_arguments.Add(c.Value);
            string wParam = String.Format("wp{0}__{1}", this.m_arguments.Count - 1, LastColumn);

            this.m_conditionParts.Push("@" + wParam);
            WhereParam.Add(wParam);
            return(c);
        }
コード例 #3
0
 /// <summary>
 /// 获取默认值
 /// </summary>
 /// <param name="whereParam"></param>
 /// <param name="m"></param>
 private void GetDefaultValue(WhereParam whereParam, ModuleQueryDTO m)
 {
     if (m.DataType == (int)QueryConfig.DataType.DateTime)
     {
         var dValue = 0;
         Int32.TryParse(m.DefaultValue, out dValue);
         whereParam.Value = this.GetDefaultValue((QueryConfig.DateDefalutValueType)dValue);
     }
     else
     {
         whereParam.Value = m.DefaultValue;
     }
 }
コード例 #4
0
        /// <summary>
        /// 获取OR条件
        /// </summary>
        /// <param name="queryParams"></param>
        /// <returns></returns>
        private Expression GetOrExpression(ParameterExpression nickNameParam, WhereParam queryParam)
        {
            string[]   fieldList   = queryParam.Field.Split('|');
            Expression expConstant = Expression.Constant(false);

            foreach (string field in fieldList)
            {
                if (this.GetProperty(typeof(TEntity), field) != null)
                {
                    expConstant = Expression.OrElse(expConstant, this.GetExpression(field, queryParam.Value, queryParam.Operator, queryParam.DataType.ToString(), nickNameParam));
                }
            }
            return(expConstant);
        }
コード例 #5
0
            public bool AddWhere(WhereParam.WhereLogic logic, string key, string value)
            {
                foreach (WhereParam item in array)
                {
                    if (item.Key == key)
                    {
                        return(false);
                    }
                }
                WhereParam p = new WhereParam();

                p.Logic = logic;
                p.Key   = key;
                p.Value = value;
                array.Add(p);
                return(true);
            }
コード例 #6
0
        /// <summary>
        /// 获取下拉列表当前绑定数据
        /// 如果关联字段有默认值则重新获取绑定值
        /// </summary>
        /// <param name="mList"></param>
        /// <param name="m"></param>
        /// <param name="whereParam"></param>
        /// <returns></returns>
        private object GetCurrentBinder(IList <ModuleQueryDTO> mList, ModuleQueryDTO m, WhereParam whereParam)
        {
            var returnList = new List <SelectDTO>();

            if (!string.IsNullOrEmpty(m.RelationId_1) && string.IsNullOrEmpty(m.RelationId_2))
            {
                var mqModel = mList.Where(g => g.ParamName == m.RelationId_1).FirstOrDefault();
                if (mqModel != null && !string.IsNullOrEmpty(mqModel.DefaultValue))
                {
                    returnList = ((List <SelectDTO>)whereParam.AllBinderList).Where(g => g.RelationId_1 == mqModel.DefaultValue).ToList();
                }
            }
            else if (!string.IsNullOrEmpty(m.RelationId_1) && !string.IsNullOrEmpty(m.RelationId_2))
            {
                var mqModel1 = mList.Where(g => g.ParamName == m.RelationId_1).FirstOrDefault();
                var mqModel2 = mList.Where(g => g.ParamName == m.RelationId_2).FirstOrDefault();
                if (mqModel1 != null && !string.IsNullOrEmpty(mqModel1.DefaultValue) && mqModel2 != null && !string.IsNullOrEmpty(mqModel2.DefaultValue))
                {
                    returnList = ((List <SelectDTO>)whereParam.AllBinderList).Where(g => g.RelationId_1 == mqModel1.DefaultValue && g.RelationId_2 == mqModel2.DefaultValue).ToList();
                }
            }
            return(returnList);
        }
コード例 #7
0
 public bool AddWhere(WhereParam.WhereLogic logic, string key, string value)
 {
     foreach (WhereParam item in array)
         if (item.Key == key) return false;
     WhereParam p = new WhereParam();
     p.Logic = logic;
     p.Key = key;
     p.Value = value;
     array.Add(p);
     return true;
 }