wup 2 anni fa
commit
2979bceaac
41 ha cambiato i file con 4711 aggiunte e 0 eliminazioni
  1. BIN
      .DS_Store
  2. 82 0
      .gitignore
  3. BIN
      .vs/ConsoleApp/FileContentIndex/8cde35bb-d24b-464b-8bb3-b5cddf18c8b9.vsidx
  4. 0 0
      .vs/ConsoleApp/FileContentIndex/read.lock
  5. BIN
      .vs/ConsoleApp1/FileContentIndex/17cf5447-a01c-4ae5-9642-866b91ee6b69.vsidx
  6. BIN
      .vs/ConsoleApp1/FileContentIndex/ac4f7d15-f4d3-4402-b6a1-19916bdd1efa.vsidx
  7. 0 0
      .vs/ConsoleApp1/FileContentIndex/read.lock
  8. 963 0
      .vs/ConsoleApp1/config/applicationhost.config
  9. 16 0
      .vs/ConsoleApp1/project-colors.json
  10. 0 0
      .vs/ConsoleApp1/v16/Server/sqlite3/db.lock
  11. BIN
      .vs/ConsoleApp1/v16/Server/sqlite3/storage.ide
  12. 7 0
      .vs/VSWorkspaceState.json
  13. BIN
      .vs/slnx.sqlite
  14. 24 0
      App.config
  15. 10 0
      Connected Services/IBDdocQuer/ConsoleApp1.IBDdocQuer.bdDocQueyResponse.datasource
  16. 111 0
      Connected Services/IBDdocQuer/Reference.cs
  17. 31 0
      Connected Services/IBDdocQuer/Reference.svcmap
  18. 60 0
      Connected Services/IBDdocQuer/bddocquey.wsdl
  19. 10 0
      Connected Services/IBDdocQuer/configuration.svcinfo
  20. 201 0
      Connected Services/IBDdocQuer/configuration91.svcinfo
  21. 150 0
      ConsoleApp1.csproj
  22. 25 0
      ConsoleApp1.sln
  23. BIN
      ConsoleApp1_TemporaryKey.pfx
  24. 278 0
      Controller/CY_API/CY_API_Server.cs
  25. 744 0
      Controller/CY_API/CY_NC_Api.cs
  26. 326 0
      Controller/DDing_API/DingdingAPI.cs
  27. 88 0
      Controller/DDing_API/InTheMiddle.cs
  28. 994 0
      Controller/Sql_controller/DB_Helper.cs
  29. 143 0
      Controller/Sql_controller/HttpHepler.cs
  30. 29 0
      Controller/Sql_controller/Sql_Controller.cs
  31. 150 0
      Controller/Ykb_API/Ykb_APIServer.cs
  32. 39 0
      Model/BasicData.cs
  33. 43 0
      Model/BasicPersonnelInformation.cs
  34. 20 0
      Model/BusinessUnit.cs
  35. 31 0
      Model/ProjectFiles.cs
  36. 18 0
      Model/TheBudget.cs
  37. 33 0
      Model/departmentUnit.cs
  38. 23 0
      Model/merchantsUnit.cs
  39. 22 0
      Program.cs
  40. 36 0
      Properties/AssemblyInfo.cs
  41. 4 0
      packages.config

BIN
.DS_Store


+ 82 - 0
.gitignore

@@ -0,0 +1,82 @@
+# Build and Object Folders  
+bin/  
+obj/  
+  
+# Nuget packages directory  
+packages/  
+  
+## Ignore Visual Studio temporary files, build results, and  
+## files generated by popular Visual Studio add-ons.  
+  
+# User-specific files  
+*.suo  
+*.user  
+*.sln.docstates  
+  
+# Build results  
+[Dd]ebug/  
+[Rr]elease/  
+x64/  
+*_i.c  
+*_p.c  
+*.ilk  
+*.meta  
+*.obj  
+*.pch  
+*.pdb  
+*.pgc  
+*.pgd  
+*.rsp  
+*.sbr  
+*.tlb  
+*.tli  
+*.tlh  
+*.tmp  
+*.log  
+*.vspscc  
+*.vssscc  
+.builds  
+  
+# Visual C++ cache files  
+ipch/  
+*.aps  
+*.ncb  
+*.opensdf  
+*.sdf  
+  
+# Visual Studio profiler  
+*.psess  
+*.vsp  
+*.vspx  
+  
+# Guidance Automation Toolkit  
+*.gpState  
+  
+# ReSharper is a .NET coding add-in  
+_ReSharper*  
+  
+# NCrunch  
+*.ncrunch*  
+.*crunch*.local.xml  
+  
+# Installshield output folder  
+[Ee]xpress  
+  
+# DocProject is a documentation generator add-in  
+DocProject/buildhelp/  
+DocProject/Help  
+UpgradeLog*.XML  
+  
+# Lightswitch  
+_Pvt_Extensions  
+GeneratedArtifacts  
+*.xap  
+ModelManifest.xml  
+  
+#Backup file  
+*.bak
+
+#zzzili
+v15/
+
+

BIN
.vs/ConsoleApp/FileContentIndex/8cde35bb-d24b-464b-8bb3-b5cddf18c8b9.vsidx


+ 0 - 0
.vs/ConsoleApp/FileContentIndex/read.lock


BIN
.vs/ConsoleApp1/FileContentIndex/17cf5447-a01c-4ae5-9642-866b91ee6b69.vsidx


BIN
.vs/ConsoleApp1/FileContentIndex/ac4f7d15-f4d3-4402-b6a1-19916bdd1efa.vsidx


+ 0 - 0
.vs/ConsoleApp1/FileContentIndex/read.lock


File diff suppressed because it is too large
+ 963 - 0
.vs/ConsoleApp1/config/applicationhost.config


+ 16 - 0
.vs/ConsoleApp1/project-colors.json

@@ -0,0 +1,16 @@
+{
+  "Version": 1,
+  "ProjectMap": {
+    "339f235a-2a54-4399-879b-a731acbe00d2": {
+      "ProjectGuid": "339f235a-2a54-4399-879b-a731acbe00d2",
+      "DisplayName": "ConsoleApp1",
+      "ColorIndex": 0
+    },
+    "a2fe74e1-b743-11d0-ae1a-00a0c90fffc3": {
+      "ProjectGuid": "a2fe74e1-b743-11d0-ae1a-00a0c90fffc3",
+      "DisplayName": "杂项文件",
+      "ColorIndex": -1
+    }
+  },
+  "NextColorIndex": 1
+}

+ 0 - 0
.vs/ConsoleApp1/v16/Server/sqlite3/db.lock


BIN
.vs/ConsoleApp1/v16/Server/sqlite3/storage.ide


+ 7 - 0
.vs/VSWorkspaceState.json

@@ -0,0 +1,7 @@
+{
+  "ExpandedNodes": [
+    ""
+  ],
+  "SelectedNode": "\\ConsoleApp1.sln",
+  "PreviewInSolutionExplorer": false
+}

BIN
.vs/slnx.sqlite


+ 24 - 0
App.config

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+    <system.serviceModel>
+        <bindings>
+            <basicHttpBinding>
+                <binding name="IBDdocQueySOAP11Binding" />
+            </basicHttpBinding>
+        </bindings>
+        <client>
+            <endpoint address="http://139.196.35.93:8090/uapws/service/bddocquey" binding="basicHttpBinding" bindingConfiguration="IBDdocQueySOAP11Binding" contract="IBDdocQuer.IBDdocQueyPortType" name="IBDdocQueySOAP11port_http" />
+        </client>
+    </system.serviceModel>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 10 - 0
Connected Services/IBDdocQuer/ConsoleApp1.IBDdocQuer.bdDocQueyResponse.datasource

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    This file is automatically generated by Visual Studio .Net. It is 
+    used to store generic object data source configuration information.  
+    Renaming the file extension or editing the content of this file may   
+    cause the file to be unrecognizable by the program.
+-->
+<GenericObjectDataSource DisplayName="bdDocQueyResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+   <TypeInfo>ConsoleApp1.IBDdocQuer.bdDocQueyResponse, Connected Services.IBDdocQuer.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+</GenericObjectDataSource>

+ 111 - 0
Connected Services/IBDdocQuer/Reference.cs

