コード例 #1
0
 /// <summary>
 /// 提取值
 /// </summary>
 /// <param name="dic"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 private CommandSetting GetCommandValue(List <CommandSetting> dic, string key)
 {
     if (dic != null && dic.Count > 0)
     {
         CommandSetting command = null;
         //默认取第一个
         if (string.IsNullOrWhiteSpace(key))
         {
             command = dic[0];
         }
         else
         {
             foreach (var cs in dic)
             {
                 if (cs.Key.Equals(key, StringComparison.OrdinalIgnoreCase))
                 {
                     command = cs;
                     break;
                 }
             }
         }
         //处理操作的字段,把属性转为数据库字段
         if (command != null)
         {
             //如果没有初始化
             //初始化字段
             if (command.FieldCollection == null)
             {
                 command.FieldCollection = TurnFieldToDataField(command.Fields);
             }
             //初始化条件字段
             if (command.WhereCollection == null)
             {
                 command.WhereCollection = TurnFieldToDataField(command.Where);
             }
         }
         return(command);
     }
     return(null);
 }
コード例 #2
0
        /// <summary>
        /// 读取操作配置,
        /// 新增,修改,删除等操作配置
        /// </summary>
        /// <param name="xn">配置xml</param>
        /// <returns></returns>
        private List <CommandSetting> GetCommandFromNode(XmlNode xn)
        {
            var          result   = new List <CommandSetting>();
            const string FieldKey = "{0}/Fields";
            const string WhereKey = "{0}/Where";

            if (xn.ChildNodes != null)
            {
                foreach (XmlNode uxn in xn.ChildNodes)
                {
                    if (uxn.NodeType != XmlNodeType.Element)
                    {
                        continue;
                    }
                    var command = new CommandSetting();
                    command.Key    = uxn.Name;
                    command.Fields = IO.XmlHelper.ReadAttributeValue(uxn, string.Format(FieldKey, uxn.Name)); //读取字段
                    command.Where  = IO.XmlHelper.ReadAttributeValue(uxn, string.Format(WhereKey, uxn.Name)); //读取条件
                    result.Add(command);
                }
            }
            return(result);
        }
コード例 #3
0
 /// <summary>
 /// 读取操作配置,
 /// 新增,修改,删除等操作配置
 /// </summary>
 /// <param name="xn">配置xml</param>
 /// <returns></returns>
 private List<CommandSetting> GetCommandFromNode(XmlNode xn)
 {
     var result = new List<CommandSetting>();
     const string FieldKey = "{0}/Fields";
     const string WhereKey = "{0}/Where";
     if (xn.ChildNodes != null)
     {
         foreach (XmlNode uxn in xn.ChildNodes)
         {
             if (uxn.NodeType != XmlNodeType.Element) continue;
             var command = new CommandSetting();
             command.Key = uxn.Name;
             command.Fields = IO.XmlHelper.ReadAttributeValue(uxn, string.Format(FieldKey, uxn.Name));//读取字段
             command.Where = IO.XmlHelper.ReadAttributeValue(uxn, string.Format(WhereKey, uxn.Name));//读取条件
             result.Add(command);
         }
     }
     return result;
 }