Внёс примеры использования веб-службы
This commit is contained in:
parent
5cd7c46cd7
commit
8c8885bf96
@ -1,5 +1,5 @@
|
||||
# samples
|
||||
Примеры использования Lers Framework
|
||||
Примеры использования Lers Framework и веб-службы
|
||||
|
||||
Проекты:
|
||||
|
||||
@ -7,3 +7,4 @@ AttributesSample Работа с атрибутами. Консольное пр
|
||||
GetDataSample Получение данных из ЛЭРС УЧЁТ. Консольное приложение.
|
||||
ImportTemperature Импорт температуры наружного воздуха в ЛЭРС УЧЁТ.
|
||||
KhvAdmDataAdapter Экспорт данных из ЛЭРС УЧЁТ. Обработчик HttpHandler для веб-сайта
|
||||
WebApiSamples Примеры использования веб-службы ЛЭРС УЧЁТ
|
||||
|
22
WebApiSamples/Asp.net+JavaScript/TestLersApi.sln
Normal file
22
WebApiSamples/Asp.net+JavaScript/TestLersApi.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLersApi", "TestLersApi\TestLersApi.csproj", "{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
17
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx
Normal file
17
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx
Normal file
@ -0,0 +1,17 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestLersApi.Default" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<script src="/jquery-1.6.4.min.js" type="text/javascript"></script>
|
||||
<script src="/TestLersApi.js" type="text/javascript"></script>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
17
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx.cs
Normal file
17
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace TestLersApi
|
||||
{
|
||||
public partial class Default : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
23
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx.designer.cs
generated
Normal file
23
WebApiSamples/Asp.net+JavaScript/TestLersApi/Default.aspx.designer.cs
generated
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <автоматически создаваемое>
|
||||
// Этот код создан программой.
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </автоматически создаваемое>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TestLersApi
|
||||
{
|
||||
public partial class Default {
|
||||
|
||||
/// <summary>
|
||||
/// form1 элемент управления.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Автоматически создаваемое поле.
|
||||
/// Для изменения переместите объявление поля из файла конструктора в файл кода программной части.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Управление общими сведениями о сборке осуществляется с помощью
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// общие сведения об этой сборке.
|
||||
[assembly: AssemblyTitle("TestLersApi")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestLersApi")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False в параметре ComVisible делает типы в этой сборке невидимыми
|
||||
// для COM-компонентов. Если необходим доступ к типу в этой сборке из
|
||||
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Указанный ниже идентификатор GUID предназначен для идентификации библиотеки типов, если этот проект будет видимым для COM-объектов
|
||||
[assembly: Guid("245ef887-0d90-4ff8-a52c-5399e292cdfb")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
|
||||
// используя "*", как показано ниже:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
108
WebApiSamples/Asp.net+JavaScript/TestLersApi/TestLersApi.csproj
Normal file
108
WebApiSamples/Asp.net+JavaScript/TestLersApi/TestLersApi.csproj
Normal file
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{10B68319-F7E8-4460-9BF8-B7C0D6FFB9BB}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestLersApi</RootNamespace>
|
||||
<AssemblyName>TestLersApi</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TestLersApi.js" />
|
||||
<Content Include="Default.aspx" />
|
||||
<Content Include="jquery-1.6.4.min.js" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Default.aspx.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Default.aspx.designer.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>58035</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
160
WebApiSamples/Asp.net+JavaScript/TestLersApi/TestLersApi.js
Normal file
160
WebApiSamples/Asp.net+JavaScript/TestLersApi/TestLersApi.js
Normal file
@ -0,0 +1,160 @@
|
||||
/// <reference path="jquery-1.6.4.js" />
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// Разрешаем кроссдоменное взаимодействие (cross-domain, XCC - Cross-site scripting) по технологии CORS (Cross-origin resource sharing)
|
||||
jQuery.support.cors = true;
|
||||
|
||||
// Отправляем запрос на вход в систему
|
||||
SendLoginRequest('demo', 'demo');
|
||||
});
|
||||
|
||||
|
||||
function ReceivedLoginResponse(data) {
|
||||
/// <summary>
|
||||
/// Обработчик события успешного входа в систему
|
||||
/// </summary>
|
||||
|
||||
// Данные получаемые от сервера содержатся в свойстве d
|
||||
data = data.d;
|
||||
|
||||
// Если есть ошибка, выводим её, иначе отправляем запрос на получение списка точек учета
|
||||
|
||||
if (data.IsError)
|
||||
alert(data.ErrorMessage);
|
||||
else
|
||||
SendGetMeasurePointListRequest();
|
||||
}
|
||||
|
||||
function ReceivedMeasurePointListResponse(data) {
|
||||
/// <summary>
|
||||
/// Обработчик события получения списка точек учета
|
||||
/// </summary>
|
||||
|
||||
// Данные получаемые от сервера содержатся в свойстве d
|
||||
data = data.d;
|
||||
|
||||
// Если список точек учета не пустой отправляем запрос на получение потребления по первой точке учета из списка
|
||||
if (data.MeasurePointList.length > 0)
|
||||
SendGetMeasurePointConsumptionRequest(data.MeasurePointList[0].Id);
|
||||
}
|
||||
|
||||
function ReceivedMeasurePointConsumptionResponse(data) {
|
||||
/// <summary>
|
||||
/// Обработчик события получение потребления по точке учета
|
||||
/// </summary>
|
||||
|
||||
// Данные получаемые от сервера содержатся в свойстве d
|
||||
data = data.d;
|
||||
|
||||
// Если есть данные потребления, выводим сообщение со значением T_in за первую метку времени
|
||||
if (data.Data.length > 0)
|
||||
{
|
||||
var jsonDate = data.Data[0].DateTime
|
||||
|
||||
var dataDate = new Date(parseInt(jsonDate.substr(6)));
|
||||
var T_in = data.Data[0].T_in;
|
||||
|
||||
alert(dataDate.toString() + ': ' + T_in.toString());
|
||||
}
|
||||
else
|
||||
alert('По точке учета нет данных потребления.');
|
||||
|
||||
// Получаем список объектов учета с расширенной информацией
|
||||
SendGetNodeListExtendedRequest();
|
||||
}
|
||||
|
||||
function ReceivedNodeListExtendedResponse(data)
|
||||
/// <summary>
|
||||
/// Обработчик события получение списка объектов учета
|
||||
/// </summary>
|
||||
{
|
||||
// Данные получаемые от сервера содержатся в свойстве d
|
||||
data = data.d;
|
||||
}
|
||||
|
||||
function SendLoginRequest(userName, password) {
|
||||
/// <summary>
|
||||
/// Отправляет запрос на вход в систему ЛЭРС УЧЕТ
|
||||
/// </summary>
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://localhost:54025/Api.asmx/Login",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
xhrFields: { withCredentials: true },
|
||||
crossDomain: true,
|
||||
data: "{ 'userName':'" + userName + "','password':'" + password + "' }",
|
||||
success: ReceivedLoginResponse,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Не удалось войти в систему.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SendGetMeasurePointListRequest() {
|
||||
/// <summary>
|
||||
/// Отправляет запрос на получение списка точек учета
|
||||
/// </summary>
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://localhost:54025/Api.asmx/GetMeasurePointList",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
xhrFields: { withCredentials: true },
|
||||
crossDomain: true,
|
||||
data: "",
|
||||
success: ReceivedMeasurePointListResponse,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Не удалось получить список точек учета.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SendGetNodeListExtendedRequest() {
|
||||
/// <summary>
|
||||
/// Отправляет запрос на получение списка объектов учета
|
||||
/// </summary>
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://localhost:54025/Api.asmx/GetNodeListExtended",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
xhrFields: { withCredentials: true },
|
||||
crossDomain: true,
|
||||
data: "{ 'flags':" + 1024 + "}", // Запрашиваем помещения
|
||||
success: ReceivedNodeListExtendedResponse,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Не удалось получить список объектов учета.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SendGetMeasurePointConsumptionRequest(measurePointId) {
|
||||
/// <summary>
|
||||
/// Отправляет запрос на получение потребления за текущий месяц
|
||||
/// </summary>
|
||||
|
||||
var nowDate = new Date();
|
||||
|
||||
var currentStartDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), 1);
|
||||
var currentEndDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate());
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://localhost:54025/Api.asmx/GetMeasurePointConsumption",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
xhrFields: { withCredentials: true },
|
||||
crossDomain: true,
|
||||
data: "{ 'measurePointId':" + measurePointId + ", 'startDate':'" + currentStartDate.toJSON() + "','endDate':'" + currentEndDate.toJSON() + "', 'dataType': 'Day' }",
|
||||
success: ReceivedMeasurePointConsumptionResponse,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Не удалось получить данные потребления по точке учета.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
13
WebApiSamples/Asp.net+JavaScript/TestLersApi/Web.config
Normal file
13
WebApiSamples/Asp.net+JavaScript/TestLersApi/Web.config
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Дополнительные сведения по настройке приложения ASP.NET см. по ссылке
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0" />
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
4
WebApiSamples/Asp.net+JavaScript/TestLersApi/jquery-1.6.4.min.js
vendored
Normal file
4
WebApiSamples/Asp.net+JavaScript/TestLersApi/jquery-1.6.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
WebApiSamples/C#/TestLersApi.sln
Normal file
20
WebApiSamples/C#/TestLersApi.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 14.00
|
||||
# Visual Studio 2014
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLersApi", "TestLersApi\TestLersApi.csproj", "{2FC726F6-54C4-4A5F-A572-D2C717E39D18}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2FC726F6-54C4-4A5F-A572-D2C717E39D18}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{2FC726F6-54C4-4A5F-A572-D2C717E39D18}.Debug|x86.Build.0 = Debug|x86
|
||||
{2FC726F6-54C4-4A5F-A572-D2C717E39D18}.Release|x86.ActiveCfg = Release|x86
|
||||
{2FC726F6-54C4-4A5F-A572-D2C717E39D18}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
77
WebApiSamples/C#/TestLersApi/Program.cs
Normal file
77
WebApiSamples/C#/TestLersApi/Program.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
|
||||
namespace TestLersApi
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Создаем прокси класс для работы со службой
|
||||
LersApi.Api client = new LersApi.Api();
|
||||
|
||||
// Устанавливаем куки-контейнер, необходим для авторизации пользователя
|
||||
client.CookieContainer = new System.Net.CookieContainer();
|
||||
|
||||
// Входим в систему ЛЭРС УЧЕТ
|
||||
var response = client.Login("demo", "demo");
|
||||
|
||||
// Если произошла ошибка, прекращаем работу
|
||||
if (response.ErrorCode != LersApi.ErrorCode.None)
|
||||
{
|
||||
Console.WriteLine(response.ErrorMessage);
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
// Получаем список точек учета
|
||||
var response2 = client.GetMeasurePointList();
|
||||
|
||||
// Если список пустой, выходим
|
||||
if (response2.MeasurePointList == null || response2.MeasurePointList.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Список точек учета пуст");
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
// Получаем список объектов учета
|
||||
var response4 = client.GetNodeListExtended(LersApi.NodeInfoFlags.Customer | LersApi.NodeInfoFlags.Systems | LersApi.NodeInfoFlags.Serviceman | LersApi.NodeInfoFlags.ServiceCompany);
|
||||
|
||||
// Если список пустой, выходим
|
||||
if (response4.NodeList == null || response4.NodeList.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Список объектов учета пуст");
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
// Получаем потребление по первой точке учета из списка
|
||||
var endDate = DateTime.Today;
|
||||
|
||||
var startDate = new DateTime(endDate.Year-1, endDate.Month, 1);
|
||||
|
||||
var response3 = client.GetMeasurePointConsumption(response2.MeasurePointList[0].Id, startDate, endDate, LersApi.DeviceDataType.Day);
|
||||
|
||||
// Если список пустой, выходим
|
||||
if (response3.Data == null || response3.Data.Length == 0)
|
||||
{
|
||||
Console.WriteLine("По точке учета нет данных потребления");
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
|
||||
if (response3.Data[0].ResourceKind == LersApi.ResourceKind.Water)
|
||||
{
|
||||
Console.WriteLine(response3.Data[0].DateTime + ": " + ((LersApi.WaterConsumptionRecord)response3.Data[0]).T_in);
|
||||
}
|
||||
else
|
||||
Console.WriteLine(response3.Data[0].DateTime);
|
||||
|
||||
// Экспорт данных в формат XML 80020
|
||||
var response5 = client.ExportMeasurePointDataToXml80020(response2.MeasurePointList[0].Id, startDate, endDate);
|
||||
|
||||
Console.ReadKey();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
36
WebApiSamples/C#/TestLersApi/Properties/AssemblyInfo.cs
Normal file
36
WebApiSamples/C#/TestLersApi/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Управление общими сведениями о сборке осуществляется с помощью
|
||||
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("TestLersApi")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestLersApi")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
|
||||
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
|
||||
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("0569e27a-c2b3-4e8b-be59-757a7c839d0c")]
|
||||
|
||||
// Сведения о версии сборки состоят из следующих четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер построения
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
36
WebApiSamples/C#/TestLersApi/Properties/Settings.Designer.cs
generated
Normal file
36
WebApiSamples/C#/TestLersApi/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.269
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TestLersApi.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://localhost:54025/api.asmx")]
|
||||
public string TestLersApi_LersApi_Api {
|
||||
get {
|
||||
return ((string)(this["TestLersApi_LersApi_Api"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TestLersApi.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="TestLersApi_LersApi_Api" Type="(Web Service URL)" Scope="Application">
|
||||
<Value Profile="(Default)">http://localhost:54025/api.asmx</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
133
WebApiSamples/C#/TestLersApi/TestLersApi.csproj
Normal file
133
WebApiSamples/C#/TestLersApi/TestLersApi.csproj
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{2FC726F6-54C4-4A5F-A572-D2C717E39D18}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestLersApi</RootNamespace>
|
||||
<AssemblyName>TestLersApi</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</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|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Web References\LersApi\Reference.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WebReferences Include="Web References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WebReferenceUrl Include="http://localhost:54025/api.asmx">
|
||||
<UrlBehavior>Dynamic</UrlBehavior>
|
||||
<RelPath>Web References\LersApi\</RelPath>
|
||||
<UpdateFromURL>http://localhost:54025/api.asmx</UpdateFromURL>
|
||||
<ServiceLocationURL>
|
||||
</ServiceLocationURL>
|
||||
<CachedDynamicPropName>
|
||||
</CachedDynamicPropName>
|
||||
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
|
||||
<CachedSettingsPropName>TestLersApi_LersApi_Api</CachedSettingsPropName>
|
||||
</WebReferenceUrl>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\api.wsdl" />
|
||||
<None Include="Web References\LersApi\Reference.map">
|
||||
<Generator>MSDiscoCodeGenerator</Generator>
|
||||
<LastGenOutput>Reference.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\Response.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseExportMeasurePointDataToXml80020.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePoint.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePointConsumption.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePointDeviceErrors.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePointElectricPower.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePointList.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetMeasurePointTotals.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetNode.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetNodeList.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
<None Include="Web References\LersApi\ResponseGetRoom.datasource">
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Web References\LersApi\api.disco" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
4230
WebApiSamples/C#/TestLersApi/Web References/LersApi/Reference.cs
Normal file
4230
WebApiSamples/C#/TestLersApi/Web References/LersApi/Reference.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Results>
|
||||
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost:54025/api.asmx?wsdl" filename="api.wsdl" />
|
||||
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost:54025/api.asmx?disco" filename="api.disco" />
|
||||
</Results>
|
||||
</DiscoveryClientResultsFile>
|
@ -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="Response" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.Response, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseExportMeasurePointDataToXml80020" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseExportMeasurePointDataToXml80020, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePoint" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePoint, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointByNumber" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointByNumber, Web References.LersApi.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointConsumption" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointConsumption, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointDeviceErrors" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointDeviceErrors, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointElectricPower" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointElectricPower, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointList, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetMeasurePointTotals" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetMeasurePointTotals, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetNode" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetNode, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetNodeByNumber" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetNodeByNumber, Web References.LersApi.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetNodeList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetNodeList, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -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="ResponseGetRoom" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>TestLersApi.LersApi.ResponseGetRoom, Web References.LersApi.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
|
||||
<contractRef ref="http://localhost:54025/api.asmx?wsdl" docRef="http://localhost:54025/api.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
|
||||
<soap address="http://localhost:54025/api.asmx" xmlns:q1="http://www.lers.ru/website/api" binding="q1:ApiSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
|
||||
<soap address="http://localhost:54025/api.asmx" xmlns:q2="http://www.lers.ru/website/api" binding="q2:ApiSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
|
||||
</discovery>
|
1266
WebApiSamples/C#/TestLersApi/Web References/LersApi/api.wsdl
Normal file
1266
WebApiSamples/C#/TestLersApi/Web References/LersApi/api.wsdl
Normal file
File diff suppressed because it is too large
Load Diff
15
WebApiSamples/C#/TestLersApi/app.config
Normal file
15
WebApiSamples/C#/TestLersApi/app.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="TestLersApi.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<applicationSettings>
|
||||
<TestLersApi.Properties.Settings>
|
||||
<setting name="TestLersApi_LersApi_Api" serializeAs="String">
|
||||
<value>http://localhost:54025/api.asmx</value>
|
||||
</setting>
|
||||
</TestLersApi.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
6
WebApiSamples/NotificationSample/Notification.xml
Normal file
6
WebApiSamples/NotificationSample/Notification.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Notifications>
|
||||
<TenantOffice DateTime="2013.06.11 12:14">Внимание. С 23.06.2013 по 30.06.2013 не будет горячей воды.</TenantOffice>
|
||||
<TenantOffice DateTime="2013.06.10 11:18">До 27.03.2013 необходимо ввести показания по своим счетчикам.</TenantOffice>
|
||||
<Main DateTime="2013.06.09 10:10">Внимание. 20.06.2013 в 16:00 будет собрание обслуживающих.</Main>
|
||||
</Notifications>
|
44
WebApiSamples/PowerShell/TestLersApi.ps1
Normal file
44
WebApiSamples/PowerShell/TestLersApi.ps1
Normal file
@ -0,0 +1,44 @@
|
||||
$url = "http://localhost:54025/Api.asmx"
|
||||
|
||||
# Создаем прокси класс для работы со службой
|
||||
$webservice = New-WebServiceProxy -uri $url
|
||||
|
||||
# Устанавливаем куки-контейнер, необходим для авторизации пользователя
|
||||
$webservice.CookieContainer = New-Object System.Net.CookieContainer
|
||||
|
||||
# Входим в систему ЛЭРС УЧЕТ
|
||||
$response1 = $webservice.Login('demo', 'demo')
|
||||
|
||||
# Если произошла ошибка, прекращаем работу
|
||||
if($response1.IsError -eq $true)
|
||||
{
|
||||
Write-Host $response1.ErrorMessage
|
||||
exit
|
||||
}
|
||||
|
||||
# Получаем список точек учета
|
||||
$response2 = $webservice.GetMeasurePointList()
|
||||
|
||||
# Если список пустой, выходим
|
||||
if($response2.MeasurePointList.Length -le 0)
|
||||
{
|
||||
Write-Host 'Список точек учета пуст'
|
||||
exit
|
||||
}
|
||||
|
||||
# Получаем потребление по первой точке учета из списка
|
||||
$endDate = [DateTime]::Today
|
||||
|
||||
$startDate = New-Object DateTime($endDate.Year, $endDate.Month, 1)
|
||||
|
||||
$response3 = $webservice.GetMeasurePointConsumption($response2.MeasurePointList[0].Id, $startDate, $endDate, 'Day')
|
||||
|
||||
# Если список пустой, выходим
|
||||
if($response3.Data.Length -le 0)
|
||||
{
|
||||
Write-Host 'По точке учета нет данных потребления'
|
||||
exit
|
||||
}
|
||||
|
||||
# Выводим сообщение со значением T_in за первую метку времени
|
||||
Write-Host $response3.Data[0].DateTime ': ' $response3.Data[0].T_in
|
24
WebApiSamples/WebCustomization/FooterRight.ascx
Normal file
24
WebApiSamples/WebCustomization/FooterRight.ascx
Normal file
@ -0,0 +1,24 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" ClassName="Lers.Web.Client.FooterRight" %>
|
||||
|
||||
<%@ Import Namespace="Lers.Web.Api" %>
|
||||
|
||||
<style type="text/css">
|
||||
#footer_right_userName
|
||||
{
|
||||
float: Right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="footer_right_userName">
|
||||
<asp:Label ID="userDisplayName" runat="server" Text="Label"></asp:Label>
|
||||
</div>
|
||||
|
||||
<script runat="server">
|
||||
|
||||
protected void Page_PreRender(object sender, EventArgs e)
|
||||
{
|
||||
this.userDisplayName.Text = User.DisplayName;
|
||||
}
|
||||
|
||||
</script>
|
8
WebApiSamples/WebCustomization/SimplePage.html
Normal file
8
WebApiSamples/WebCustomization/SimplePage.html
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Тестовая страница</title>
|
||||
</head>
|
||||
<body>
|
||||
Тестовая страница
|
||||
</body>
|
||||
</html>
|
7
WebApiSamples/WebCustomization/TestPage.aspx
Normal file
7
WebApiSamples/WebCustomization/TestPage.aspx
Normal file
@ -0,0 +1,7 @@
|
||||
<%@ Page Title="Òåñòîâàÿ ñòðàíèöà" Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.Master" %>
|
||||
|
||||
<asp:Content ID="fullColumnContent" ContentPlaceHolderID="FullColumnContent" runat="server">
|
||||
|
||||
Òåñòîâàÿ ñòðàíèöà
|
||||
|
||||
</asp:Content>
|
Loading…
x
Reference in New Issue
Block a user