Пример #1
0
        // 是否全部订购信息片断中的馆藏地点都在当前用户管辖之下?
        // 那些没有名字的(馆藏地点)分配事项,算在分馆用户的管辖范围以外。没有名字的馆藏地点,在订购时视为地点未定
        // return:
        //      -1  出错
        //      0   不是全部都在管辖范围内
        //      1   都在管辖范围内
        int IsAllOrderControlled(XmlNode nodeOrderInfo,
            string strLibraryCodeList,
            out string strError)
        {
            strError = "";

            if (SessionInfo.IsGlobalUser(strLibraryCodeList) == true)
                return 1;

            // 对新提交的记录中的每个订购片断进行循环
            XmlNodeList nodes = nodeOrderInfo.SelectNodes("*");
            foreach (XmlNode node in nodes)
            {
                string strDistribute = DomUtil.GetElementText(node, "distribute");
                if (string.IsNullOrEmpty(strDistribute) == true)
                    continue;

                // 观察一个馆藏分配字符串,看看是否在当前用户管辖范围内
                // return:
                //      -1  出错
                //      0   超过管辖范围。strError中有解释
                //      1   在管辖范围内
                int nRet = DistributeInControlled(strDistribute,
            strLibraryCodeList,
            out strError);
                if (nRet == -1)
                    return -1;
                if (nRet == 0)
                    return 0;
#if NO
                LocationCollcetion locations = new LocationCollcetion();
                int nRet = locations.Build(strDistribute, out strError);
                if (nRet == -1)
                {
                    strError = "馆藏分配字符串 '" + strDistribute + "' 格式不正确";
                    return -1;
                }

                foreach (Location location in locations)
                {
                    if (string.IsNullOrEmpty(location.Name) == true)
                        continue;

                    string strLibraryCode = "";
                    string strPureName = "";

                    // 解析
                    LibraryApplication.ParseCalendarName(location.Name,
                out strLibraryCode,
                out strPureName);

                    if (StringUtil.IsInList(strLibraryCode, strLibraryCodeList) == false)
                    {
                        strError = "馆代码 '" + strLibraryCode + "' 不在范围 '" + strLibraryCodeList + "' 内";
                        return 0;
                    }
                }
#endif


            }

            return 1;
        }
Пример #2
0
        // 是否全部订购信息片断中的馆藏地点都在当前用户管辖之下?
        // 那些没有名字的(馆藏地点)分配事项,算在分馆用户的管辖范围以外。没有名字的馆藏地点,在订购时视为地点未定
        // return:
        //      -1  出错
        //      0   不是全部都在管辖范围内
        //      1   都在管辖范围内
        int IsAllOrderControlled(XmlNode nodeOrderInfo,
                                 string strLibraryCodeList,
                                 out string strError)
        {
            strError = "";

            if (SessionInfo.IsGlobalUser(strLibraryCodeList) == true)
            {
                return(1);
            }

            // 对新提交的记录中的每个订购片断进行循环
            XmlNodeList nodes = nodeOrderInfo.SelectNodes("*");

            foreach (XmlNode node in nodes)
            {
                string strDistribute = DomUtil.GetElementText(node, "distribute");
                if (string.IsNullOrEmpty(strDistribute) == true)
                {
                    continue;
                }

                // 观察一个馆藏分配字符串,看看是否在当前用户管辖范围内
                // return:
                //      -1  出错
                //      0   超过管辖范围。strError中有解释
                //      1   在管辖范围内
                int nRet = DistributeInControlled(strDistribute,
                                                  strLibraryCodeList,
                                                  out strError);
                if (nRet == -1)
                {
                    return(-1);
                }
                if (nRet == 0)
                {
                    return(0);
                }
#if NO
                LocationCollcetion locations = new LocationCollcetion();
                int nRet = locations.Build(strDistribute, out strError);
                if (nRet == -1)
                {
                    strError = "馆藏分配字符串 '" + strDistribute + "' 格式不正确";
                    return(-1);
                }

                foreach (Location location in locations)
                {
                    if (string.IsNullOrEmpty(location.Name) == true)
                    {
                        continue;
                    }

                    string strLibraryCode = "";
                    string strPureName    = "";

                    // 解析
                    LibraryApplication.ParseCalendarName(location.Name,
                                                         out strLibraryCode,
                                                         out strPureName);

                    if (StringUtil.IsInList(strLibraryCode, strLibraryCodeList) == false)
                    {
                        strError = "馆代码 '" + strLibraryCode + "' 不在范围 '" + strLibraryCodeList + "' 内";
                        return(0);
                    }
                }
#endif
            }

            return(1);
        }