Esempio n. 1
0
        /// <summary>
        /// 从取值对象中获得属性,从条件对象中获得值
        /// </summary>
        /// <param name="valObj"></param>
        /// <param name="condObj"></param>
        /// <returns></returns>
        public List <DataBaseField> Parse(ITableImplement valObj, ITableImplement condObj)
        {
            List <DataBaseField> list2 = new List <DataBaseField>();
            List <AttributeItem> list  = new List <AttributeItem>();

            list.AddRange(valObj.af_GetAvailableAttributeItem());
            if (list.Count == 0)
            {
                list.AddRange(valObj.af_AttributeItemList);
            }

            string tbName = valObj._TableName.ToLower();

            if (tbName == ITableImplement.defaultTableName.ToLower())
            {
                tbName = list[0].TableName;
            }
            #region 表操作
            DataBaseTable dt1 = null;
            dt1 = Runtime_PersistenceLayer.Factory(conn).DataBase.DataTables[tbName];
            if (dt1 == null)
            {
                ConsoleService.Warn(tbName + " 数据表不存在");
                return(new List <DataBaseField>());
            }
            #endregion

            foreach (AttributeItem item in list)
            {
                string fieldName = item.FieldName.ToLower();
                #region 列操作
                DataBaseField f1 = null;
                if (!dt1.DataFields.TryGetValue(fieldName, out f1))
                {
                    ConsoleService.Warn(string.Format("数据表{0},数据字段{1}不存在", tbName, fieldName));
                    continue;
                }
                if (f1.Desc.CtrlType == BaseCtrlType.Text || f1.Desc.CtrlType == BaseCtrlType.HTML ||
                    f1.Desc.CtrlType == BaseCtrlType.SmallText)
                {
                    continue;
                }
                if (condObj != null && condObj.IsNotNull())
                {
                    f1.Value = condObj.GetString(item);
                }
                #endregion
                list2.Add(f1);
            }
            return(list2);
        }
Esempio n. 2
0
        /// <summary>
        /// 从取值对象中获得属性,从条件对象中获得值
        /// </summary>
        /// <param name="valObj"></param>
        /// <param name="condObj"></param>
        /// <returns></returns>
        public List<DataBaseField> Parse(ITableImplement valObj, ITableImplement condObj)
        {
            List<DataBaseField> list2 = new List<DataBaseField>();
            List<AttributeItem> list = new List<AttributeItem>();
            list.AddRange(valObj.af_GetAvailableAttributeItem());
            if (list.Count == 0)
                list.AddRange(valObj.af_AttributeItemList);

            string tbName = valObj._TableName.ToLower();
            if (tbName == ITableImplement.defaultTableName.ToLower())
                tbName = list[0].TableName;
            #region 表操作
            DataBaseTable dt1 = null;
            dt1 = Runtime_PersistenceLayer.Factory(conn).DataBase.DataTables[tbName];
            if (dt1 == null)
            {
                ConsoleService.Warn(tbName + " 数据表不存在");
                return new List<DataBaseField>();
            }
            #endregion

            foreach (AttributeItem item in list)
            {
                string fieldName = item.FieldName.ToLower();
                #region 列操作
                DataBaseField f1 = null;
                if (!dt1.DataFields.TryGetValue(fieldName, out f1))
                {
                    ConsoleService.Warn(string.Format("数据表{0},数据字段{1}不存在", tbName, fieldName));
                    continue;
                }
                if (f1.Desc.CtrlType == BaseCtrlType.Text || f1.Desc.CtrlType == BaseCtrlType.HTML
                     || f1.Desc.CtrlType == BaseCtrlType.SmallText)
                    continue;
                if (condObj != null && condObj.IsNotNull())
                    f1.Value = condObj.GetString(item);
                #endregion
                list2.Add(f1);
            }
            return list2;
        }