@@ -0,0 +1,111 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ConsoleApp1.IBDdocQuer {
+    
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    [System.ServiceModel.ServiceContractAttribute(Namespace="http://fdncc.itf.nc/IBDdocQuey", ConfigurationName="IBDdocQuer.IBDdocQueyPortType")]
+    public interface IBDdocQueyPortType {
+        
+        // CODEGEN: 消息部分命名空间  以后生成的消息协定与默认值(http://fdncc.itf.nc/IBDdocQuey)不匹配
+        [System.ServiceModel.OperationContractAttribute(Action="urn:bdDocQuey", ReplyAction="urn:bdDocQueyResponse")]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        ConsoleApp1.IBDdocQuer.bdDocQueyResponse bdDocQuey(ConsoleApp1.IBDdocQuer.bdDocQueyRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="urn:bdDocQuey", ReplyAction="urn:bdDocQueyResponse")]
+        System.Threading.Tasks.Task<ConsoleApp1.IBDdocQuer.bdDocQueyResponse> bdDocQueyAsync(ConsoleApp1.IBDdocQuer.bdDocQueyRequest request);
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="bdDocQuey", WrapperNamespace="http://fdncc.itf.nc/IBDdocQuey", IsWrapped=true)]
+    public partial class bdDocQueyRequest {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
+        public string @string;
+        
+        public bdDocQueyRequest() {
+        }
+        
+        public bdDocQueyRequest(string @string) {
+            this.@string = @string;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="bdDocQueyResponse", WrapperNamespace="http://fdncc.itf.nc/IBDdocQuey", IsWrapped=true)]
+    public partial class bdDocQueyResponse {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
+        public string @return;
+        
+        public bdDocQueyResponse() {
+        }
+        
+        public bdDocQueyResponse(string @return) {
+            this.@return = @return;
+        }
+    }
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public interface IBDdocQueyPortTypeChannel : ConsoleApp1.IBDdocQuer.IBDdocQueyPortType, System.ServiceModel.IClientChannel {
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public partial class BDdocQueyPortTypeClient : System.ServiceModel.ClientBase<ConsoleApp1.IBDdocQuer.IBDdocQueyPortType>, ConsoleApp1.IBDdocQuer.IBDdocQueyPortType {
+        
+        public BDdocQueyPortTypeClient() {
+        }
+        
+        public BDdocQueyPortTypeClient(string endpointConfigurationName) : 
+                base(endpointConfigurationName) {
+        }
+        
+        public BDdocQueyPortTypeClient(string endpointConfigurationName, string remoteAddress) : 
+                base(endpointConfigurationName, remoteAddress) {
+        }
+        
+        public BDdocQueyPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(endpointConfigurationName, remoteAddress) {
+        }
+        
+        public BDdocQueyPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(binding, remoteAddress) {
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        ConsoleApp1.IBDdocQuer.bdDocQueyResponse ConsoleApp1.IBDdocQuer.IBDdocQueyPortType.bdDocQuey(ConsoleApp1.IBDdocQuer.bdDocQueyRequest request) {
+            return base.Channel.bdDocQuey(request);
+        }
+        
+        public string bdDocQuey(string @string) {
+            ConsoleApp1.IBDdocQuer.bdDocQueyRequest inValue = new ConsoleApp1.IBDdocQuer.bdDocQueyRequest();
+            inValue.@string = @string;
+            ConsoleApp1.IBDdocQuer.bdDocQueyResponse retVal = ((ConsoleApp1.IBDdocQuer.IBDdocQueyPortType)(this)).bdDocQuey(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<ConsoleApp1.IBDdocQuer.bdDocQueyResponse> ConsoleApp1.IBDdocQuer.IBDdocQueyPortType.bdDocQueyAsync(ConsoleApp1.IBDdocQuer.bdDocQueyRequest request) {
+            return base.Channel.bdDocQueyAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<ConsoleApp1.IBDdocQuer.bdDocQueyResponse> bdDocQueyAsync(string @string) {
+            ConsoleApp1.IBDdocQuer.bdDocQueyRequest inValue = new ConsoleApp1.IBDdocQuer.bdDocQueyRequest();
+            inValue.@string = @string;
+            return ((ConsoleApp1.IBDdocQuer.IBDdocQueyPortType)(this)).bdDocQueyAsync(inValue);
+        }
+    }
+}

+ 31 - 0
Connected Services/IBDdocQuer/Reference.svcmap

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="5c137b4d-36ef-4f65-bdce-5d8a65b1b98c" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
+  <ClientOptions>
+    <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
+    <GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
+    <EnableDataBinding>true</EnableDataBinding>
+    <ExcludedTypes />
+    <ImportXmlTypes>false</ImportXmlTypes>
+    <GenerateInternalTypes>false</GenerateInternalTypes>
+    <GenerateMessageContracts>false</GenerateMessageContracts>
+    <NamespaceMappings />
+    <CollectionMappings />
+    <GenerateSerializableTypes>true</GenerateSerializableTypes>
+    <Serializer>Auto</Serializer>
+    <UseSerializerForFaults>true</UseSerializerForFaults>
+    <ReferenceAllAssemblies>true</ReferenceAllAssemblies>
+    <ReferencedAssemblies />
+    <ReferencedDataContractTypes />
+    <ServiceContractMappings />
+  </ClientOptions>
+  <MetadataSources>
+    <MetadataSource Address="http://139.196.35.93:8090/uapws/service/bddocquey?wsdl" Protocol="http" SourceId="1" />
+  </MetadataSources>
+  <Metadata>
+    <MetadataFile FileName="bddocquey.wsdl" MetadataType="Wsdl" ID="1d4a3b15-922c-48db-9ffa-49867f9137b6" SourceId="1" SourceUrl="http://139.196.35.93:8090/uapws/service/bddocquey?wsdl" />
+  </Metadata>
+  <Extensions>
+    <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
+    <ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" />
+  </Extensions>
+</ReferenceGroup>

+ 60 - 0
Connected Services/IBDdocQuer/bddocquey.wsdl

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:ns0="http://fdncc.itf.nc/IBDdocQuey" jaxb:version="2.0" targetNamespace="http://fdncc.itf.nc/IBDdocQuey" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <jaxws:bindings>
+    <jaxws:package name="nc.itf.fdncc" />
+  </jaxws:bindings>
+  <wsdl:types>
+    <xsd:schema xmlns:ns="http://fdncc.itf.nc/IBDdocQuey" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://fdncc.itf.nc/IBDdocQuey" jaxb:version="2.0">
+      <xsd:annotation>
+        <xsd:appinfo>
+          <jaxb:schemaBindings>
+            <jaxb:package name="nc.itf.fdncc" />
+          </jaxb:schemaBindings>
+        </xsd:appinfo>
+      </xsd:annotation>
+      <xsd:element name="bdDocQuey">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element minOccurs="0" name="string" nillable="true" type="xsd:string" />
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+      <xsd:element name="bdDocQueyResponse">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element minOccurs="0" name="return" nillable="true" type="xsd:string" />
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="bdDocQueyRequest">
+    <wsdl:part name="parameters" element="ns0:bdDocQuey" />
+  </wsdl:message>
+  <wsdl:message name="bdDocQueyResponse">
+    <wsdl:part name="parameters" element="ns0:bdDocQueyResponse" />
+  </wsdl:message>
+  <wsdl:portType name="IBDdocQueyPortType">
+    <wsdl:operation name="bdDocQuey">
+      <wsdl:input wsaw:Action="urn:bdDocQuey" message="ns0:bdDocQueyRequest" />
+      <wsdl:output wsaw:Action="urn:bdDocQueyResponse" message="ns0:bdDocQueyResponse" />
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="IBDdocQueySOAP11Binding" type="ns0:IBDdocQueyPortType">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+    <wsdl:operation name="bdDocQuey">
+      <soap:operation soapAction="urn:bdDocQuey" style="document" />
+      <wsdl:input>
+        <soap:body use="literal" />
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal" />
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="IBDdocQuey">
+    <wsdl:port name="IBDdocQueySOAP11port_http" binding="ns0:IBDdocQueySOAP11Binding">
+      <soap:address location="http://139.196.35.93:8090/uapws/service/bddocquey" />
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

File diff suppressed because it is too large
+ 10 - 0
Connected Services/IBDdocQuer/configuration.svcinfo


+ 201 - 0
Connected Services/IBDdocQuer/configuration91.svcinfo

@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="OkhFS5AcPqa1r6dXOE8+pnbUmifs6pGFXz0AjBN8UE8=">
+  <bindingConfigurations>
+    <bindingConfiguration bindingType="basicHttpBinding" name="IBDdocQueySOAP11Binding">
+      <properties>
+        <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>IBDdocQueySOAP11Binding</serializedValue>
+        </property>
+        <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>StrongWildcard</serializedValue>
+        </property>
+        <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>65536</serializedValue>
+        </property>
+        <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue>
+        </property>
+        <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>0</serializedValue>
+        </property>
+        <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>0</serializedValue>
+        </property>
+        <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>0</serializedValue>
+        </property>
+        <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>0</serializedValue>
+        </property>
+        <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>0</serializedValue>
+        </property>
+        <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.Text.UTF8Encoding</serializedValue>
+        </property>
+        <property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>Buffered</serializedValue>
+        </property>
+        <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>Text</serializedValue>
+        </property>
+        <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue>
+        </property>
+        <property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>None</serializedValue>
+        </property>
+        <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue>
+        </property>
+        <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>None</serializedValue>
+        </property>
+        <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>None</serializedValue>
+        </property>
+        <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue>
+        </property>
+        <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>Never</serializedValue>
+        </property>
+        <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>TransportSelected</serializedValue>
+        </property>
+        <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>(集合)</serializedValue>
+        </property>
+        <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue>
+        </property>
+        <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>UserName</serializedValue>
+        </property>
+        <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>Default</serializedValue>
+        </property>
+      </properties>
+    </bindingConfiguration>
+  </bindingConfigurations>
+  <endpoints>
+    <endpoint name="IBDdocQueySOAP11port_http" contract="IBDdocQuer.IBDdocQueyPortType" bindingType="basicHttpBinding" address="http://139.196.35.93:8090/uapws/service/bddocquey" bindingConfiguration="IBDdocQueySOAP11Binding">
+      <properties>
+        <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>http://139.196.35.93:8090/uapws/service/bddocquey</serializedValue>
+        </property>
+        <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>basicHttpBinding</serializedValue>
+        </property>
+        <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>IBDdocQueySOAP11Binding</serializedValue>
+        </property>
+        <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>IBDdocQuer.IBDdocQueyPortType</serializedValue>
+        </property>
+        <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue>
+        </property>
+        <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>&lt;Header /&gt;</serializedValue>
+        </property>
+        <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue>
+        </property>
+        <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue>
+        </property>
+        <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
+        </property>
+        <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
+        </property>
+        <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
+        </property>
+        <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue>
+        </property>
+        <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue>
+        </property>
+        <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>My</serializedValue>
+        </property>
+        <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>LocalMachine</serializedValue>
+        </property>
+        <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>FindBySubjectDistinguishedName</serializedValue>
+        </property>
+        <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>False</serializedValue>
+        </property>
+        <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue>IBDdocQueySOAP11port_http</serializedValue>
+        </property>
+        <property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+        <property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+          <serializedValue />
+        </property>
+      </properties>
+    </endpoint>
+  </endpoints>
+</SavedWcfConfigurationInformation>

+ 150 - 0
ConsoleApp1.csproj

@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{339F235A-2A54-4399-879B-A731ACBE00D2}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>ConsoleApp1</RootNamespace>
+    <AssemblyName>ConsoleApp1</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>E:\发布程序\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>12</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <PublishWizardCompleted>true</PublishWizardCompleted>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestCertificateThumbprint>0EC0DFEE7806BBB5116394285C91C6D09403B8AF</ManifestCertificateThumbprint>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestKeyFile>ConsoleApp1_TemporaryKey.pfx</ManifestKeyFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <GenerateManifests>true</GenerateManifests>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignManifests>true</SignManifests>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="H3.BizBus">
+      <HintPath>E:\房德\房德文件\房德文件\bin\H3.BizBus.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="TopSdk">
+      <HintPath>E:\房德\房德文件\房德文件\bin\TopSdk.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Connected Services\IBDdocQuer\Reference.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Reference.svcmap</DependentUpon>
+    </Compile>
+    <Compile Include="Controller\CY_API\CY_API_Server.cs" />
+    <Compile Include="Controller\CY_API\CY_NC_Api.cs" />
+    <Compile Include="Controller\DDing_API\DingdingAPI.cs" />
+    <Compile Include="Controller\DDing_API\InTheMiddle.cs" />
+    <Compile Include="Controller\Sql_controller\DB_Helper.cs" />
+    <Compile Include="Controller\Sql_controller\HttpHepler.cs" />
+    <Compile Include="Controller\Sql_controller\Sql_Controller.cs" />
+    <Compile Include="Controller\Ykb_API\Ykb_APIServer.cs" />
+    <Compile Include="Model\BasicData.cs" />
+    <Compile Include="Model\BasicPersonnelInformation.cs" />
+    <Compile Include="Model\BusinessUnit.cs" />
+    <Compile Include="Model\departmentUnit.cs" />
+    <Compile Include="Model\merchantsUnit.cs" />
+    <Compile Include="Model\ProjectFiles.cs" />
+    <Compile Include="Model\TheBudget.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="Connected Services\IBDdocQuer\bddocquey.wsdl" />
+    <None Include="Connected Services\IBDdocQuer\ConsoleApp1.IBDdocQuer.bdDocQueyResponse.datasource">
+      <DependentUpon>Reference.svcmap</DependentUpon>
+    </None>
+    <None Include="ConsoleApp1_TemporaryKey.pfx" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Connected Services\" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadataStorage Include="Connected Services\IBDdocQuer\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Connected Services\IBDdocQuer\configuration91.svcinfo" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Connected Services\IBDdocQuer\configuration.svcinfo" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Connected Services\IBDdocQuer\Reference.svcmap">
+      <Generator>WCF Proxy Generator</Generator>
+      <LastGenOutput>Reference.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 25 - 0
ConsoleApp1.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31919.166
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1.csproj", "{339F235A-2A54-4399-879B-A731ACBE00D2}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{339F235A-2A54-4399-879B-A731ACBE00D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{339F235A-2A54-4399-879B-A731ACBE00D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{339F235A-2A54-4399-879B-A731ACBE00D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{339F235A-2A54-4399-879B-A731ACBE00D2}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CFFE0AAA-2158-4FDC-8733-A14B413442B1}
+	EndGlobalSection
+EndGlobal

BIN
ConsoleApp1_TemporaryKey.pfx


+ 278 - 0
Controller/CY_API/CY_API_Server.cs

@@ -0,0 +1,278 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.CY_API
+{
+    /// <summary>
+    /// 第三方调用氚云接口
+    /// </summary>
+    public class CY_API_Server
+    {
+
+        public CY_API_Server()
+        {
+            //
+            // TODO: Add constructor logic here
+            //
+        }
+
+        /// <summary>
+        /// 氚云接口
+        /// </summary>
+        /// <param name="ActionName">CreateBizObjects</param>
+        /// <param name="pargam">数据集合</param>
+        /// <param name="sucessfull">bool</param>
+        /// <returns></returns>
+        public static string H3YunApi(string ActionName, Dictionary<string, string> pargam, out bool sucessfull)
+        {
+            try
+            {
+                string webApiAddress = "https://www.h3yun.com/OpenApi/Invoke";                      //接口地址
+                string engineCode = "aeonq7mdwwdbtdmamrf6ul441";      //Code
+                string secret = "EHSYxx7UvJETDyvcNiniOivlYlcE+zB29HdXZSNan9WBV+Rvv0tIaQ==";        //Secret
+
+                System.Net.HttpWebRequest request;
+                request = (System.Net.HttpWebRequest)WebRequest.Create(webApiAddress);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                //身份认证参数
+                request.Headers.Add("EngineCode", engineCode);
+                request.Headers.Add("EngineSecret", secret);
+                //参数
+                Dictionary<string, object> dicParams = new Dictionary<string, object>();
+                dicParams.Add("ActionName", ActionName);
+
+                //自定义参数
+                if (pargam != null && pargam.Count > 0)
+                {
+                    foreach (KeyValuePair<string, string> kv in pargam)
+                    {
+                        dicParams.Add(kv.Key, kv.Value);
+                    }
+                }
+
+                string jsonData = JsonConvert.SerializeObject(dicParams);
+                byte[] bytes;
+                bytes = System.Text.Encoding.UTF8.GetBytes(jsonData);
+                request.ContentLength = bytes.Length;
+                string StrDate = string.Empty;
+                string strValue = string.Empty;
+                using (Stream writer = request.GetRequestStream())
+                {
+                    writer.Write(bytes, 0, bytes.Length);
+                    writer.Close();
+                }
+                using (System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse())
+                {
+                    using (System.IO.Stream s = response.GetResponseStream())
+                    {
+
+                        using (StreamReader Reader = new StreamReader(s, Encoding.UTF8))
+                        {
+                            while ((StrDate = Reader.ReadLine()) != null)
+                            {
+                                strValue += StrDate + "\r\n";
+                            }
+                        }
+                    }
+                }
+                sucessfull = true;
+                return strValue;
+
+            }
+            catch (Exception ee)
+            {
+                sucessfull = false;
+                return ee.ToString();
+            }
+        }
+
+        /// <summary>
+        /// 查询单条业务数据
+        /// </summary>
+        /// <param name="ActionName">调用的方法名</param>
+        /// <param name="SchemaCode">需要查询的表单编码</param>
+        /// <param name="BizObjectId">需要查询的数据ID,每个表单都有唯一的ObjectId</param>
+        /// <returns></returns>
+        public static string LoadBizObject(string ActionName, string SchemaCode, string BizObjectId)
+        {
+            try
+            {
+                string ApiAddress = "https://www.h3yun.com/OpenApi/Invoke";                      //接口地址   
+                HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(ApiAddress);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                //身份认证参数
+                request.Headers.Add("EngineCode", "aeonq7mdwwdbtdmamrf6ul441");
+                request.Headers.Add("EngineSecret", "EHSYxx7UvJETDyvcNiniOivlYlcE+zB29HdXZSNan9WBV+Rvv0tIaQ==");
+                //参数
+                Dictionary<string, object> dicParams = new Dictionary<string, object>();
+                dicParams.Add("ActionName", ActionName);
+                dicParams.Add("SchemaCode", SchemaCode);
+                dicParams.Add("BizObjectId", BizObjectId);
+                string jsonData = JsonConvert.SerializeObject(dicParams);
+                byte[] bytes;
+                bytes = System.Text.Encoding.UTF8.GetBytes(jsonData);
+                request.ContentLength = bytes.Length;
+                using (Stream writer = request.GetRequestStream())
+                {
+                    writer.Write(bytes, 0, bytes.Length);
+                    writer.Close();
+                }
+                string strValue = string.Empty;
+                using (System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse())
+                {
+                    using (System.IO.Stream s = response.GetResponseStream())
+                    {
+                        string StrDate = string.Empty;
+                        using (StreamReader Reader = new StreamReader(s, Encoding.UTF8))
+                        {
+                            while ((StrDate = Reader.ReadLine()) != null)
+                            {
+                                strValue += StrDate + "\r\n";
+                            }
+                        }
+                    }
+                }
+
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 批量查询业务数据
+        /// </summary>
+        /// <param name="ActionName">调用的方法名</param>
+        /// <param name="SchemaCodem">需要查询的表单编码</param>
+        /// <param name="Filter">过滤条件。默认返回前500条数据</param>
+        /// <returns></returns>
+        public static string LoadBizObjects(string ActionName, string SchemaCodem, string Filter)
+        {
+            try
+            {
+                string apiAddress = @"https://www.h3yun.com/OpenApi/Invoke";
+                HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(apiAddress);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                //身份认证参数
+                request.Headers.Add("EngineCode", "aeonq7mdwwdbtdmamrf6ul441");
+                request.Headers.Add("EngineSecret", "EHSYxx7UvJETDyvcNiniOivlYlcE+zB29HdXZSNan9WBV+Rvv0tIaQ==");
+                //参数
+                Dictionary<string, object> dicParams = new Dictionary<string, object>();
+                dicParams.Add("ActionName", ActionName);
+                dicParams.Add("SchemaCode", SchemaCodem);
+                dicParams.Add("Filter", Filter);
+
+                string jsonData = JsonConvert.SerializeObject(dicParams);
+                byte[] bytes;
+                bytes = System.Text.Encoding.UTF8.GetBytes(jsonData);
+                request.ContentLength = bytes.Length;
+                using (Stream writer = request.GetRequestStream())
+                {
+                    writer.Write(bytes, 0, bytes.Length);
+                    writer.Close();
+                }
+                string strValue = string.Empty;
+                using (System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse())
+                {
+                    using (System.IO.Stream s = response.GetResponseStream())
+                    {
+                        string StrDate = string.Empty;
+                        using (StreamReader Reader = new StreamReader(s, Encoding.UTF8))
+                        {
+                            while ((StrDate = Reader.ReadLine()) != null)
+                            {
+                                strValue += StrDate + "\r\n";
+                            }
+                        }
+                    }
+                }
+                return strValue;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        /// <summary>
+        /// 更新业务数据
+        /// </summary>
+        /// <param name="ActionName">调用的方法名</param>
+        /// <param name="SchemaCode">表单编码</param>
+        /// <param name="BizObjectId">表单ObjectId值</param>
+        /// <param name="BizObject">BizObject对象的json 字符串</param>
+        /// <returns></returns>
+        public static string UpdateBizObject(string ActionName, string SchemaCode, string BizObjectId, Dictionary<string, string> BizObject)
+        {
+            try
+            {
+                string apiAddress = @"https://www.h3yun.com/OpenApi/Invoke";
+                HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(apiAddress);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                //身份认证参数
+                request.Headers.Add("EngineCode", "aeonq7mdwwdbtdmamrf6ul441");
+                request.Headers.Add("EngineSecret", "EHSYxx7UvJETDyvcNiniOivlYlcE+zB29HdXZSNan9WBV+Rvv0tIaQ==");
+                //参数
+                Dictionary<string, object> dicParams = new Dictionary<string, object>();
+                dicParams.Add("ActionName", ActionName);
+                dicParams.Add("SchemaCode", SchemaCode);
+                //dicParams.Add("BizObject", "{ \"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-822cbc82a46662\", \"OwnerId\":   \"f3f69a49-edf6-468d-9aee-822cbc82a46662\",\"F0000002\":   \"99933399\", \"F0000009\": \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df\"   }");
+                if (BizObject != null && BizObject.Count > 0)
+                {
+                    foreach (KeyValuePair<string, string> kv in BizObject)
+                    {
+                        dicParams.Add(kv.Key, kv.Value);
+                    }
+                }
+                dicParams.Add("BizObjectId", BizObjectId);
+
+                string jsonData = JsonConvert.SerializeObject(dicParams);
+                byte[] bytes;
+                bytes = System.Text.Encoding.UTF8.GetBytes(jsonData);
+                request.ContentLength = bytes.Length;
+                using (Stream writer = request.GetRequestStream())
+                {
+                    writer.Write(bytes, 0, bytes.Length);
+                    writer.Close();
+                }
+                string strValue = string.Empty;
+                using (System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse())
+                {
+                    using (System.IO.Stream s = response.GetResponseStream())
+
+                    {
+
+                        string StrDate = string.Empty;
+
+                        using (StreamReader Reader = new StreamReader(s, Encoding.UTF8))
+                        {
+                            while ((StrDate = Reader.ReadLine()) != null)
+                            {
+                                strValue += StrDate + "\r\n";
+                            }
+                        }
+                    }
+                }
+                return strValue;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+        }
+
+    }
+}

+ 744 - 0
Controller/CY_API/CY_NC_Api.cs

@@ -0,0 +1,744 @@
+using ConsoleApp1.Controller.Sql_controller;
+using ConsoleApp1.Controller.Ykb_API;
+using ConsoleApp1.Model;
+using H3.BizBus;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.CY_API
+{
+    /// <summary>
+    /// NC同步基础资料到氚云
+    /// </summary>
+    public class CY_NC_Api
+    {
+        //private Ding_YP_Public ding_YP_Public = new Ding_YP_Public();
+        private Ykb_APIServer ykb_API = new Ykb_APIServer();
+
+        public void NC_CY()
+        {
+            string ykbToken = ykb_API.dttoken();
+
+            string dates = (DateTime.Now.AddDays(-5)).ToString("yyyy-MM-dd");   //获取当前年月日
+            //string dates = "2021-02-22";
+
+            IBDdocQuer.BDdocQueyPortTypeClient cs = new IBDdocQuer.BDdocQueyPortTypeClient();
+            //string css1 = CY_API_Server.LoadBizObjects("LoadBizObjects", "D116604ab3e5ca3a3f944b2bb2db76b67780a2a", this.Filter("张涛"));
+            int i = 0, j = 0; string mun = "", codes = null;
+            #region NC 业务单元
+            do
+            {
+                i = i + 1;
+                var json = cs.bdDocQuey("{\"data\": {\"billfalg\": \"业务单元\",\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\":\"creationtime >= '" + dates + "'\"}}");//,\"code\":\"G00070\",\"ts\": \"ts>='"+ dates + "'\,\"ts\": \"ts\">='2021-02-22'\",\"currentPage\":" + i + ",\"linesize\":\"200\",            ,\"ts\":\"ts >= '" + dates + "'\"
+                JObject ResultJson = JsonConvert.DeserializeObject<JObject>(json.ToString());
+                mun = ResultJson["msg"].ToString();
+                if (ResultJson["code"].ToString() == "Y")
+                {
+                    foreach (var item in ResultJson["returndata"])
+                    {
+                        ///调用查询方法判断该表中是否存在该条Code的值
+                        string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D116604Szkzflihsy7yhpiqs3v99ysio4", this.Filter(item["code"].ToString()));
+                        JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                        if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                        {
+                            //ykb_API.InsertDAN(ykbToken, item["code"].ToString(), "gCEbY44UmM4Q00:法人实体", item["name"].ToString());
+                            string setData = ykb_API.setDAN(ykbToken, item["code"].ToString());
+                            int man = Convert.ToInt32(setData);
+                            if (man < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item["name"].ToString(), "gCEbY44UmM4Q00:法人实体", item["code"].ToString());
+                            }
+                            DataTable dt1 = BizObjectId(jObject);
+                            dt1.PrimaryKey = new DataColumn[] { dt1.Columns["Code"] };
+                            DataRow rows = dt1.Rows.Find(item["code"]);
+                            string ObjectId = string.Format(rows["ObjectId"].ToString());
+                            BusinessUnit businessUnit = new BusinessUnit()
+                            {
+                                F0000001 = item["code"].ToString(),
+                                F0000002 = item["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            //调用修改方法进行修改
+                            CY_API_Server.UpdateBizObject("UpdateBizObject", "D116604Szkzflihsy7yhpiqs3v99ysio4", ObjectId, dic);
+
+                        }
+                        else
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item["code"].ToString());
+                            int man = Convert.ToInt32(setData);
+                            if (man < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item["name"].ToString(), "gCEbY44UmM4Q00:法人实体", item["code"].ToString());
+                            }
+                            //氚云接口(1.需要实体类 2.数据集合 3.IsSubmit)
+                            BusinessUnit businessUnit = new BusinessUnit()
+                            {
+                                F0000001 = item["code"].ToString(),
+                                F0000002 = item["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            dic.Add("SchemaCode", "D116604Szkzflihsy7yhpiqs3v99ysio4");
+                            dic.Add("IsSubmit", "true");
+                            bool success = false;
+                            ///新增方法
+                            CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                            if (success)
+                            {
+                                j++;
+                                codes += "&" + item["code"].ToString();
+                            }
+                            else
+                            {
+                                //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                            }
+                        }
+                    }
+                    if (j > 0)
+                    {
+                        //ding_YP_Public.send_to_conversation(null, "text", "业务单元新增" + j + "条数据,数据为:" + codes, false, "1951251420023804");
+                    }
+                    Sql_Controller.Synchronous_Log("业务单元同步成功","0", "成功信息:" + ResultJson["msg"].ToString());
+                }
+                else
+                {
+                    Sql_Controller.Synchronous_Log("业务单元同步失败","1", "错误原因:" + ResultJson["msg"].ToString());
+                }
+            } while (mun == "查询到200条数据");
+            i = 0; j = 0; codes = null;
+            #endregion
+
+            #region NC 项目档案
+            do
+            {
+                i = i + 1;
+                var json1 = cs.bdDocQuey("{\"data\": {\"billfalg\": \"项目档案\",\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\":\"creationtime >= '" + dates + "'\"}}");//,\"code\":\"XX00096\",\"currentPage\":" + i + ",\"linesize\":\"200\"
+                JObject ResultJson1 = JsonConvert.DeserializeObject<JObject>(json1.ToString());
+                mun = ResultJson1["msg"].ToString();
+                if (ResultJson1["code"].ToString() == "Y")
+                {
+                    
+                    foreach (var item2 in ResultJson1["returndata"])
+                    {
+                        ///调用批量查询接口
+                        string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D11660428ef6c76643f493daaa976d0909157cd", this.Filter(item2["project_code"].ToString()));
+                        JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                        if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                        {
+                            //ykb_API.InsertDAN(ykbToken, item2["project_code"].ToString(), "gCEbY44UmM4Q00:项目", item2["project_name"].ToString());
+                            string setData = ykb_API.setDAN(ykbToken, item2["project_code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item2["project_name"].ToString(), "gCEbY44UmM4Q00:项目", item2["project_code"].ToString());
+                            }
+                            DataTable dt = BizObjectId(jObject);
+                            dt.PrimaryKey = new DataColumn[] { dt.Columns["Code"] };
+                            DataRow rows = dt.Rows.Find(item2["project_code"]);
+                            string ObjectId = string.Format(rows["ObjectId"].ToString());
+                            ProjectFiles businessUnit = new ProjectFiles()
+                            {
+                                F0000001 = item2["project_code"].ToString(),
+                                F0000002 = item2["project_name"].ToString(),
+                                F0000003 = item2["orgcode"].ToString(),
+                                F0000004 = item2["orgname"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            //调用修改方法进行修改
+                            CY_API_Server.UpdateBizObject("UpdateBizObject", "D11660428ef6c76643f493daaa976d0909157cd", ObjectId, dic);
+                        }
+                        else //无数据则新增进去
+                        {
+                            string setData = ykb_API.setDAN(ykbToken,item2["project_code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item2["project_name"].ToString(), "gCEbY44UmM4Q00:项目", item2["project_code"].ToString());
+                            }
+                            //氚云接口(1.需要实体类 2.数据集合 3.IsSubmit)
+                            ProjectFiles project = new ProjectFiles()
+                            {
+                                F0000001 = item2["project_code"].ToString(),
+                                F0000002 = item2["project_name"].ToString(),
+                                F0000003 = item2["orgcode"].ToString(),
+                                F0000004 = item2["orgname"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(project));
+                            dic.Add("SchemaCode", "D11660428ef6c76643f493daaa976d0909157cd");
+                            dic.Add("IsSubmit", "true");
+                            bool success = false;
+                            CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                            if (success)
+                            {
+                                j++;
+                                codes += "&" + item2["project_code"].ToString();
+                            }
+                            else
+                            {
+                                //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                            }
+                        }
+                    }
+                    if (j > 0)
+                    {
+                        //ding_YP_Public.send_to_conversation(null, "text", "项目档案新增" + j + "条数据,数据为:" + codes, false, "1951251420023804");
+                    }
+                    Sql_Controller.Synchronous_Log("项目档案同步成功", "0","成功信息:" + ResultJson1["msg"].ToString());
+                }
+                else
+                {
+                    Sql_Controller.Synchronous_Log("项目档案同步失败","1", "错误原因:" + ResultJson1["msg"].ToString());
+                }
+            } while (mun == "查询到200条数据");
+            i = 0; j = 0;
+            #endregion
+
+            #region 客商档案
+            do
+            {
+                i = i + 1;
+                var json3 = cs.bdDocQuey("{\"data\": {\"billfalg\": \"客商\",\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\":\"creationtime >= '" + dates + "'\"}}");//,\"code\":\"W09999\"\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\": \"creationtime >= '" + dates + "'\"
+                JObject ResultJson3 = JsonConvert.DeserializeObject<JObject>(json3.ToString());
+                mun = ResultJson3["msg"].ToString();
+                if (ResultJson3["code"].ToString() == "Y")
+                {
+                    foreach (var item4 in  ResultJson3["returndata"])
+                    {
+                        
+                        string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D1166047df1ad979abe4335b41ec9b070b6d20f", this.Filter(item4["head"]["code"].ToString()));
+                        JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                        if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                        {
+                            //ykb_API.InsertDAN(ykbToken, item4["head"]["name"].ToString(), "gCEbY44UmM4Q00:客商档案", item4["head"]["code"].ToString());
+                            string setData = ykb_API.setDAN(ykbToken, item4["head"]["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item4["head"]["name"].ToString(), "gCEbY44UmM4Q00:供应商档案", item4["head"]["code"].ToString());
+                            }
+                            DataTable dt4 = BizObjectId(jObject);
+                            dt4.PrimaryKey = new DataColumn[] { dt4.Columns["Code"] };
+                            DataRow rows = dt4.Rows.Find(item4["head"]["code"]);
+                            string ObjectId = string.Format(rows["ObjectId"].ToString());
+                            merchantsUnit businessUnit = new merchantsUnit()
+                            {
+                                F0000001 = item4["head"]["code"].ToString(),
+                                F0000002 = item4["head"]["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            //调用修改方法进行修改
+                            CY_API_Server.UpdateBizObject("UpdateBizObject", "D1166047df1ad979abe4335b41ec9b070b6d20f", ObjectId, dic);
+
+                        }
+                        else
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item4["head"]["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item4["head"]["name"].ToString(), "gCEbY44UmM4Q00:供应商档案", item4["head"]["code"].ToString());
+                            }
+                            merchantsUnit dapa = new merchantsUnit()
+                            {
+                                F0000001 = item4["head"]["code"].ToString(),
+                                F0000002 = item4["head"]["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(dapa));
+                            dic.Add("SchemaCode", "D1166047df1ad979abe4335b41ec9b070b6d20f");
+                            dic.Add("IsSubmit", "true");
+                            bool success = false;
+                            CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                            if (success)
+                            {
+                                j++;
+                                codes += "&" + item4["head"]["code"].ToString();
+                            }
+                            else
+                            {
+                                //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                            }
+                        }
+                    }
+                    if (j > 0)
+                    {
+                        //ding_YP_Public.send_to_conversation(null, "text", "客商档案新增" + j + "条数据,数据为:" + codes, false, "1951251420023804");//
+                    }
+                    Sql_Controller.Synchronous_Log("客商档案同步成功","0" ,"成功信息:" + ResultJson3["msg"].ToString());
+                }
+                else
+                {
+                    Sql_Controller.Synchronous_Log("客商档案同步失败","1", "错误原因:" + ResultJson3["msg"].ToString());
+                }
+            } while (mun == "查询到200条数据");
+            i = 0; j = 0;
+            #endregion
+
+            #region 预算组织
+            do
+            {
+                i = i + 1;
+                var json4 = cs.bdDocQuey("{\"data\": {\"billfalg\": \"预算组织\",\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\":\"creationtime >= '" + dates + "'\"}}"); //\"currentPage\":" + i + ",\"linesize\":\"200\",
+                JObject ResultJson4 = JsonConvert.DeserializeObject<JObject>(json4.ToString());
+                mun = ResultJson4["msg"].ToString();
+                if (ResultJson4["code"].ToString() == "Y")
+                {
+                    foreach (var item5 in ResultJson4["returndata"])
+                    {
+
+                        string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D116604Sq74oibupd5yckiaxh8209f1q5", this.Filter1(item5["code"].ToString()));
+                        JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                        if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item5["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item5["name"].ToString(), "gCEbY44UmM4Q00:预算组织", item5["code"].ToString());
+                            }
+                            DataTable dt5 = BizObjectId2(jObject);
+                            dt5.PrimaryKey = new DataColumn[] { dt5.Columns["Code"] };
+                            DataRow rows = dt5.Rows.Find(item5["code"]);
+                            string ObjectId = string.Format(rows["ObjectId"].ToString());
+                            merchantsUnit businessUnit = new merchantsUnit()
+                            {
+                                F0000002 = item5["code"].ToString(),
+                                F0000001 = item5["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            //调用修改方法进行修改
+                            CY_API_Server.UpdateBizObject("UpdateBizObject", "D116604Sq74oibupd5yckiaxh8209f1q5", ObjectId, dic);
+
+                        }
+                        else
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item5["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item5["name"].ToString(), "gCEbY44UmM4Q00:预算组织", item5["code"].ToString());
+                            }
+                            TheBudget Yv = new TheBudget()
+                            {
+                                F0000002 = item5["code"].ToString(),
+                                F0000001 = item5["name"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(Yv));
+                            dic.Add("SchemaCode", "D116604Sq74oibupd5yckiaxh8209f1q5");
+                            dic.Add("IsSubmit", "true");
+                            bool success = false;
+                            CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                            if (success)
+                            {
+                                j++;
+                                codes += "&" + item5["code"].ToString();
+                            }
+                            else
+                            {
+                                //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                            }
+                        }
+                    }
+                    if (j > 0)
+                    {
+                        //ding_YP_Public.send_to_conversation(null, "text", "预算组织新增" + j + "条数据,数据为:" + codes, false, "1951251420023804");
+                    }
+                    Sql_Controller.Synchronous_Log("客商档案同步成功","0","成功信息:" + ResultJson4["msg"].ToString());
+                }
+                else
+                {
+                    Sql_Controller.Synchronous_Log("客商档案同步失败","1", "错误原因:" + ResultJson4["msg"].ToString());
+                }
+            } while (mun == "查询到200条数据");
+            i = 0; j = 0;
+            #endregion
+
+            #region NC 部门档案
+            do
+            {
+                i = i + 1;
+                var json2 = cs.bdDocQuey("{\"data\": {\"billfalg\": \"部门\",\"currentPage\":" + i + ",\"linesize\":\"200\",\"creationtime\":\"creationtime >= '" + dates + "'\"}}");  //,\"code\":\"0046\"\"currentPage\":" + i + ",\"linesize\":\"200\",
+                JObject ResultJson2 = JsonConvert.DeserializeObject<JObject>(json2.ToString());
+                mun = ResultJson2["msg"].ToString();
+                if (ResultJson2["code"].ToString() == "Y")
+                {
+                    foreach (var item3 in ResultJson2["returndata"])
+                    {
+                        string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D11660434d73096fca14c20acffdfa2dfcfb5ac", this.Filter(item3["code"].ToString()));
+                        JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                        if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item3["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item3["name"].ToString(), "gCEbY44UmM4Q00:部门档案", item3["code"].ToString());
+                            }
+                            DataTable dt3 = BizObjectId(jObject);
+                            dt3.PrimaryKey = new DataColumn[] { dt3.Columns["Code"] };
+                            DataRow rows = dt3.Rows.Find(item3["code"]);
+                            string ObjectId = string.Format(rows["ObjectId"].ToString());
+                            departmentUnit businessUnit = new departmentUnit()
+                            {
+                                F0000001 = item3["code"].ToString(),
+                                F0000002 = item3["name"].ToString(),
+                                F0000003 = item3["projectcode"].ToString(),
+                                F0000004 = item3["projectname"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                            //调用修改方法进行修改
+                            CY_API_Server.UpdateBizObject("UpdateBizObject", "D11660434d73096fca14c20acffdfa2dfcfb5ac", ObjectId, dic);
+
+                        }
+                        else
+                        {
+                            string setData = ykb_API.setDAN(ykbToken, item3["code"].ToString());
+                            if (Convert.ToInt32(setData) < 1)
+                            {
+                                ykb_API.InsertDAN(ykbToken, item3["name"].ToString(), "gCEbY44UmM4Q00:部门档案", item3["code"].ToString());
+                            }
+                            //氚云接口(1.需要实体类 2.数据集合 3.IsSubmit)
+                            departmentUnit depa = new departmentUnit()
+                            {
+                                F0000001 = item3["code"].ToString(),
+                                F0000002 = item3["name"].ToString(),
+                                F0000003 = item3["projectcode"].ToString(),
+                                F0000004 = item3["projectname"].ToString()
+                            };
+                            Dictionary<string, string> dic = new Dictionary<string, string>();
+                            dic.Add("BizObject", JsonConvert.SerializeObject(depa));
+                            dic.Add("SchemaCode", "D11660434d73096fca14c20acffdfa2dfcfb5ac");
+                            dic.Add("IsSubmit", "true");
+                            bool success = false;
+                            CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                            if (success)
+                            {
+                                j++;
+                                codes += "&" + item3["code"].ToString();
+                            }
+                            else
+                            {
+                                //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                            }
+                        }
+                    }
+                    if (j > 0)
+                    {
+                        //ding_YP_Public.send_to_conversation(null, "text", "部门档案新增" + j + "条数据,数据为:" + codes, false, "1951251420023804");
+                    }
+                    Sql_Controller.Synchronous_Log("部门档案同步成功", "0","成功信息:" + ResultJson2["msg"].ToString());
+                }
+                else
+                {
+                    Sql_Controller.Synchronous_Log("部门档案同步失败","1", "错误原因:" + ResultJson2["msg"].ToString());
+                }
+            } while (mun == "查询到200条数据");
+            i = 0;
+            #endregion
+        }
+
+        #region 钉钉-氚云
+
+        /// <summary>
+        /// 钉钉写入氚云
+        /// </summary>
+        /// <param name="json2"></param>
+        public void Basic(JObject json2)
+        {
+            try
+            {
+
+                string value = json2["userid"].ToString();
+                ///调用查询方法判断该表中是否存在该条Code的值
+                string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D116604ab3e5ca3a3f944b2bb2db76b67780a2a", this.Filter(value, ""));
+                JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                {
+                    DataTable dt1 = BizObjectId(jObject);
+                    DataTable dt2 = BizObjectId2(json2, value, dt1.Rows[0]["ObjectId"].ToString());
+                    dt2.PrimaryKey = new DataColumn[] { dt2.Columns["userid"] };
+                    //DataRow rows = dt1.Rows.Find(item["code"]);
+                    DataRow rows = dt2.Rows.Find(value);
+                    string ObjectId = string.Format(rows["ObjectId"].ToString());
+                    BasicData businessUnit = new BasicData()
+                    {
+                        F0000009 = value,                 //员工ID
+                        F0000001 = dt2.Rows[0]["sys00-name"].ToString().Trim(),        //姓名    sys00-name
+                        F0000010 = dt2.Rows[0]["sys00-mainDeptId"].ToString().Trim(),  //部门ID
+                        F0000002 = dt2.Rows[0]["sys00-mainDept"].ToString().Trim(),  //部门
+                        F0000003 = dt2.Rows[0]["145d3425-9dea-42a6-88ae-1e4e3590046c"].ToString().Trim(),  //所属公司   145d3425-9dea-42a6-88ae-1e4e3590046c
+                        F0000006 = dt2.Rows[0]["sys00-position"].ToString().Trim(),  //岗位  sys00-position
+                        F0000007 = dt2.Rows[0]["sys00-confirmJoinTime"].ToString().Trim(),  //入职时间     
+                        F0000008 = dt2.Rows[0]["sys01-positionLevel"].ToString().Trim(),  //职级     sys01-positionLevel
+                        F0000004 = dt2.Rows[0]["sys05-nowContractStartTime"].ToString().Trim(),  //原合同开始时间
+                        F0000005 = dt2.Rows[0]["sys05-nowContractEndTime"].ToString().Trim(),  //原合同结束时间
+                        F0000012 = dt2.Rows[0]["sys05-contractPeriodType"].ToString().Trim(),  //续签期限  sys05-contractPeriodType
+                        F0000013 = dt2.Rows[0]["sys05-contractRenewCount"].ToString().Trim()   //续签次数  sys05-contractRenewCount
+                    };
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                    ////调用修改方法进行修改
+                    CY_API_Server.UpdateBizObject("UpdateBizObject", "D116604ab3e5ca3a3f944b2bb2db76b67780a2a", ObjectId, dic);
+                }
+                else
+                {
+                    DataTable dt2 = BizObjectId2(json2, value, "");
+                    //dt2.PrimaryKey = new DataColumn[] { dt2.Columns["Code"]};
+                    //DataRow rows = dt2.Rows.Find(dt2.Columns["field_list"]);
+                    //string ObjectId = string.Format(rows["ObjectId"].ToString());
+                    //氚云接口(1.需要实体类 2.数据集合 3.IsSubmit)
+                    BasicData businessUnit = new BasicData()
+                    {
+                        F0000009 = value,                 //员工ID
+                        F0000001 = dt2.Rows[0]["sys00-name"].ToString(),        //姓名    sys00-name
+                        F0000010 = dt2.Rows[0]["sys00-mainDeptId"].ToString(),  //部门ID  
+                        F0000002 = dt2.Rows[0]["sys00-mainDept"].ToString(),  //部门
+                        F0000003 = dt2.Rows[0]["145d3425-9dea-42a6-88ae-1e4e3590046c"].ToString(),  //所属公司   145d3425-9dea-42a6-88ae-1e4e3590046c
+                        F0000006 = dt2.Rows[0]["sys00-position"].ToString(),  //岗位  sys00-position
+                        F0000007 = dt2.Rows[0]["sys00-confirmJoinTime"].ToString(),  //入职时间     
+                        F0000008 = dt2.Rows[0]["sys01-positionLevel"].ToString(),  //职级     sys01-positionLevel
+                        F0000004 = dt2.Rows[0]["sys05-nowContractStartTime"].ToString(),  //原合同开始时间
+                        F0000005 = dt2.Rows[0]["sys05-nowContractEndTime"].ToString(),  //原合同结束时间
+                        F0000012 = dt2.Rows[0]["sys05-contractPeriodType"].ToString(),  //续签期限  sys05-contractPeriodType
+                        F0000013 = dt2.Rows[0]["sys05-contractRenewCount"].ToString()   //续签次数  sys05-contractRenewCount
+                    };
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                    dic.Add("SchemaCode", "D116604ab3e5ca3a3f944b2bb2db76b67780a2a");
+                    dic.Add("IsSubmit", "true");
+                    bool success = false;
+                    ///新增方法
+                    CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                    if (success)
+                    {
+
+                    }
+                    else
+                    {
+                        //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                    }
+                }
+
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+
+
+        }
+
+        /// <summary>
+        /// 钉钉写入氚云-基础资料-人员基础信息
+        /// </summary>
+        /// <param name="json3"></param>
+        public void employee(JObject json3)
+        {
+            try
+            {
+                string value = json3["userid"].ToString();
+                ///调用查询方法判断该表中是否存在该条Code的值
+                string css = CY_API_Server.LoadBizObjects("LoadBizObjects", "D116604d621ec6c5f904694941a255b98aca91b", this.Filter(value, ""));
+                JObject jObject = JsonConvert.DeserializeObject<JObject>(css);
+                if (jObject["Successful"].ToString().ToLower() == "true" && !string.IsNullOrEmpty(jObject["ReturnData"].ToString())) //表示已经存在
+                {
+                    DataTable dt3 = BizObjectId(jObject);
+                    DataTable dt4 = BizObjectId2(json3, value, dt3.Rows[0]["ObjectId"].ToString());
+                    dt4.PrimaryKey = new DataColumn[] { dt4.Columns["userid"] };
+                    //DataRow rows = dt3.Rows.Find(item["code"]);
+                    DataRow rows = dt4.Rows.Find(value);
+                    string ObjectId = string.Format(rows["ObjectId"].ToString());
+                    BasicData businessUnit = new BasicData()
+                    {
+                        F0000009 = value,                 //员工ID
+                        F0000001 = dt4.Rows[0]["sys00-name"].ToString(),        //姓名    sys00-name
+                        F0000005 = dt4.Rows[0]["a66a51a7-dcaa-47da-b056-ccebe6fca72d"].ToString(),
+                        F0000002 = dt4.Rows[0]["145d3425-9dea-42a6-88ae-1e4e3590046c"].ToString(),
+                        F0000003 = dt4.Rows[0]["473f9667-d220-426f-8431-56be1e8a027d"].ToString(),
+                        F0000004 = dt4.Rows[0]["395840c1-2cbe-4f36-b3fb-249d7ddf42f2"].ToString()
+                    };
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                    ////调用修改方法进行修改
+                    CY_API_Server.UpdateBizObject("UpdateBizObject", "D116604d621ec6c5f904694941a255b98aca91b", ObjectId, dic);
+                }
+                else
+                {
+                    DataTable dt4 = BizObjectId2(json3, value, "");
+                    BasicPersonnelInformation businessUnit = new BasicPersonnelInformation()
+                    {
+                        F0000009 = value,                 //员工ID
+                        F0000001 = dt4.Rows[0]["sys00-name"].ToString(),        //姓名    sys00-name
+                        F0000005 = dt4.Rows[0]["a66a51a7-dcaa-47da-b056-ccebe6fca72d"].ToString(),
+                        F0000002 = dt4.Rows[0]["145d3425-9dea-42a6-88ae-1e4e3590046c"].ToString(),
+                        F0000003 = dt4.Rows[0]["473f9667-d220-426f-8431-56be1e8a027d"].ToString(),
+                        F0000004 = dt4.Rows[0]["395840c1-2cbe-4f36-b3fb-249d7ddf42f2"].ToString()
+                    };
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    dic.Add("BizObject", JsonConvert.SerializeObject(businessUnit));
+                    dic.Add("SchemaCode", "D116604d621ec6c5f904694941a255b98aca91b");
+                    dic.Add("IsSubmit", "true");
+                    bool success = false;
+                    ///新增方法
+                    CY_API_Server.H3YunApi("CreateBizObject", dic, out success);
+                    if (success)
+                    {
+
+                    }
+                    else
+                    {
+                        //_Controller.Synchronous_Log("氚云同步失败", "错误原因:氚云错误!");
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+        }
+
+        #endregion
+
+
+        #region 过滤器
+
+
+        public string Filter(string code)
+        {
+            // return "{\"FromRowNum\": -1,\"RequireCount\": 5000,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 5000, \"Matcher\": { \"Type\": \"And\", \"Matchers\": [{\"Name\":\"F0000001\",\"Operator\":2,\"Value\":\""+code+ "\"}]}}";
+            Filter filter = new Filter();  //构建过滤器
+            And andMatcher = new And();    //构造And匹配器                               
+            andMatcher.Add(new ItemMatcher("F0000001", ComparisonOperatorType.Equal, code)); //添加查询条件
+            //andMatcher.Add(new ItemMatcher("ZT", ComparisonOperatorType.Equal, qJ.ZT)); //添加查询条件
+            filter.Matcher = andMatcher;
+            filter.ToRowNum = 500;
+            return H3.BizBus.BizStructureUtility.FilterToJson(filter);
+        }
+
+        public string Filter1(string code)
+        {
+            // return "{\"FromRowNum\": -1,\"RequireCount\": 5000,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 5000, \"Matcher\": { \"Type\": \"And\", \"Matchers\": [{\"Name\":\"F0000001\",\"Operator\":2,\"Value\":\""+code+ "\"}]}}";
+            Filter filter = new Filter();  //构建过滤器
+            And andMatcher = new And();    //构造And匹配器                               
+            andMatcher.Add(new ItemMatcher("F0000002", ComparisonOperatorType.Equal, code)); //添加查询条件
+            //andMatcher.Add(new ItemMatcher("ZT", ComparisonOperatorType.Equal, qJ.ZT)); //添加查询条件
+            filter.Matcher = andMatcher;
+            filter.ToRowNum = 500;
+            return H3.BizBus.BizStructureUtility.FilterToJson(filter);
+        }
+
+        /// <summary>
+        /// 过滤器
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        public string Filter(string code, string organization)
+        {
+            // return "{\"FromRowNum\": -1,\"RequireCount\": 5000,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 5000, \"Matcher\": { \"Type\": \"And\", \"Matchers\": [{\"Name\":\"F0000001\",\"Operator\":2,\"Value\":\""+code+ "\"}]}}";
+            Filter filter = new Filter();  //构建过滤器
+            And andMatcher = new And();    //构造And匹配器                               
+            andMatcher.Add(new ItemMatcher("F0000009", ComparisonOperatorType.Equal, code)); //添加查询条件
+            //andMatcher.Add(new ItemMatcher("F0000010", ComparisonOperatorType.Equal, organization)); //添加查询条件
+            filter.Matcher = andMatcher;
+            filter.ToRowNum = 500;
+            return H3.BizBus.BizStructureUtility.FilterToJson(filter);
+        }
+
+        public DataTable BizObjectId(JObject ResultJson)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("ObjectId", typeof(string));
+            dt.Columns.Add("Code", typeof(string));
+
+            foreach (var item in ResultJson["ReturnData"]["BizObjectArray"])
+            {
+                DataRow dr = dt.NewRow();
+                dr["ObjectId"] = item["ObjectId"].ToString();
+                dr["Code"] = item["F0000001"].ToString();
+                dt.Rows.Add(dr);
+            }
+
+            return dt;
+        }
+
+        public DataTable BizObjectId2(JObject ResultJson)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("ObjectId", typeof(string));
+            dt.Columns.Add("Code", typeof(string));
+
+            foreach (var item in ResultJson["ReturnData"]["BizObjectArray"])
+            {
+                DataRow dr = dt.NewRow();
+                dr["ObjectId"] = item["ObjectId"].ToString();
+                dr["Code"] = item["F0000002"].ToString();
+                dt.Rows.Add(dr);
+            }
+
+            return dt;
+        }
+
+
+
+
+        public DataTable BizObjectId1(JObject ResultJson)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("ObjectId", typeof(string));
+            dt.Columns.Add("orgcode", typeof(string));
+
+            foreach (var item in ResultJson["ReturnData"]["BizObjectArray"])
+            {
+                DataRow dr = dt.NewRow();
+                dr["ObjectId"] = item["ObjectId"].ToString();
+                dr["orgcode"] = item["F0000001"].ToString();
+                dt.Rows.Add(dr);
+            }
+
+            return dt;
+        }
+
+        public DataTable BizObjectId2(JObject ResultJson, string value, string ObjectId)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("ObjectId", typeof(string));
+            foreach (var items in ResultJson["field_list"])
+            {
+                if (!dt.Columns.Contains(items["field_code"].ToString()))
+                    dt.Columns.Add(items["field_code"].ToString(), typeof(string));
+            }
+            dt.Columns.Add("userid", typeof(string));
+            DataRow dr = dt.NewRow();
+            int i = 0;
+            dr["ObjectId"] = ObjectId;
+            foreach (var item in ResultJson["field_list"])
+            {
+                long mun = ResultJson["field_list"][i].LongCount();
+                if (mun < 4)
+                {
+                    dr[item["field_code"].ToString()] = null;
+                }
+                else
+                {
+                    dr[item["field_code"].ToString()] = item["label"].ToString();
+                }
+                i++;
+            }
+            dr["userid"] = value;
+            dt.Rows.Add(dr);
+
+            return dt;
+        }
+
+        #endregion
+
+    }
+}

+ 326 - 0
Controller/DDing_API/DingdingAPI.cs

@@ -0,0 +1,326 @@
+using ConsoleApp1.Controller.Sql_controller;
+using DingTalk.Api;
+using DingTalk.Api.Request;
+using DingTalk.Api.Response;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.DDing_API
+{
+    /// <summary>
+    /// 钉钉接口类
+    /// </summary>
+    public class DingdingAPI
+    {
+        private DateTime dtttime;
+        private static HttpHepler http = new HttpHepler();
+
+        //房德
+        //AUTHCORPID(被授权方(房德)corpid)
+        //private static String auth_corpid = "ding81b4dfad3a436bd735c2f4657eb6378f";
+        //CUSTOMKEY
+        private static String accessKey = "dingrfl7dbbgi0t1ygdl";
+        //CUSTOMSECTET
+        private static String accessSecret = "ocqGE5j-fW4yHIdqV2CLH8vTBY34EEoRT-FRh_wPO9uvvZoDDbrUFKdYcdXby1gB";
+
+        private static string access_token = "";
+
+        private static string agentid = "1109021768";
+
+        /// <summary>
+        /// 获取Token
+        /// </summary>
+        /// <returns></returns>·
+        public string getAccessToken()
+        {
+            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
+            OapiGettokenRequest req = new OapiGettokenRequest();
+            req.Appkey = accessKey;
+            req.Appsecret = accessSecret;
+            req.SetHttpMethod("GET");
+            OapiGettokenResponse rsp = client.Execute(req, access_token);
+            Console.WriteLine(rsp.Body);
+
+            JObject json = JsonConvert.DeserializeObject<JObject>(rsp.Body.ToString());
+            access_token = json["access_token"].ToString();
+            return access_token;
+        }
+
+        public string dttoken()
+        {
+            if (dtttime.ToString() == "0001/1/1 0:00:00")
+            {
+                dtttime = DateTime.Now;
+                access_token = getAccessToken();
+            }
+            if (dtttime.ToString() != "0001/1/1 0:00:00" && (dtttime.AddHours(2) < dtttime))
+            {
+                access_token = getAccessToken();
+            }
+            return access_token;
+        }
+
+        /// <summary>
+        /// 获取企业授权信息
+        /// </summary>
+        /// <returns></returns>
+        //public string get_auth_info()
+        //{
+        //    IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/service/get_auth_info");
+        //    OapiServiceGetAuthInfoRequest req = new OapiServiceGetAuthInfoRequest();
+        //    req.AuthCorpid = "ding81b4dfad3a436bd735c2f4657eb6378f";
+        //    OapiServiceGetAuthInfoResponse rsp = client.Execute(req, accessKey, accessSecret, suiteTicket);
+        //    JObject json = JsonConvert.DeserializeObject<JObject>(rsp.Body.ToString());
+        //    //string aaa = json["auth_corp_info"]["corpid"].ToString();
+        //    agentid = json["auth_info"]["agent"][0]["agentid"].ToString();
+
+        //    return agentid;
+        //}
+
+        /// <summary>
+        /// 获取花名册元数据
+        /// </summary>
+        /// <returns></returns>
+        public string smartwork(string token)
+        {
+            string url = "https://oapi.dingtalk.com/topapi/smartwork/hrm/roster/meta/get?access_token=" + token;
+            string dictionary = "{\"agentid\"" + ":" + "\"" + agentid + "\"}";
+            var str = http.HttpPost(url, dictionary);
+            return str.ToString();
+        }
+
+
+
+        /// <summary>
+        /// 更新员工花名册信息
+        /// </summary>
+        /// <returns></returns>
+        public string employee(Dictionary<string, object> dic)
+        {
+            try
+            {
+                IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/update");
+                OapiV2UserUpdateRequest req = new OapiV2UserUpdateRequest();
+                req.Userid = dic["F0000019"].ToString();
+                req.Title = dic["F0000011"].ToString();
+                req.DeptIdList = dic["F0000009"].ToString();
+                List<OapiV2UserUpdateRequest.DeptOrderDomain> list2 = new List<OapiV2UserUpdateRequest.DeptOrderDomain>();
+                OapiV2UserUpdateRequest.DeptOrderDomain obj3 = new OapiV2UserUpdateRequest.DeptOrderDomain();
+                list2.Add(obj3);
+                obj3.DeptId = Convert.ToInt32(dic["F0000009"].ToString());
+                obj3.Order = 1L;
+                req.DeptOrderList_ = list2;
+                List<OapiV2UserUpdateRequest.DeptTitleDomain> list5 = new List<OapiV2UserUpdateRequest.DeptTitleDomain>();
+                OapiV2UserUpdateRequest.DeptTitleDomain obj6 = new OapiV2UserUpdateRequest.DeptTitleDomain();
+                list5.Add(obj6);
+                obj6.DeptId = Convert.ToInt32(dic["F0000009"].ToString());
+                obj6.Title = dic["F0000010"].ToString();
+                req.DeptTitleList_ = list5;
+                OapiV2UserUpdateResponse rsp = client.Execute(req, access_token);
+                Console.WriteLine(rsp.Body);
+                return rsp.Body;
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+
+        }
+
+        /// <summary>
+        /// 更新花名册信息
+        /// </summary>
+        /// <param name="Userid">Userid</param>
+        /// <param name="GroupId">GroupId</param>
+        /// <param name="Value">值</param>
+        /// <param name="FieldCode">Code</param>
+        /// <returns></returns>
+        public string employee(string Userid, string GroupId, string Value, string FieldCode)
+        {
+            try
+            {
+                IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/v2/update");
+                OapiSmartworkHrmEmployeeV2UpdateRequest req = new OapiSmartworkHrmEmployeeV2UpdateRequest();
+                req.Agentid = 1041506050L;
+                OapiSmartworkHrmEmployeeV2UpdateRequest.EmpUpdateByCustomParamDomain obj1 = new OapiSmartworkHrmEmployeeV2UpdateRequest.EmpUpdateByCustomParamDomain();
+                List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpGroupFieldVoDomain> list3 = new List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpGroupFieldVoDomain>();
+                OapiSmartworkHrmEmployeeV2UpdateRequest.EmpGroupFieldVoDomain obj4 = new OapiSmartworkHrmEmployeeV2UpdateRequest.EmpGroupFieldVoDomain();
+                list3.Add(obj4);
+                List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpListFieldVoDomain> list6 = new List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpListFieldVoDomain>();
+                OapiSmartworkHrmEmployeeV2UpdateRequest.EmpListFieldVoDomain obj7 = new OapiSmartworkHrmEmployeeV2UpdateRequest.EmpListFieldVoDomain();
+                list6.Add(obj7);
+                List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpFieldVoDomain> list9 = new List<OapiSmartworkHrmEmployeeV2UpdateRequest.EmpFieldVoDomain>();
+                OapiSmartworkHrmEmployeeV2UpdateRequest.EmpFieldVoDomain obj10 = new OapiSmartworkHrmEmployeeV2UpdateRequest.EmpFieldVoDomain();
+                list9.Add(obj10);
+                obj10.FieldCode = FieldCode;
+                obj10.Value = Value;
+                obj7.Section = list9;
+                obj4.Sections = list6;
+                obj4.GroupId = GroupId;
+                obj1.Groups = list3;
+                obj1.Userid = Userid;
+                req.Param_ = obj1;
+                OapiSmartworkHrmEmployeeV2UpdateResponse rsp = client.Execute(req, access_token);
+                Console.WriteLine(rsp.Body);
+                return rsp.Body;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+        }
+
+        public string The_Contract(Dictionary<string, object> dic)
+        {
+            string FieldCode = "", Value = "", Userid = dic["F0000014"].ToString();
+            try
+            {
+                foreach (var item in dic.Keys)
+                {
+                    switch (item)
+                    {
+                        case "F0000010":        //现合同开始日期
+
+                            FieldCode = "sys05-nowContractStartTime";
+                            Value = dic["F0000010"].ToString();
+                            The_Contract(Userid, Value, FieldCode);
+                            break;
+                        case "F0000011":        //现合同结束日期
+                            FieldCode = "sys05-nowContractEndTime";
+                            Value = dic["F0000011"].ToString();
+                            The_Contract(Userid, Value, FieldCode);
+                            break;
+                        case "F0000026":        //续签期限
+                            FieldCode = "sys05-contractPeriodType";
+                            Value = dic["F0000026"].ToString();
+                            switch (Value)
+                            {
+                                case "无":
+                                    Value = "1";
+                                    break;
+                                case "6个月":
+                                    Value = "2";
+                                    break;
+                                case "12个月":
+                                    Value = "3";
+                                    break;
+                                case "24个月":
+                                    Value = "4";
+                                    break;
+                                case "36个月或以上":
+                                    Value = "5";
+                                    break;
+                                default:
+                                    break;
+                            }
+                            The_Contract(Userid, Value, FieldCode);
+                            break;
+                        case "F0000016":               //续签次数
+                            FieldCode = "sys05-contractRenewCount";
+                            Value = dic["F0000016"].ToString();
+                            The_Contract(Userid, Value, FieldCode);
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                return "Ok";
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+        }
+
+        /// <summary>
+        /// 更新花名册信息
+        /// </summary>
+        /// <returns></returns>
+        public string The_Contract(string Userid, string value, string FieldCode)
+        {
+            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/update");
+            OapiSmartworkHrmEmployeeUpdateRequest req = new OapiSmartworkHrmEmployeeUpdateRequest();
+            OapiSmartworkHrmEmployeeUpdateRequest.PreEntryEmployeeAddParamDomain obj1 = new OapiSmartworkHrmEmployeeUpdateRequest.PreEntryEmployeeAddParamDomain();
+            obj1.Userid = Userid;
+            List<OapiSmartworkHrmEmployeeUpdateRequest.GroupMetaInfoDomain> list3 = new List<OapiSmartworkHrmEmployeeUpdateRequest.GroupMetaInfoDomain>();
+            OapiSmartworkHrmEmployeeUpdateRequest.GroupMetaInfoDomain obj4 = new OapiSmartworkHrmEmployeeUpdateRequest.GroupMetaInfoDomain();
+            list3.Add(obj4);
+            obj4.GroupId = "sys05";
+            List<OapiSmartworkHrmEmployeeUpdateRequest.EmpListFieldVODomain> list6 = new List<OapiSmartworkHrmEmployeeUpdateRequest.EmpListFieldVODomain>();
+            OapiSmartworkHrmEmployeeUpdateRequest.EmpListFieldVODomain obj7 = new OapiSmartworkHrmEmployeeUpdateRequest.EmpListFieldVODomain();
+            list6.Add(obj7);
+            List<OapiSmartworkHrmEmployeeUpdateRequest.EmpFieldVoDomain> list9 = new List<OapiSmartworkHrmEmployeeUpdateRequest.EmpFieldVoDomain>();
+            OapiSmartworkHrmEmployeeUpdateRequest.EmpFieldVoDomain obj10 = new OapiSmartworkHrmEmployeeUpdateRequest.EmpFieldVoDomain();
+            list9.Add(obj10);
+            obj10.Value = value;
+            obj10.FieldCode = FieldCode;     //起始日
+            obj7.Section = list9;
+            obj4.Sections = list6;
+            obj1.Groups = list3;
+            req.Param_ = obj1;
+            req.Agentid = Convert.ToInt32(agentid);
+            OapiSmartworkHrmEmployeeUpdateResponse rsp = client.Execute(req, access_token);
+            Console.WriteLine(rsp.Body);
+            return rsp.Body;
+        }
+
+
+        /// <summary>
+        /// 批量获取员工花名册字段信息
+        /// </summary>
+        /// <param name="access_token">Token</param>
+        /// <param name="userid_list">员工ID列表-最长长度20</param>
+        /// <returns></returns>
+        public string smartwork_list(string access_token, string userid_list, string field_filter_list)
+        {
+            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/list");
+            OapiSmartworkHrmEmployeeListRequest req = new OapiSmartworkHrmEmployeeListRequest();
+            req.UseridList = userid_list;
+            //req.FieldFilterList = field_filter_list.ToString();
+            OapiSmartworkHrmEmployeeListResponse rsp = client.Execute(req, access_token);
+            return rsp.Body;
+        }
+
+        /// <summary>
+        /// 查询公司在职员工列表       
+        /// </summary>
+        /// <param name="access_token">Token</param>
+        /// <param name="status_list">员工状态</param>
+        /// <param name="offset">分页起始值</param>
+        /// <param name="size">分页大小</param>
+        /// <returns>UserId 员工ID</returns>
+        public string smartwork_smartwork(string access_token, string status_list = "2,3,5,-1", int offset = 0, int size = 50)
+        {
+            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
+            OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
+            req.StatusList = "2,3,5,-1";
+            req.Offset = offset;
+            req.Size = size;
+            OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.Execute(req, access_token);
+            return rsp.Body;
+        }
+
+        /// <summary>
+        /// 智能人事获取员工花名册信息
+        /// </summary>
+        /// <returns></returns>
+        public string listemployee(string userid)
+        {
+            IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/v2/list");
+            OapiSmartworkHrmEmployeeV2ListRequest req = new OapiSmartworkHrmEmployeeV2ListRequest();
+            req.UseridList = userid;
+            req.Agentid = Convert.ToInt32(agentid);
+            OapiSmartworkHrmEmployeeV2ListResponse rsp = client.Execute(req, access_token);
+            //Console.WriteLine(rsp.Body);
+            return rsp.Body;
+        }
+    }
+}

+ 88 - 0
Controller/DDing_API/InTheMiddle.cs

@@ -0,0 +1,88 @@
+using ConsoleApp1.Controller.CY_API;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.DDing_API
+{
+    public class InTheMiddle
+    {
+        private DingdingAPI Ding = new DingdingAPI();
+        private CY_NC_Api _cy = new CY_NC_Api();
+        private string employee = "";
+        /// <summary>
+        /// 更新智能人事花名册信息
+        /// </summary>
+        /// <returns></returns>
+        public string smartworks(Dictionary<string, object> dic)
+        {
+            string token = Ding.dttoken();
+
+            //string agentid = Ding.get_auth_info();
+
+            string smartwork = Ding.smartwork(token);
+
+            if (dic.LongCount() == 4)
+            {
+                employee = Ding.employee(dic);
+            }
+            else if (dic.LongCount() == 5)
+            {
+                employee = Ding.The_Contract(dic);
+            }
+            return employee;
+
+        }
+
+        /// <summary>
+        /// 获取员工信息并更新至氚云
+        /// </summary>
+        /// <returns></returns>
+        public string Update_smartwork()
+        {
+            try
+            {
+                string access_token = Ding.dttoken();
+                //if (string.IsNullOrEmpty(access_token))
+                //{
+                    access_token = Ding.dttoken();
+                //}
+                int offset = 0, size = 50; string userid_list; int next_cursor;
+                //string field_filter_list = "sys00-name, sys00-mainDeptId, sys00-mainDept,sys05-nowContractStartTime, sys05-nowContractEndTime, sys00-position, sys00-confirmJoinTime, sys01-positionLevel,sys05-contractPeriodType, sys05-contractRenewCount, userid";
+                do
+                {
+                    string queryonjob = Ding.smartwork_smartwork(access_token, "2,3,5,-1", offset, size);
+                    JObject json = JsonConvert.DeserializeObject<JObject>(queryonjob.ToString());
+                    next_cursor = json["result"]["data_list"].Count();
+                    //next_cursor = json["result"]["next_cursor"].ToString()!= null  || json["result"]["next_cursor"].ToString() != "" ? Convert.ToInt32(json["result"]["next_cursor"]) : 0;
+
+                    userid_list = json["result"]["data_list"].ToString().Replace("[", "").Replace("\"", "").Replace("]", "").Trim();
+                    //string value1 = Ding.listemployee(userid_list);
+
+                    string value = Ding.smartwork_list(access_token, userid_list, null);
+
+                    JObject json1 = JsonConvert.DeserializeObject<JObject>(value);
+                    foreach (var item in json1["result"])
+                    {
+                        JObject json2 = JsonConvert.DeserializeObject<JObject>(item.ToString());
+                        _cy.employee(json2);
+                        _cy.Basic(json2);
+                    }
+                    offset = offset + size;
+                } while (next_cursor >= 50);
+
+                return "OK";
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+
+        }
+    }
+}

+ 994 - 0
Controller/Sql_controller/DB_Helper.cs

@@ -0,0 +1,994 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Web;
+
+namespace CY_dingDing.Controller.Sql_controller
+{
+    public class DB_Helper
+    {
+        //数据库连接字符串(web.config来配置),多数据库可使用DbHelperSQLP来实现.
+
+
+        public static string constr = "Data Source=47.99.48.105;Initial Catalog=DingLog;User ID = sa; password = SAsa51021535";
+        //public static string constr = "Data Source = 47.101.188.12; Initial Catalog = Intelligent_Personnel; User ID = sa; password = Yunpu@2020";
+
+
+        private static string connectionString = constr; /*ConfigurationManager.ConnectionStrings["strCon"].ConnectionString;*/
+        //private static string connectionString1 = ConfigurationManager.ConnectionStrings["strCon1"].ConnectionString;
+        public DB_Helper()
+        {
+            connectionString = constr; //ConfigurationManager.ConnectionStrings["strCon1"].ConnectionString;
+            //connectionString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
+        }
+
+        #region 公用方法
+        /// <summary>
+        /// 判断是否存在某表的某个字段
+        /// </summary>
+        /// <param name="tableName">表名称</param>
+        /// <param name="columnName">列名称</param>
+        /// <returns>是否存在</returns>
+        public static bool ColumnExists(string tableName, string columnName)
+        {
+            string sql = "select count(1) from syscolumns where [id]=object_id('" + tableName + "') and [name]='" + columnName + "'";
+            object res = GetSingle(sql);
+            if (res == null)
+            {
+                return false;
+            }
+            return Convert.ToInt32(res) > 0;
+        }
+        public static int GetMaxID(string FieldName, string TableName)
+        {
+            string strsql = "select max(" + FieldName + ")+1 from " + TableName;
+            object obj = GetSingle(strsql);
+            if (obj == null)
+            {
+                return 1;
+            }
+            else
+            {
+                return int.Parse(obj.ToString());
+            }
+        }
+        public static bool Exists(string strSql)
+        {
+            object obj = GetSingle(strSql);
+            int cmdresult;
+            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+            {
+                cmdresult = 0;
+            }
+            else
+            {
+                cmdresult = int.Parse(obj.ToString()); //也可能=0
+            }
+            if (cmdresult == 0)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        /// <summary>
+        /// 表是否存在
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <returns></returns>
+        public static bool TabExists(string TableName)
+        {
+            string strsql = "select count(*) from sysobjects where id = object_id(N'[" + TableName + "]') and OBJECTPROPERTY(id, N'IsUserTable') = 1";
+            //string strsql = "SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[" + TableName + "]') AND type in (N'U')";
+            object obj = GetSingle(strsql);
+            int cmdresult;
+            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+            {
+                cmdresult = 0;
+            }
+            else
+            {
+                cmdresult = int.Parse(obj.ToString());
+            }
+            if (cmdresult == 0)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        public static bool Exists(string strSql, params SqlParameter[] cmdParms)
+        {
+            object obj = GetSingle(strSql, cmdParms);
+            int cmdresult;
+            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+            {
+                cmdresult = 0;
+            }
+            else
+            {
+                cmdresult = int.Parse(obj.ToString());
+            }
+            if (cmdresult == 0)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        #endregion
+
+        #region  执行简单SQL语句
+
+        /// <summary>
+        /// 执行SQL语句,返回影响的记录数
+        /// </summary>
+        /// <param name="SQLString">SQL语句</param>
+        /// <returns>影响的记录数</returns>
+        public static int ExecuteSql(string SQLString)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand(SQLString, connection))
+                {
+                    try
+                    {
+                        connection.Open();
+                        int rows = cmd.ExecuteNonQuery();
+                        return rows;
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        connection.Close();
+                        throw e;
+                    }
+                }
+            }
+        }
+
+        public static int ExecuteSqlByTime(string SQLString, int Times)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand(SQLString, connection))
+                {
+                    try
+                    {
+                        connection.Open();
+                        cmd.CommandTimeout = Times;
+                        int rows = cmd.ExecuteNonQuery();
+                        return rows;
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        connection.Close();
+                        throw e;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 执行多条SQL语句,实现数据库事务。
+        /// </summary>
+        /// <param name="SQLStringList">多条SQL语句</param>        
+        public static int ExecuteSqlTran(List<String> SQLStringList)
+        {
+            using (SqlConnection conn = new SqlConnection(connectionString))
+            {
+                conn.Open();
+                SqlCommand cmd = new SqlCommand();
+                cmd.Connection = conn;
+                SqlTransaction tx = conn.BeginTransaction();
+                cmd.Transaction = tx;
+                try
+                {
+                    int count = 0;
+                    for (int n = 0; n < SQLStringList.Count; n++)
+                    {
+                        string strsql = SQLStringList[n];
+                        if (strsql.Trim().Length > 1)
+                        {
+                            cmd.CommandText = strsql;
+                            count += cmd.ExecuteNonQuery();
+                        }
+                    }
+                    tx.Commit();
+                    return count;
+                }
+                catch
+                {
+                    tx.Rollback();
+                    return 0;
+                }
+            }
+        }
+        /// <summary>
+        /// 执行带一个存储过程参数的的SQL语句。
+        /// </summary>
+        /// <param name="SQLString">SQL语句</param>
+        /// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
+        /// <returns>影响的记录数</returns>
+        public static int ExecuteSql(string SQLString, string content)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                SqlCommand cmd = new SqlCommand(SQLString, connection);
+                System.Data.SqlClient.SqlParameter myParameter = new System.Data.SqlClient.SqlParameter("@content", SqlDbType.NText);
+                myParameter.Value = content;
+                cmd.Parameters.Add(myParameter);
+                try
+                {
+                    connection.Open();
+                    int rows = cmd.ExecuteNonQuery();
+                    return rows;
+                }
+                catch (System.Data.SqlClient.SqlException e)
+                {
+                    throw e;
+                }
+                finally
+                {
+                    cmd.Dispose();
+                    connection.Close();
+                }
+            }
+        }
+        /// <summary>
+        /// 执行带一个存储过程参数的的SQL语句。
+        /// </summary>
+        /// <param name="SQLString">SQL语句</param>
+        /// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
+        /// <returns>影响的记录数</returns>
+        public static object ExecuteSqlGet(string SQLString, string content)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                SqlCommand cmd = new SqlCommand(SQLString, connection);
+                System.Data.SqlClient.SqlParameter myParameter = new System.Data.SqlClient.SqlParameter("@content", SqlDbType.NText);
+                myParameter.Value = content;
+                cmd.Parameters.Add(myParameter);
+                try
+                {
+                    connection.Open();
+                    object obj = cmd.ExecuteScalar();
+                    if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+                    {
+                        return null;
+                    }
+                    else
+                    {
+                        return obj;
+                    }
+                }
+                catch (System.Data.SqlClient.SqlException e)
+                {
+                    throw e;
+                }
+                finally
+                {
+                    cmd.Dispose();
+                    connection.Close();
+                }
+            }
+        }
+        /// <summary>
+        /// 向数据库里插入图像格式的字段(和上面情况类似的另一种实例)
+        /// </summary>
+        /// <param name="strSQL">SQL语句</param>
+        /// <param name="fs">图像字节,数据库的字段类型为image的情况</param>
+        /// <returns>影响的记录数</returns>
+        public static int ExecuteSqlInsertImg(string strSQL, byte[] fs)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                SqlCommand cmd = new SqlCommand(strSQL, connection);
+                System.Data.SqlClient.SqlParameter myParameter = new System.Data.SqlClient.SqlParameter("@fs", SqlDbType.Image);
+                myParameter.Value = fs;
+                cmd.Parameters.Add(myParameter);
+                try
+                {
+                    connection.Open();
+                    int rows = cmd.ExecuteNonQuery();
+                    return rows;
+                }
+                catch (System.Data.SqlClient.SqlException e)
+                {
+                    throw e;
+                }
+                finally
+                {
+                    cmd.Dispose();
+                    connection.Close();
+                }
+            }
+        }
+
+        /// <summary>
+        /// 执行一条计算查询结果语句,返回查询结果(object)。
+        /// </summary>
+        /// <param name="SQLString">计算查询结果语句</param>
+        /// <returns>查询结果(object)</returns>
+        public static object GetSingle(string SQLString)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand(SQLString, connection))
+                {
+                    try
+                    {
+                        connection.Open();
+                        object obj = cmd.ExecuteScalar();
+                        if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+                        {
+                            return null;
+                        }
+                        else
+                        {
+                            return obj;
+                        }
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        connection.Close();
+                        throw e;
+                    }
+                }
+            }
+        }
+        public static object GetSingle(string SQLString, int Times)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand(SQLString, connection))
+                {
+                    try
+                    {
+                        connection.Open();
+                        cmd.CommandTimeout = Times;
+                        object obj = cmd.ExecuteScalar();
+                        if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+                        {
+                            return null;
+                        }
+                        else
+                        {
+                            return obj;
+                        }
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        connection.Close();
+                        throw e;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+         /// 执行查询语句,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )
+        /// </summary>
+        /// <param name="strSQL">查询语句</param>
+        /// <returns>SqlDataReader</returns>
+        public static SqlDataReader ExecuteReader(string strSQL)
+        {
+            SqlConnection connection = new SqlConnection(connectionString);
+            SqlCommand cmd = new SqlCommand(strSQL, connection);
+            try
+            {
+                connection.Open();
+                SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
+                return myReader;
+            }
+            catch (System.Data.SqlClient.SqlException e)
+            {
+                throw e;
+            }
+
+        }
+        /// <summary>
+        /// 执行查询语句,返回DataSet
+        /// </summary>
+        /// <param name="SQLString">查询语句</param>
+        /// <returns>DataSet</returns>
+        public static DataSet Query(string SQLString)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                DataSet ds = new DataSet();
+                try
+                {
+                    connection.Open();
+                    SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
+                    command.Fill(ds, "ds");
+                }
+                catch (System.Data.SqlClient.SqlException ex)
+                {
+                    throw new Exception(ex.Message);
+                }
+                return ds;
+            }
+        }
+        public static DataSet Query(string SQLString, int Times)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                DataSet ds = new DataSet();
+                try
+                {
+                    connection.Open();
+                    SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
+                    command.SelectCommand.CommandTimeout = Times;
+                    command.Fill(ds, "ds");
+                }
+                catch (System.Data.SqlClient.SqlException ex)
+                {
+                    throw new Exception(ex.Message);
+                }
+                return ds;
+            }
+        }
+
+
+
+        #endregion
+
+        #region 执行带参数的SQL语句
+
+        /// <summary>
+        /// 执行SQL语句,返回影响的记录数
+        /// </summary>
+        /// <param name="SQLString">SQL语句</param>
+        /// <returns>影响的记录数</returns>
+        public static int ExecuteSql(string SQLString, params SqlParameter[] cmdParms)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand())
+                {
+                    try
+                    {
+                        PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+                        int rows = cmd.ExecuteNonQuery();
+                        cmd.Parameters.Clear();
+                        return rows;
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        throw e;
+                    }
+                }
+            }
+        }
+
+
+        /// <summary>
+        /// 执行多条SQL语句,实现数据库事务。
+        /// </summary>
+        /// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])</param>
+        public static void ExecuteSqlTran(Hashtable SQLStringList)
+        {
+            using (SqlConnection conn = new SqlConnection(connectionString))
+            {
+                conn.Open();
+                using (SqlTransaction trans = conn.BeginTransaction())
+                {
+                    SqlCommand cmd = new SqlCommand();
+                    try
+                    {
+                        //循环
+                        foreach (DictionaryEntry myDE in SQLStringList)
+                        {
+                            string cmdText = myDE.Key.ToString();
+                            SqlParameter[] cmdParms = (SqlParameter[])myDE.Value;
+                            PrepareCommand(cmd, conn, trans, cmdText, cmdParms);
+                            int val = cmd.ExecuteNonQuery();
+                            cmd.Parameters.Clear();
+                        }
+                        trans.Commit();
+                    }
+                    catch
+                    {
+                        trans.Rollback();
+                        throw;
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// 执行多条SQL语句,实现数据库事务。
+        /// </summary>
+        /// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])</param>
+        public static void ExecuteSqlTranWithIndentity(Hashtable SQLStringList)
+        {
+            using (SqlConnection conn = new SqlConnection(connectionString))
+            {
+                conn.Open();
+                using (SqlTransaction trans = conn.BeginTransaction())
+                {
+                    SqlCommand cmd = new SqlCommand();
+                    try
+                    {
+                        int indentity = 0;
+                        //循环
+                        foreach (DictionaryEntry myDE in SQLStringList)
+                        {
+                            string cmdText = myDE.Key.ToString();
+                            SqlParameter[] cmdParms = (SqlParameter[])myDE.Value;
+                            foreach (SqlParameter q in cmdParms)
+                            {
+                                if (q.Direction == ParameterDirection.InputOutput)
+                                {
+                                    q.Value = indentity;
+                                }
+                            }
+                            PrepareCommand(cmd, conn, trans, cmdText, cmdParms);
+                            int val = cmd.ExecuteNonQuery();
+                            foreach (SqlParameter q in cmdParms)
+                            {
+                                if (q.Direction == ParameterDirection.Output)
+                                {
+                                    indentity = Convert.ToInt32(q.Value);
+                                }
+                            }
+                            cmd.Parameters.Clear();
+                        }
+                        trans.Commit();
+                    }
+                    catch
+                    {
+                        trans.Rollback();
+                        throw;
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// 执行一条计算查询结果语句,返回查询结果(object)。
+        /// </summary>
+        /// <param name="SQLString">计算查询结果语句</param>
+        /// <returns>查询结果(object)</returns>
+        public static object GetSingle(string SQLString, params SqlParameter[] cmdParms)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                using (SqlCommand cmd = new SqlCommand())
+                {
+                    try
+                    {
+                        PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+                        object obj = cmd.ExecuteScalar();
+                        cmd.Parameters.Clear();
+                        if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+                        {
+                            return null;
+                        }
+                        else
+                        {
+                            return obj;
+                        }
+                    }
+                    catch (System.Data.SqlClient.SqlException e)
+                    {
+                        throw e;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 执行查询语句,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )
+        /// </summary>
+        /// <param name="strSQL">查询语句</param>
+        /// <returns>SqlDataReader</returns>
+        /// 
+
+        public static SqlDataReader ExecuteReader(string SQLString, params SqlParameter[] cmdParms)
+        {
+            SqlConnection connection = new SqlConnection(connectionString);
+            SqlCommand cmd = new SqlCommand();
+            try
+            {
+                PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+                SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
+                cmd.Parameters.Clear();
+                return myReader;
+            }
+            catch (System.Data.SqlClient.SqlException e)
+            {
+                throw e;
+            }
+            //            finally
+            //            {
+            //                cmd.Dispose();
+            //                connection.Close();
+            //            }    
+
+        }
+
+        /// <summary>
+        /// 执行查询语句,返回DataSet
+        /// </summary>
+        /// <param name="SQLString">查询语句</param>
+        /// <returns>DataSet</returns>
+        /// 
+        public static DataSet Query(string SQLString, params SqlParameter[] cmdParms)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                SqlCommand cmd = new SqlCommand();
+                PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
+                {
+                    DataSet ds = new DataSet();
+                    try
+                    {
+                        da.Fill(ds, "ds");
+                        cmd.Parameters.Clear();
+                    }
+                    catch (System.Data.SqlClient.SqlException ex)
+                    {
+                        throw new Exception(ex.Message);
+                    }
+                    return ds;
+                }
+            }
+        }
+
+
+        private static void PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, string cmdText, SqlParameter[] cmdParms)
+        {
+            if (conn.State != ConnectionState.Open)
+                conn.Open();
+            cmd.Connection = conn;
+            cmd.CommandText = cmdText;
+            if (trans != null)
+                cmd.Transaction = trans;
+            cmd.CommandType = CommandType.Text;//cmdType;
+            if (cmdParms != null)
+            {
+
+
+                foreach (SqlParameter parameter in cmdParms)
+                {
+                    if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
+                        (parameter.Value == null))
+                    {
+                        parameter.Value = DBNull.Value;
+                    }
+                    cmd.Parameters.Add(parameter);
+                }
+            }
+        }
+
+        #endregion
+
+        #region 存储过程操作
+
+        /// <summary>
+        /// 执行存储过程,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )
+        /// </summary>
+        /// <param name="storedProcName">存储过程名</param>
+        /// <param name="parameters">存储过程参数</param>
+        /// <returns>SqlDataReader</returns>
+        public static SqlDataReader RunProcedure(string storedProcName, IDataParameter[] parameters)
+        {
+            SqlConnection connection = new SqlConnection(connectionString);
+            SqlDataReader returnReader;
+            connection.Open();
+            SqlCommand command = BuildQueryCommand(connection, storedProcName, parameters);
+            command.CommandType = CommandType.StoredProcedure;
+            returnReader = command.ExecuteReader(CommandBehavior.CloseConnection);
+            return returnReader;
+
+        }
+
+
+        /// <summary>
+        /// 执行存储过程
+        /// </summary>
+        /// <param name="storedProcName">存储过程名</param>
+        /// <param name="parameters">存储过程参数</param>
+        /// <param name="tableName">DataSet结果中的表名</param>
+        /// <returns>DataSet</returns>
+        public static DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                DataSet dataSet = new DataSet();
+                connection.Open();
+                SqlDataAdapter sqlDA = new SqlDataAdapter();
+                sqlDA.SelectCommand = BuildQueryCommand(connection, storedProcName, parameters);
+                sqlDA.Fill(dataSet, tableName);
+                connection.Close();
+                return dataSet;
+            }
+        }
+        public static DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName, int Times)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                DataSet dataSet = new DataSet();
+                connection.Open();
+                SqlDataAdapter sqlDA = new SqlDataAdapter();
+                sqlDA.SelectCommand = BuildQueryCommand(connection, storedProcName, parameters);
+                sqlDA.SelectCommand.CommandTimeout = Times;
+                sqlDA.Fill(dataSet, tableName);
+                connection.Close();
+                return dataSet;
+            }
+        }
+
+
+        /// <summary>
+        /// 构建 SqlCommand 对象(用来返回一个结果集,而不是一个整数值)
+        /// </summary>
+        /// <param name="connection">数据库连接</param>
+        /// <param name="storedProcName">存储过程名</param>
+        /// <param name="parameters">存储过程参数</param>
+        /// <returns>SqlCommand</returns>
+        private static SqlCommand BuildQueryCommand(SqlConnection connection, string storedProcName, IDataParameter[] parameters)
+        {
+            SqlCommand command = new SqlCommand(storedProcName, connection);
+            command.CommandType = CommandType.StoredProcedure;
+            foreach (SqlParameter parameter in parameters)
+            {
+                if (parameter != null)
+                {
+                    // 检查未分配值的输出参数,将其分配以DBNull.Value.
+                    if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
+                        (parameter.Value == null))
+                    {
+                        parameter.Value = DBNull.Value;
+                    }
+                    command.Parameters.Add(parameter);
+                }
+            }
+
+            return command;
+        }
+
+        /// <summary>
+        /// 执行存储过程,返回影响的行数        
+        /// </summary>
+        /// <param name="storedProcName">存储过程名</param>
+        /// <param name="parameters">存储过程参数</param>
+        /// <param name="rowsAffected">影响的行数</param>
+        /// <returns></returns>
+        public static int RunProcedure(string storedProcName, IDataParameter[] parameters, out int rowsAffected)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                int result;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+                rowsAffected = command.ExecuteNonQuery();
+                result = (int)command.Parameters["ReturnValue"].Value;
+                //Connection.Close();
+                return result;
+            }
+        }
+
+        public static int RunProcedureXima_Gp_InsertK(string storedProcName, IDataParameter[] parameters)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                int kid;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+                command.ExecuteNonQuery();
+                kid = (int)command.Parameters["ReturnValue"].Value;
+                //Connection.Close();
+                return kid;
+            }
+        }
+
+
+        public static string RunProcedure_CreatePtype(string storedProcName, IDataParameter[] parameters, out int rowsAffected)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                string result;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+                // command.Parameters["ReturnValue"].SqlDbType = SqlDbType.VarChar; 
+                command.Parameters["ReturnValue"].DbType = DbType.String;
+                rowsAffected = command.ExecuteNonQuery();
+
+                result = command.Parameters["ReturnValue"].Value.ToString();
+                //Connection.Close();
+                return result;
+            }
+        }
+        public static string RunProcedure_UpdatePtype(string storedProcName, IDataParameter[] parameters, out int rowsAffected)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                string result;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+                // command.Parameters["ReturnValue"].SqlDbType = SqlDbType.VarChar; 
+                command.Parameters["ReturnValue"].DbType = DbType.String;
+                rowsAffected = command.ExecuteNonQuery();
+                result = command.Parameters["ReturnValue"].Value.ToString();
+                //Connection.Close();
+                return result;
+            }
+        }
+        public static int RunProcedureintReturn(string storedProcName, IDataParameter[] parameters, out int rowsAffected)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                int result;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+
+
+                rowsAffected = command.ExecuteNonQuery();
+
+                result = (int)command.Parameters["ReturnValue"].Value;
+                //Connection.Close();
+                return result;
+            }
+        }
+
+        /// <summary>
+        /// 创建 SqlCommand 对象实例(用来返回一个整数值)    
+        /// </summary>
+        /// <param name="storedProcName">存储过程名</param>
+        /// <param name="parameters">存储过程参数</param>
+        /// <returns>SqlCommand 对象实例</returns>
+        private static SqlCommand BuildIntCommand(SqlConnection connection, string storedProcName, IDataParameter[] parameters)
+        {
+            SqlCommand command = BuildQueryCommand(connection, storedProcName, parameters);
+            command.Parameters.Add(new SqlParameter("ReturnValue",
+                SqlDbType.Int, 4, ParameterDirection.ReturnValue,
+                false, 0, 0, string.Empty, DataRowVersion.Default, null));
+            return command;
+        }
+        #endregion
+
+
+        public static string RunProcedureXima_Gp_InsertS(string storedProcName, SqlParameter[] parameters, out int rowsAffected)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                int result;
+                connection.Open();
+                SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
+                rowsAffected = command.ExecuteNonQuery();
+                string stypeid = command.Parameters["ReturnValue"].Value.ToString();
+                //Connection.Close();
+                return stypeid;
+            }
+        }
+
+
+
+        public static DataTable SelectTable(String sql, CommandType cmdType, params SqlParameter[] sp)
+        {
+            using (SqlConnection conn = new SqlConnection(constr))
+            {
+                conn.Open();
+                SqlCommand cmd = conn.CreateCommand();
+                foreach (SqlParameter item in sp)
+                {
+                    cmd.Parameters.Add(item);
+                }
+                cmd.CommandType = cmdType;
+                cmd.CommandText = sql;
+                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
+                {
+                    DataSet ds = new DataSet();
+                    da.Fill(ds);
+                    return ds.Tables[0];
+                }
+            }
+        }
+
+        /// <summary>
+        /// 执行SQL查询语句
+        /// </summary>
+        /// <param name="cmdstr">查询语句</param>
+        /// <returns>返回DataTable数据表</returns>
+        public static DataTable reDts(string cmdstr)
+        {
+            using (SqlConnection connection = new SqlConnection(connectionString))
+            {
+                connection.Open();
+                SqlDataAdapter da = new SqlDataAdapter(cmdstr, connection);
+                DataSet ds = new DataSet();
+                da.Fill(ds);
+                DataTable dt = ds.Tables[0];
+                return (dt);
+            }
+        }
+
+
+        //第二种dbhelper
+        //创建连接字符串:通过“工具”---“连接到数据库”--“高级”
+        //public static string constr = "Data Source=.;Initial Catalog=StudentDB;Integrated Security=True";
+        /// <summary>
+        /// 查询的方法
+        /// </summary>
+        /// <param name="sql">要执行的sql语句</param>
+        /// <returns>结果集</returns>
+        public static DataTable Select(string sql)
+        {
+            //创建连接对象
+            SqlConnection conn = new SqlConnection(constr);
+            //创建适配器对象
+            SqlDataAdapter dap = new SqlDataAdapter(sql, conn);
+            //创建DataTable对象
+            DataTable dt = new DataTable();
+            //使用适配器对象填充dt
+            dap.Fill(dt);
+            //返回dt
+            return dt;
+        }
+        /// <summary>
+        /// 增删改的方法
+        /// </summary>
+        /// <param name="sql">要执行的sql语句</param>
+        /// <returns>受影响的行数是否>0</returns>
+        public static bool Excute(string sql)
+        {
+            //创建连接对象
+            SqlConnection conn = new SqlConnection(constr);
+            //打开连接对象
+            conn.Open();
+            //创建命令对象
+            SqlCommand cmd = new SqlCommand(sql, conn);
+            //调用cmd的增删改方法
+            int count = cmd.ExecuteNonQuery();
+            //关闭连接对象
+            conn.Close();
+            //返回
+            return count > 0;
+        }
+        /// <summary>
+        /// 重写以上方法
+        /// </summary>
+        /// <param name="sql"></param>
+        /// <returns></returns>
+        public static bool Excute1(string sql)
+        {
+            //创建连接对象
+            SqlConnection conn = new SqlConnection(connectionString);
+            //打开连接对象
+            conn.Open();
+            //创建命令对象
+            SqlCommand cmd = new SqlCommand(sql, conn);
+            //调用cmd的增删改方法
+            int count = cmd.ExecuteNonQuery();
+            //关闭连接对象
+            conn.Close();
+            //返回
+            return count > 0;
+        }
+
+        public static DataTable Select1(string sql)
+        {
+            //创建连接对象
+            SqlConnection conn = new SqlConnection(connectionString);
+            //创建适配器对象
+            SqlDataAdapter dap = new SqlDataAdapter(sql, conn);
+            //创建DataTable对象
+            DataTable dt = new DataTable();
+            //使用适配器对象填充dt
+            dap.Fill(dt);
+            //返回dt
+            return dt;
+        }
+    }
+}

+ 143 - 0
Controller/Sql_controller/HttpHepler.cs

@@ -0,0 +1,143 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.Sql_controller
+{
+    /// <summary>
+    /// Post方式提交数据,返回网页的源代码
+    /// </summary>
+    /// <param name="url">发送请求的 URL</param>
+    /// <param name="param">请求的参数集合</param>
+    /// <returns>远程资源的响应结果</returns>
+    public class HttpHepler
+    {
+        /// <summary>
+        /// Post方式提交数据,返回网页的源代码
+        /// </summary>
+        /// <param name="url">发送请求的 URL</param>
+        /// <param name="param">请求的参数集合</param>
+        /// <returns>远程资源的响应结果</returns>
+        public string sendPost(string url, Dictionary<string, string> param)
+        {
+            string result = "";
+            StringBuilder postData = new StringBuilder();
+            if (param != null && param.Count > 0)
+            {
+                foreach (var p in param)
+                {
+                    if (postData.Length > 0)
+                    {
+                        postData.Append("&");
+                    }
+                    postData.Append(p.Key);
+                    postData.Append("=");
+                    postData.Append(p.Value);
+                }
+            }
+            byte[] byteData = Encoding.GetEncoding("UTF-8").GetBytes(postData.ToString());
+            try
+            {
+
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+                request.ContentType = "application/x-www-form-urlencoded";
+                request.Referer = url;
+                request.Accept = "*/*";
+                request.Timeout = 30 * 1000;
+                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)";
+                request.Method = "POST";
+                request.ContentLength = byteData.Length;
+                Stream stream = request.GetRequestStream();
+                stream.Write(byteData, 0, byteData.Length);
+                stream.Flush();
+                stream.Close();
+                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+                Stream backStream = response.GetResponseStream();
+                StreamReader sr = new StreamReader(backStream, Encoding.GetEncoding("UTF-8"));
+                result = sr.ReadToEnd();
+                sr.Close();
+                backStream.Close();
+                response.Close();
+                request.Abort();
+            }
+            catch (Exception ex)
+            {
+                result = ex.Message;
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Post方法提交数据
+        /// </summary>
+        /// <param name="url">发送请求的 URL</param>
+        /// <param name="postDataStr">Json参数</param>
+        /// <returns></returns>
+        public string HttpPost(string url, string postDataStr)
+        {
+            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
+            byte[] arrB = encode.GetBytes(postDataStr);
+            HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url);
+            myReq.Method = "POST";
+            myReq.ContentType = "application/json";
+            myReq.ContentLength = arrB.Length;
+            Stream outStream = myReq.GetRequestStream();
+            outStream.Write(arrB, 0, arrB.Length);
+            outStream.Close();
+            //接收HTTP做出的响应
+            WebResponse myResp = myReq.GetResponse();
+            Stream ReceiveStream = myResp.GetResponseStream();
+            StreamReader readStream = new StreamReader(ReceiveStream, encode);
+            Char[] read = new Char[256];
+            int count = readStream.Read(read, 0, 256);
+            string str = null;
+            while (count > 0)
+            {
+                str += new String(read, 0, count);
+                count = readStream.Read(read, 0, 256);
+            }
+            readStream.Close();
+            myResp.Close();
+
+            return str;
+        }
+
+
+        /// <summary>
+        /// Get方式提交数据
+        /// </summary>
+        /// <param name="methodname"></param>
+        /// <returns></returns>
+        public object retObject(string methodname)
+        {
+            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(methodname);
+            request.Method = "GET";
+            request.ContentType = "text/html;charset=UTF-8";
+            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+            Stream myResponseStream = response.GetResponseStream();
+            StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
+            string retString = myStreamReader.ReadToEnd();
+
+            var retObject = (JObject)JsonConvert.DeserializeObject(retString);
+            return retObject;
+        }
+
+        /// <summary>
+        /// Json解析
+        /// </summary>
+        /// <param name="result"></param>
+        /// <returns></returns>
+        public string[] jsons(string result)
+        {
+            JObject jo = JObject.Parse(result);
+            string[] values1 = jo.Properties().Select(item => item.Value.ToString()).ToArray();
+            return values1;
+        }
+    }
+}

+ 29 - 0
Controller/Sql_controller/Sql_Controller.cs

@@ -0,0 +1,29 @@
+using CY_dingDing.Controller.Sql_controller;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.Sql_controller
+{
+    /// <summary>
+    /// 生成同步
+    /// </summary>
+    public static class Sql_Controller
+    {
+        /// <summary>
+        /// 新增日志
+        /// </summary>
+        /// <param name="name">名称</param>
+        /// <param name="state">状态</param>
+        /// <param name="note">备注</param>
+        /// <returns></returns>
+        public static bool Synchronous_Log(string name,string state, string note)
+        {
+            string sql = "insert into dingDing_Log values ('" + name + "','"+ state +"','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + note + "')";
+            bool _bool = DB_Helper.Excute1(sql);
+            return _bool;
+        }
+    }
+}

+ 150 - 0
Controller/Ykb_API/Ykb_APIServer.cs

@@ -0,0 +1,150 @@
+using ConsoleApp1.Controller.Sql_controller;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Controller.Ykb_API
+{
+    /// <summary>
+    /// 易快报api接口调用类
+    /// </summary>
+    public class Ykb_APIServer
+    {
+
+        private DateTime dtttime;
+        private static HttpHepler http = new HttpHepler();
+        private string token, refreshToken;
+
+        private string appKey = "6dc9da42-b1ee-4ba0-971e-8bd122359a1a";//接入账号
+        private string appSecurity = "655fa5d5-68d8-48ba-b618-c7b4dd6b43a7";//接入密码
+        private string ID = "gCEbY44UmM4Q00";                       //企业ID
+
+        /// <summary>
+        /// 获取地址前缀
+        /// </summary>
+        /// <returns></returns>
+        public string location()
+        {
+            string url = "https://app.ekuaibao.com/api/openapi/v2/location?corpId=" + ID;
+            var str = http.retObject(url);
+            JObject json = JsonConvert.DeserializeObject<JObject>(str.ToString());
+            string htps = json["value"].ToString();
+            return htps;
+        }
+
+        /// <summary>
+        /// 获取token
+        /// </summary>
+        /// <param name="appkey"></param>
+        /// <param name="appSecurity"></param>
+        /// <returns>value值</returns>
+        public string getAccessToken()
+        {
+            //string _location = location(); 
+            string url = "https://dd2.ekuaibao.com/api/openapi/v1/auth/getAccessToken";
+            string dictionary = "{\"appKey\"" + ":" + "\"" + appKey + "\"," + "\"appSecurity\"" + ":" + "\"" + appSecurity + "\"}";
+            var str = http.HttpPost(url, dictionary);
+            JObject json = JsonConvert.DeserializeObject<JObject>(str.ToString());
+            refreshToken = json["value"]["refreshToken"].ToString();
+            token = json["value"]["accessToken"].ToString();
+            return token;
+        }
+
+        /// <summary>
+        /// 刷新授权
+        /// </summary>
+        /// <param name="accessToken">即将过期的授权码</param>
+        /// <param name="refreshToken">刷新的授权码</param>
+        /// <param name="powerCode">商品授权码</param>
+        /// <returns></returns>
+        public string refreshTokens(string accessToken, string powerCode = "219904")
+        {
+            ///POST 方法 https://app.ekuaibao.com/api/openapi/v2/auth/refreshToken?accessToken=
+            string url = "https://dd2.ekuaibao.com/api/openapi/v2/auth/refreshToken?accessToken=" + accessToken + "&refreshToken=" + refreshToken + "&" + powerCode;
+            var str = http.HttpPost(url, null);
+            JObject json = JsonConvert.DeserializeObject<JObject>(str.ToString());
+            token = json["value"].ToString();
+            return token;
+        }
+
+        /// <summary>
+        /// 超时判断
+        /// </summary>
+        /// <param name="ken"></param>
+        /// <returns></returns>
+        public string dttoken(string ken = "")
+        {
+            string AccessToken = "";
+            if (dtttime.ToString() == "0001/1/1 0:00:00")
+            {
+                dtttime = DateTime.Now;
+                AccessToken = getAccessToken();
+            }
+            if (dtttime.ToString() != "0001/1/1 0:00:00" && (dtttime.AddHours(2) < dtttime))
+            {
+                AccessToken = refreshTokens(ken);
+            }
+            return AccessToken;
+        }
+
+
+        /// <summary>
+        /// 时间戳转换(毫秒级)
+        /// </summary>
+        /// <param name="datetime"></param>
+        /// <returns></returns>
+        public static long DateTimeToInt(DateTime datetime)
+        {
+            return (datetime.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks) / 10000;
+        }
+
+
+        #region 根据名称获取自定义档案项
+        /// <summary>
+        /// 获取自定义档案项
+        /// </summary>
+        /// <param name="accessToken">认证token</param>
+        /// <param name="start">分页查询的起始序号</param>
+        /// <param name="count">查询数据条数</param>
+        /// <returns></returns>
+        public string dimensions(string accessToken, string Code)
+        {
+            string url = "https://dd2.ekuaibao.com/api/openapi/v1/dimensions/getDimensionByCode?accessToken=" + accessToken + "&code=" + Code;
+            var items = http.retObject(url);
+            return items.ToString();
+        }
+        #endregion
+
+
+        #region 创建自定义档案项
+
+        public string InsertDAN(string accesToken, string name,string dimensionId,string code)
+        {
+            string url = " https://dd2.ekuaibao.com/api/openapi/v1/dimensions/items?accessToken=" + accesToken;
+                
+
+            string dictionary = "{\"dimensionId\":\""+ dimensionId + "\",\"name\":\""+name + "\",\"code\":\""+code + "\",\"parentId\":\"\"}";
+            var items = http.HttpPost(url, dictionary);
+            
+            return items;
+        }
+
+
+        #endregion
+
+        #region 判断自定义档案项是否存在
+        public string setDAN(string accesToken, string code)
+        {
+            string url = "https://dd2.ekuaibao.com/api/openapi/v1/dimensions/getDimensionByCode?accessToken=" + accesToken + "&code="+ code;
+            var items = http.retObject(url);
+            JObject setYkb = JsonConvert.DeserializeObject<JObject>(items.ToString());
+
+            return setYkb["count"].ToString();
+        }
+        #endregion
+    }
+}

+ 39 - 0
Model/BasicData.cs

@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 基础信息
+    /// </summary>
+    public class BasicData
+    {
+
+        public string F0000009 { get; set; }     //员工ID
+
+        public string F0000001 { get; set; }    //姓名
+
+        public string F0000010 { get; set; }    //部门ID
+
+        public string F0000002 { get; set; }    //部门
+
+        public string F0000003 { get; set; }    //所属公司
+
+        public string F0000006 { get; set; }    //岗位
+
+        public string F0000007 { get; set; }    //入职时间
+
+        public string F0000008 { get; set; }    //职级 
+
+        public string F0000004 { get; set; }    //原合同开始时间
+
+        public string F0000005 { get; set; }    //原合同结束时间
+
+        public string F0000012 { get; set; }    //续签期限
+
+        public string F0000013 { get; set; }  //续签次数
+    }
+}

+ 43 - 0
Model/BasicPersonnelInformation.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 人员基础信息
+    /// </summary>
+    public class BasicPersonnelInformation
+    {
+        /// <summary>
+        /// 员工ID
+        /// </summary>
+        public string F0000009 { get; set; }
+        /// <summary>
+        /// 姓名
+        /// </summary>
+        public string F0000001 { get; set; }
+
+        /// <summary>
+        /// 业务单元
+        /// </summary>
+        public string F0000002 { get; set; }
+
+        /// <summary>
+        /// 预算组织
+        /// </summary>
+        public string F0000005 { get; set; }
+
+        /// <summary>
+        /// 项目
+        /// </summary>
+        public string F0000003 { get; set; }
+
+        /// <summary>
+        /// 部门
+        /// </summary>
+        public string F0000004 { get; set; }
+    }
+}

+ 20 - 0
Model/BusinessUnit.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    public class BusinessUnit
+    {
+        /// <summary>
+        /// 编码
+        /// </summary>
+        public string F0000001 { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        public string F0000002 { get; set; }
+    }
+}

+ 31 - 0
Model/ProjectFiles.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 项目档案
+    /// </summary>
+    public class ProjectFiles
+    {
+        /// <summary>
+        /// 项目编码
+        /// </summary>
+        public string F0000001 { get; set; }
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+        public string F0000002 { get; set; }
+        /// <summary>
+        /// 业务单元编码
+        /// </summary>
+        public string F0000003 { get; set; }
+        /// <summary>
+        /// 业务单元名称
+        /// </summary>
+        public string F0000004 { get; set; }
+    }
+}

+ 18 - 0
Model/TheBudget.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 预算组织
+    /// </summary>
+    public class TheBudget
+    {
+        public string F0000002 { get; set; }
+
+        public string F0000001 { get; set; }
+    }
+}

+ 33 - 0
Model/departmentUnit.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 部门
+    /// </summary>
+    public class departmentUnit
+    {
+        /// <summary>
+        /// 部门编码
+        /// </summary>
+        public string F0000001 { get; set; }
+        /// <summary>
+        /// 部门名称
+        /// </summary>
+        public string F0000002 { get; set; }
+
+
+        /// <summary>
+        /// 上级编码
+        /// </summary>
+        public string F0000003 { get; set; }
+        /// <summary>
+        /// 上级名称
+        /// </summary>
+        public string F0000004 { get; set; }
+    }
+}

+ 23 - 0
Model/merchantsUnit.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConsoleApp1.Model
+{
+    /// <summary>
+    /// 客商
+    /// </summary>
+    public class merchantsUnit
+    {
+        /// <summary>
+        /// 客商编码
+        /// </summary>
+        public string F0000001 { get; set; }
+        /// <summary>
+        /// 客商名称
+        /// </summary>
+        public string F0000002 { get; set; }
+    }
+}

+ 22 - 0
Program.cs

@@ -0,0 +1,22 @@
+using ConsoleApp1.Controller.CY_API;
+using ConsoleApp1.Controller.DDing_API;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Timers;
+
+namespace ConsoleApp1
+{
+    public class Program
+    {
+        private static CY_NC_Api CNApi = new CY_NC_Api();
+
+        //private static DingdingAPI dindingAPI = new DingdingAPI();
+        public static void Main(string[] args)
+        {
+            //dindingAPI.getAccessToken();
+            CNApi.NC_CY();
+        }
+    }
+}

+ 36 - 0
Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ConsoleApp1")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("P R C")]
+[assembly: AssemblyProduct("ConsoleApp1")]
+[assembly: AssemblyCopyright("Copyright © P R C 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("339f235a-2a54-4399-879b-a731acbe00d2")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 4 - 0
packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
+</packages>