public IEnumerable <CustomParam> GetCPByInstance(string entity, string key, string attrentity, string cpSource, string cpTarget)
        {
            const string pkg = PkgName + ".getCPByInstance";

            return(RunManualDbOperation(db =>
            {
                var ps = db.GetSpParameters(pkg, false, false);
                ps[0].Value = entity;
                ps[1].Value = key;
                ps[2].Value = attrentity;
                ps[3].Value = cpSource;
                ps[4].Value = cpTarget;
                // INFO: не знаю почему, но так не работает
                //var ps = new[]
                //{
                //    new OracleParameter("PENTITY", OracleDbType.Varchar2, entity, ParameterDirection.Input){DbType = DbType.String},
                //    new OracleParameter("PKEY ", OracleDbType.Varchar2, key, ParameterDirection.Input){DbType = DbType.String},
                //    new OracleParameter("PATTRENTITY", OracleDbType.XmlType, null, ParameterDirection.Input){DbType = DbType.String}
                //};

                var stm = string.Format("select SYS.XMLTYPE.GETCLOBVAL(COLUMN_VALUE) from TABLE({0}(:pEntity, :pKey, :pAttrEntity, :pCPSource, :pCPTarget))", pkg);
                var resXml = db.SetCommand(stm, ps).ExecuteScalarList <XmlDocument>();
                return XmlDocumentConverter.ConvertToListOf <CustomParam>(resXml);
            }));
        }
 public IEnumerable <User> GetAllFromActiveDirectory()
 {
     return(RunManualDbOperation(db =>
     {
         var sql = "select SYS.XMLTYPE.GETCLOBVAL(COLUMN_VALUE) from TABLE(pkgUser.GetFromADUserLst(NULL, NULL))";
         var resXml = db.SetCommand(sql).ExecuteScalarList <XmlDocument>();
         return XmlDocumentConverter.ConvertToListOf <User>(resXml);
     }));
 }
Exemple #3
0
        public IEnumerable <Output> GetEpsOutputLst(int recCount, int epsHandler)
        {
            return(RunManualDbOperation(db =>
            {
                var pRecCount = db.InputParameter("pRecCount", recCount);
                var pEpsHandler = db.InputParameter("pEpsHandler", epsHandler);

                var stm = string.Format("select * FROM TABLE(PKGOUTPUT.getOutputLst2EPS(:{0}, :{1}))", pRecCount.ParameterName, pEpsHandler.ParameterName);
                var resXml = db.SetCommand(stm, pRecCount, pEpsHandler).ExecuteScalarList <XmlDocument>();
                return XmlDocumentConverter.ConvertToListOf <Output>(resXml);
            }));
        }
        public virtual IEnumerable <HistoryWrapper <T> > GetHistory(string filter, string attrentity)
        {
            var packageName  = GetPakageName(typeof(T));
            var sourceName   = SourceNameHelper.Instance.GetSourceName(typeof(T));
            var functionName = string.Format(GetHistoryLstFunctionName, packageName, sourceName);

            var attrXml = !string.IsNullOrEmpty(attrentity)
                ? XmlDocumentConverter.XmlDocFromString(attrentity)
                : null;

            var resXml = XmlGetList(attrXml, filter, functionName);

            return(XmlDocumentConverter.ConvertToListOf <HistoryWrapper <T> >(resXml));
        }
Exemple #5
0
        public virtual List <T> GetFiltered(string filter, string attrentity)
        {
            ClearStatistics();

            // если фильтр - это процедура
            if (!string.IsNullOrEmpty(filter) && filter.StartsWith("pkg"))
            {
                return(GetListTFromFunction(filter));
            }

            var xmlDocuments = GetXmlFiltered(filter, attrentity);

            if (xmlDocuments == null)
            {
                return(null);
            }

            return(XmlDocumentConverter.ConvertToListOf <T>(xmlDocuments));
        }
        private List <PMConfig> GetPMConfigByParamList(decimal?[] productIdList, string[] artCodeList, string operationCode, string methodName)
        {
            if ((productIdList == null || productIdList.Length == 0) && (artCodeList == null || artCodeList.Length == 0))
            {
                throw new DeveloperException("Parameters productIdList[] and artCodeList[] can't be empty at the same time");
            }

            if ((productIdList != null && productIdList.Length > 0) && (artCodeList != null && artCodeList.Length > 0))
            {
                throw new DeveloperException("Parameters productIdList[] and artCodeList[] can't be not empty at the same time");
            }

            var byProduct = productIdList != null && productIdList.Length > 0;
            var count     = byProduct ? productIdList.Length : artCodeList.Length;

            var result = new List <PMConfig>();

            //function getPMConfigByParamLst (pProductID in INTEGER,pArtCode in VARCHAR2,pOperationCode in VARCHAR2,pMMethodCode in VARCHAR2,pAttrEntity in XMLType default NULL,pFilter in VARCHAR2 default NULL) return TListXml pipelined as
            return(RunManualDbOperation(db =>
            {
                var ps = db.GetSpParameters(GetPMConfigByParamListFunctionName, false, false);

                for (int i = 0; i < count; i++)
                {
                    ps[0].Value = byProduct ? productIdList[i] : null;
                    ps[1].Value = byProduct ? null : artCodeList[i];
                    ps[2].Value = operationCode;
                    ps[3].Value = methodName;

                    var stm = string.Format("select SYS.XMLTYPE.GETCLOBVAL(COLUMN_VALUE) from TABLE({0}(:pproductid, :partcode, :poperationcode, :pmmethodcode, :pattrentity, :pfilter))",
                                            GetPMConfigByParamListFunctionName);
                    var resXml = db.SetCommand(stm, ps).ExecuteScalarList <XmlDocument>();

                    result.AddRange(XmlDocumentConverter.ConvertToListOf <PMConfig>(resXml));
                }
                return result;
            }));
        }
        public virtual List <T> GetFiltered(string filter, string attrentity)
        {
            var xmlItems = GetXmlFiltered(filter, attrentity);

            return(XmlDocumentConverter.ConvertToListOf <T>(xmlItems));
        }
        public virtual List <T> GetAll(string attrentity = null)
        {
            var xmlItems = GetXmlFiltered(null, attrentity);

            return(XmlDocumentConverter.ConvertToListOf <T>(xmlItems));
        }