示例#1
0
        /// <summary>
        /// 添加模板
        /// </summary>
        public void add()
        {
            TemplateAddRequest templateAddRequest = new TemplateAddRequest();

            templateAddRequest.file_id = "b5b1bcc77e74a5dc54a32215c25ea22d";
            templateAddRequest.name    = "劳动合同模板";

            try
            {
                TemplateAddResponse response = client.Template.add(templateAddRequest);
                Console.WriteLine("添加模板-响应数据:" + JSONUtil.getJsonStringFromObject(response));
            }
            catch (SignApplicationException sae)
            {
                // 捕获网关校验数据
                Console.WriteLine("添加模板-网关异常状态码为:" + sae.return_code);
                Console.WriteLine("添加模板-网关异常信息为:" + sae.return_message);
            }
            catch (SignServerException sse)
            {
                // 捕获网关校验数据
                Console.WriteLine("添加模板-业务异常状态码为:" + sse.result_code);
                Console.WriteLine("添加模板-业务异常信息为:" + sse.result_message);
            }
        }
示例#2
0
        /// <summary>
        /// 模板添加接口
        /// </summary>
        /// <param name="sealAddRequest"></param>
        /// <returns></returns>
        public TemplateAddResponse add(TemplateAddRequest templateAddRequest)
        {
            SignRequest signRequest = new SignRequest(templateAddRequest);

            signRequest.apiUrl = ApiUrlConstant.Template.Add;
            TemplateAddResponse response = this.Send <TemplateAddResponse>(signRequest);

            return(response);
        }
示例#3
0
        /// <summary>
        /// 模板添加并上传模板文件接口
        /// </summary>
        /// <param name="templateFileAddRequest"></param>
        /// <returns></returns>
        public TemplateAddResponse addTemplateAndFile(TemplateFileAddRequest templateFileAddRequest)
        {
            //上传合同文件
            FileUploadRequest fileUploadRequest = templateFileAddRequest.fileUploadRequest;

            fileUploadRequest.fileType = FileType.template;
            FileUploadResponse fileUploadResponse = base.fileUpload(fileUploadRequest);
            //添加模板
            TemplateAddRequest templateAddRequest = templateFileAddRequest.templateAddRequest;

            templateAddRequest.file_id = fileUploadResponse.file_id;
            SignRequest signRequest = new SignRequest(templateAddRequest);

            signRequest.apiUrl = ApiUrlConstant.Template.Add;
            TemplateAddResponse response = this.Send <TemplateAddResponse>(signRequest);

            return(response);
        }
示例#4
0
        /// <summary>
        /// 添加模板以及文件
        /// </summary>
        public void addTemplateAndFile()
        {
            // 创建模板以及文件
            TemplateFileAddRequest templateFileAddRequest = new TemplateFileAddRequest();

            // 模板请求数据
            TemplateAddRequest templateAddRequest = new TemplateAddRequest();

            templateAddRequest.name = "我的模板";
            templateFileAddRequest.templateAddRequest = templateAddRequest;

            try
            {
                //模板文件上传
                FileUploadRequest fileUploadRequest = new FileUploadRequest("D://telmplate//劳动合同模板.pdf", "劳动合同模板.pdf", FileType.template, "00765245060136194048");
                templateFileAddRequest.fileUploadRequest = fileUploadRequest;

                TemplateAddResponse response = client.Template.addTemplateAndFile(templateFileAddRequest);
                Console.WriteLine("添加模板以及文件-响应数据:" + JSONUtil.getJsonStringFromObject(response));
            }
            catch (SignApplicationException sae)
            {
                // 捕获网关校验数据
                Console.WriteLine("添加模板以及文件-网关异常状态码为:" + sae.return_code);
                Console.WriteLine("添加模板以及文件-网关异常信息为:" + sae.return_message);
            }
            catch (SignServerException sse)
            {
                // 捕获网关校验数据
                Console.WriteLine("添加模板以及文件-业务异常状态码为:" + sse.result_code);
                Console.WriteLine("添加模板以及文件-业务异常信息为:" + sse.result_message);
            }
            catch (Exception e)
            {
                Console.WriteLine("添加模板以及文件-异常为:" + e.Message);
            }
        }