Commit af01cde1 by 施晓雨

更新DLL包

parent 4e01a86e
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 14
VisualStudioVersion = 15.0.27703.2042 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kivii.Client.Test", "Kivii.Client.Test\Kivii.Client.Test.csproj", "{0327117D-548C-4EB4-AD86-13F914BD4D1F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kivii.Client.Test", "Kivii.Client.Test\Kivii.Client.Test.csproj", "{0327117D-548C-4EB4-AD86-13F914BD4D1F}"
EndProject EndProject
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// 服务器上的实体,注意,类名称空间最好和服务器上一样,否则需要自己定义路由信息
/// </summary>
namespace Kivii.Organizations.Entities
{
//类中的属性不一定要全,需要多少属性就写多少属性
public class Member:EntityWithMetadata
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string DisplayName { get; set; }
public DateTime BirthDate { get; set; }
public string FullName { get; set; }
}
//这个就是和服务器上类似的Transform,因为Member的类名称为 Kivii.Organizations.Entities.Member,和服务器一致,所以不需要额外配置路由
public class MemberQuery : RestfulQuery<Member>
{
//查询参数,属性+标记 Contains代表包含,即like匹配
public string FullNameContains { get; set; }
//In代表一个数组,用逗号隔开
public string FirstNameIn { get; set; }
////大于
//public DateTime BirthDateGreaterThan { get; set; }
//public DateTime BirthDateGreaterThanOrEqualsTo { get; set; }
////小于
//public DateTime BirthDateLessThan { get; set; }
////小于等于
//public DateTime BirthDateLessThanOrEqualsTo { get; set; }
////介于两个之间
//public string StatusBetween { get; set; }
}
}
...@@ -38,12 +38,23 @@ ...@@ -38,12 +38,23 @@
this.btnLogout = new System.Windows.Forms.Button(); this.btnLogout = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.tbxDisplayName = new System.Windows.Forms.TextBox(); this.tbxDisplayName = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tbxFullNameContains = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.btnQueryMember = new System.Windows.Forms.Button();
this.tbxFirstNameIn = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(34, 28); this.label1.Location = new System.Drawing.Point(29, 34);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 12); this.label1.Size = new System.Drawing.Size(71, 12);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
...@@ -51,16 +62,16 @@ ...@@ -51,16 +62,16 @@
// //
// tbxServiceUrl // tbxServiceUrl
// //
this.tbxServiceUrl.Location = new System.Drawing.Point(111, 25); this.tbxServiceUrl.Location = new System.Drawing.Point(106, 31);
this.tbxServiceUrl.Name = "tbxServiceUrl"; this.tbxServiceUrl.Name = "tbxServiceUrl";
this.tbxServiceUrl.Size = new System.Drawing.Size(183, 21); this.tbxServiceUrl.Size = new System.Drawing.Size(183, 21);
this.tbxServiceUrl.TabIndex = 1; this.tbxServiceUrl.TabIndex = 0;
this.tbxServiceUrl.Text = "http://www.kivii.org/"; this.tbxServiceUrl.Text = "http://www.kivii.org/";
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(34, 56); this.label2.Location = new System.Drawing.Point(29, 62);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 12); this.label2.Size = new System.Drawing.Size(59, 12);
this.label2.TabIndex = 0; this.label2.TabIndex = 0;
...@@ -68,15 +79,16 @@ ...@@ -68,15 +79,16 @@
// //
// tbxUserName // tbxUserName
// //
this.tbxUserName.Location = new System.Drawing.Point(111, 53); this.tbxUserName.Location = new System.Drawing.Point(106, 59);
this.tbxUserName.Name = "tbxUserName"; this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(183, 21); this.tbxUserName.Size = new System.Drawing.Size(183, 21);
this.tbxUserName.TabIndex = 1; this.tbxUserName.TabIndex = 1;
this.tbxUserName.Text = "administrator";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(34, 86); this.label3.Location = new System.Drawing.Point(29, 92);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12); this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 0; this.label3.TabIndex = 0;
...@@ -84,18 +96,18 @@ ...@@ -84,18 +96,18 @@
// //
// tbxPassword // tbxPassword
// //
this.tbxPassword.Location = new System.Drawing.Point(111, 83); this.tbxPassword.Location = new System.Drawing.Point(106, 89);
this.tbxPassword.Name = "tbxPassword"; this.tbxPassword.Name = "tbxPassword";
this.tbxPassword.PasswordChar = '*'; this.tbxPassword.PasswordChar = '*';
this.tbxPassword.Size = new System.Drawing.Size(183, 21); this.tbxPassword.Size = new System.Drawing.Size(183, 21);
this.tbxPassword.TabIndex = 1; this.tbxPassword.TabIndex = 2;
// //
// btnLogin // btnLogin
// //
this.btnLogin.Location = new System.Drawing.Point(36, 151); this.btnLogin.Location = new System.Drawing.Point(31, 157);
this.btnLogin.Name = "btnLogin"; this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(75, 23); this.btnLogin.Size = new System.Drawing.Size(75, 23);
this.btnLogin.TabIndex = 2; this.btnLogin.TabIndex = 4;
this.btnLogin.Text = "Login"; this.btnLogin.Text = "Login";
this.btnLogin.UseVisualStyleBackColor = true; this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
...@@ -103,10 +115,10 @@ ...@@ -103,10 +115,10 @@
// btnLogout // btnLogout
// //
this.btnLogout.Enabled = false; this.btnLogout.Enabled = false;
this.btnLogout.Location = new System.Drawing.Point(219, 151); this.btnLogout.Location = new System.Drawing.Point(214, 157);
this.btnLogout.Name = "btnLogout"; this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(75, 23); this.btnLogout.Size = new System.Drawing.Size(75, 23);
this.btnLogout.TabIndex = 2; this.btnLogout.TabIndex = 5;
this.btnLogout.Text = "Logout"; this.btnLogout.Text = "Logout";
this.btnLogout.UseVisualStyleBackColor = true; this.btnLogout.UseVisualStyleBackColor = true;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click); this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
...@@ -114,7 +126,7 @@ ...@@ -114,7 +126,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(34, 116); this.label4.Location = new System.Drawing.Point(29, 122);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(77, 12); this.label4.Size = new System.Drawing.Size(77, 12);
this.label4.TabIndex = 0; this.label4.TabIndex = 0;
...@@ -123,30 +135,112 @@ ...@@ -123,30 +135,112 @@
// tbxDisplayName // tbxDisplayName
// //
this.tbxDisplayName.Enabled = false; this.tbxDisplayName.Enabled = false;
this.tbxDisplayName.Location = new System.Drawing.Point(111, 113); this.tbxDisplayName.Location = new System.Drawing.Point(106, 119);
this.tbxDisplayName.Name = "tbxDisplayName"; this.tbxDisplayName.Name = "tbxDisplayName";
this.tbxDisplayName.Size = new System.Drawing.Size(183, 21); this.tbxDisplayName.Size = new System.Drawing.Size(183, 21);
this.tbxDisplayName.TabIndex = 1; this.tbxDisplayName.TabIndex = 3;
//
// panel1
//
this.panel1.Controls.Add(this.groupBox2);
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(319, 450);
this.panel1.TabIndex = 3;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.btnLogout);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.btnLogin);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.tbxDisplayName);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.tbxPassword);
this.groupBox1.Controls.Add(this.tbxServiceUrl);
this.groupBox1.Controls.Add(this.tbxUserName);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(319, 205);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "配置及登陆信息";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.tbxFirstNameIn);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.btnQueryMember);
this.groupBox2.Controls.Add(this.tbxFullNameContains);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 205);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(319, 245);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询人员示例";
//
// tbxFullNameContains
//
this.tbxFullNameContains.Location = new System.Drawing.Point(106, 36);
this.tbxFullNameContains.Name = "tbxFullNameContains";
this.tbxFullNameContains.Size = new System.Drawing.Size(183, 21);
this.tbxFullNameContains.TabIndex = 6;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(7, 41);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(101, 12);
this.label5.TabIndex = 0;
this.label5.Text = "FullNameContains";
//
// btnQueryMember
//
this.btnQueryMember.Location = new System.Drawing.Point(31, 210);
this.btnQueryMember.Name = "btnQueryMember";
this.btnQueryMember.Size = new System.Drawing.Size(75, 23);
this.btnQueryMember.TabIndex = 8;
this.btnQueryMember.Text = "Query";
this.btnQueryMember.UseVisualStyleBackColor = true;
this.btnQueryMember.Click += new System.EventHandler(this.btnQueryMember_Click);
//
// tbxFirstNameIn
//
this.tbxFirstNameIn.Location = new System.Drawing.Point(106, 73);
this.tbxFirstNameIn.Name = "tbxFirstNameIn";
this.tbxFirstNameIn.Size = new System.Drawing.Size(183, 21);
this.tbxFirstNameIn.TabIndex = 7;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 78);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(71, 12);
this.label6.TabIndex = 4;
this.label6.Text = "FirstNameIn";
// //
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.btnLogout); this.Controls.Add(this.panel1);
this.Controls.Add(this.btnLogin);
this.Controls.Add(this.tbxDisplayName);
this.Controls.Add(this.tbxPassword);
this.Controls.Add(this.tbxUserName);
this.Controls.Add(this.tbxServiceUrl);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FrmMain"; this.Name = "FrmMain";
this.Text = "FrmMain"; this.Text = "FrmMain";
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -162,5 +256,13 @@ ...@@ -162,5 +256,13 @@
private System.Windows.Forms.Button btnLogout; private System.Windows.Forms.Button btnLogout;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox tbxDisplayName; private System.Windows.Forms.TextBox tbxDisplayName;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnQueryMember;
private System.Windows.Forms.TextBox tbxFullNameContains;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tbxFirstNameIn;
private System.Windows.Forms.Label label6;
} }
} }
\ No newline at end of file
using System; using Kivii.Organizations.Entities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
...@@ -21,15 +22,21 @@ namespace Kivii.Client.Test.Forms ...@@ -21,15 +22,21 @@ namespace Kivii.Client.Test.Forms
private void btnLogin_Click(object sender, EventArgs e) private void btnLogin_Click(object sender, EventArgs e)
{ {
btnLogin.Enabled = false; btnLogin.Enabled = false;
//创建一个Json数据通讯格式的客户端
_client = new JsonServiceClient(tbxServiceUrl.Text); _client = new JsonServiceClient(tbxServiceUrl.Text);
//设置请求超时
_client.Timeout = TimeSpan.FromSeconds(20); _client.Timeout = TimeSpan.FromSeconds(20);
//定义一个身份认证数据包
var loginRequest = new Authenticate {UserName=tbxUserName.Text,Password=tbxPassword.Text,provider="Kivii" }; var loginRequest = new Authenticate {UserName=tbxUserName.Text,Password=tbxPassword.Text,provider="Kivii" };
//通过异步的方式POST数据到服务器
var tasks=_client.PostAsync(loginRequest); var tasks=_client.PostAsync(loginRequest);
//当成功获取到数据后,异步执行以下的代码
tasks.Success(resp => { tasks.Success(resp => {
btnLogin.Enabled = resp.DisplayName.IsNullOrEmpty(); btnLogin.Enabled = resp.DisplayName.IsNullOrEmpty();
btnLogout.Enabled = !btnLogin.Enabled; btnLogout.Enabled = !btnLogin.Enabled;
tbxDisplayName.Text = resp.DisplayName; tbxDisplayName.Text = resp.DisplayName;
}); });
//当执行错误后,执行以下的代码
tasks.Error(ex => { tasks.Error(ex => {
btnLogin.Enabled = true; btnLogin.Enabled = true;
MessageBox.Show(ex.Message, "Login Error"); MessageBox.Show(ex.Message, "Login Error");
...@@ -41,6 +48,7 @@ namespace Kivii.Client.Test.Forms ...@@ -41,6 +48,7 @@ namespace Kivii.Client.Test.Forms
{ {
if (_client == null) return; if (_client == null) return;
btnLogout.Enabled = false; btnLogout.Enabled = false;
//使当前的_client的身份退出。
var logoutRequest = new Authenticate {provider = "Logout" }; var logoutRequest = new Authenticate {provider = "Logout" };
var tasks = _client.PostAsync(logoutRequest); var tasks = _client.PostAsync(logoutRequest);
...@@ -56,5 +64,21 @@ namespace Kivii.Client.Test.Forms ...@@ -56,5 +64,21 @@ namespace Kivii.Client.Test.Forms
MessageBox.Show(ex.Message, "Logout Error"); MessageBox.Show(ex.Message, "Logout Error");
}); });
} }
private void btnQueryMember_Click(object sender, EventArgs e)
{
if (_client == null) return;
var queryMember = new MemberQuery();
queryMember.FullNameContains = tbxFullNameContains.Text;
queryMember.FirstNameIn = tbxFirstNameIn.Text;
var tasks = _client.PostAsync(queryMember);
tasks.Success(resp => {
var x = "";
});
tasks.Error(ex => {
var x = "";
});
}
} }
} }
...@@ -33,8 +33,9 @@ ...@@ -33,8 +33,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Kivii.Common.V4.5, Version=5.3.2018.7200, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Kivii.Common.V4.5, Version=5.4.2019.3120, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Common.5.3.2018.7200\lib\net45\Kivii.Common.V4.5.dll</HintPath> <HintPath>..\packages\Kivii.Common.5.4.2019.3120\lib\net45\Kivii.Common.V4.5.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Entities\Member.cs" />
<Compile Include="Forms\FrmMain.cs"> <Compile Include="Forms\FrmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Kivii.Common" version="5.3.2018.7200" targetFramework="net45" /> <package id="Kivii.Common" version="5.4.2019.3120" targetFramework="net45" />
</packages> </packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment