예제 #1
0
파일: UnionCatalog.cs 프로젝트: zszqwe/dp2
        // parameters:
        //      strAction   动作。为"new" "change" "delete" "onlydeletebiblio"之一。"delete"在删除书目记录的同时,会自动删除下属的实体记录。不过要求实体均未被借出才能删除。
        // return:
        //      -2  登录不成功
        //      -1  出错
        //      0   成功
        public static int UpdateRecord(
            DigitalPlatform.Stop stop,
            string strUrl,
            string strAuthString,
            string strAction,
            string strRecPath,
            string strFormat,
            string strRecord,
            string strTimestamp,
            out string strOutputRecPath,
            out string strOutputTimestamp,
            out string strError)
        {
            strError           = "";
            strOutputRecPath   = "";
            strOutputTimestamp = "";

            EndpointAddress           address = new EndpointAddress(strUrl);
            UnionCatalogServiceClient client  = new UnionCatalogServiceClient(CreateBasicHttpBinding0(), address);

            try
            {
                IAsyncResult soapresult = client.BeginUpdateRecord(
                    strAuthString,
                    strAction,
                    strRecPath,
                    strFormat,
                    strRecord,
                    strTimestamp,
                    null,
                    null);
                for (; ;)
                {
                    bool bRet = DoIdle(stop); // 出让控制权,避免CPU资源耗费过度
                    if (bRet == true)
                    {
                        strError = "用户中断";
                        return(-1);
                    }

                    if (soapresult.IsCompleted)
                    {
                        break;
                    }
                }

                return(client.EndUpdateRecord(
                           out strOutputRecPath,
                           out strOutputTimestamp,
                           out strError,
                           soapresult));
            }
            catch (Exception ex)
            {
                strError = ConvertWebError(ex, strUrl);
                return(-1);
            }
        }
예제 #2
0
        // parameters:
        //      strAction   动作。为"new" "change" "delete" "onlydeletebiblio"之一。"delete"在删除书目记录的同时,会自动删除下属的实体记录。不过要求实体均未被借出才能删除。
        // return:
        //      -2  登录不成功
        //      -1  出错
        //      0   成功
        public static int UpdateRecord(
            DigitalPlatform.Stop stop,
            string strUrl,
            string strAuthString,
            string strAction,
            string strRecPath,
            string strFormat,
            string strRecord,
            string strTimestamp,
            out string strOutputRecPath,
            out string strOutputTimestamp,
            out string strError)
        {
            strError = "";
            strOutputRecPath = "";
            strOutputTimestamp = "";

            EndpointAddress address = new EndpointAddress(strUrl);
            UnionCatalogServiceClient client = new UnionCatalogServiceClient(CreateBasicHttpBinding0(), address);

            try
            {
                IAsyncResult soapresult = client.BeginUpdateRecord(
                    strAuthString,
                    strAction,
                    strRecPath,
                    strFormat,
                    strRecord,
                    strTimestamp,
                    null,
                    null);
                for (; ; )
                {
                    bool bRet = DoIdle(stop); // 出让控制权,避免CPU资源耗费过度
                    if (bRet == true)
                    {
                        strError = "用户中断";
                        return -1;
                    }

                    if (soapresult.IsCompleted)
                        break;
                }

                return client.EndUpdateRecord(
                    out strOutputRecPath,
                    out strOutputTimestamp,
                    out strError,
                    soapresult);
            }
            catch (Exception ex)
            {
                strError = ConvertWebError(ex, strUrl);
                return -1;
            }
        }