コード例 #1
0
        public DataParam GetParamByName(string name)
        {
            DataParam param = null;

            foreach (DataParam prm in _params.Values)
            {
                if (prm.Name.Trim() == name.Trim())
                {
                    return(prm);
                }
            }

            return(param);
        }
コード例 #2
0
        //<param name="" type="0" IsOutput="0"/>
        public static DataParam GetparamFromXmlNode(XmlNode node)
        {
            DataParam res = new DataParam();

            res.Name = node.Attributes["name"].Value;
            int type = Convert.ToInt16(node.Attributes["type"].Value);

            res.Type = (CustomSqlTypes)type;
            int a = Convert.ToInt32(node.Attributes["direction"].Value);

            res.Direction = (ParamDirection)a;
            res.Default   = node.Attributes["default"].Value;
            return(res);
        }
コード例 #3
0
        public void AddParam(DataParam param)
        {
            if (_hasReturnParam && param.Direction == ParamDirection.Return)
            {
                throw new ReturnValueUniqueException();
            }

            if (!_hasReturnParam && param.Direction == ParamDirection.Return)
            {
                _hasReturnParam = true;
            }

            if (param.Direction == ParamDirection.Output)
            {
                _outputParams.Add(param.Name, param);
            }

            _params.Add(param.Name, param);
        }
コード例 #4
0
        /*
         * <item name="" schema=""  constr="">
         * <param name="" type="0" IsOutput="0"/>
         * </item>*/
        public void ReadParamsFromXml(XmlNode xmlItem)
        {
            if (xmlItem != null && xmlItem.Name == "item")
            {
                _params.Clear();
                Name = xmlItem.Attributes["name"].Value;
                //  Value = xmlItem.Attributes["value"].Value;
                Schema           = xmlItem.Attributes["schema"].Value;
                ConnectionString = xmlItem.Attributes["constr"].Value;

                if (xmlItem.HasChildNodes)
                {
                    foreach (XmlNode node in xmlItem.ChildNodes)
                    {
                        DataParam prm = new DataParam();
                        prm = DataParam.GetparamFromXmlNode(node);
                        prm.SetParent(this);

                        AddParam(prm);
                    }
                }
            }
        }