You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.1 KiB
61 lines
2.1 KiB
|
1 week ago
|
using SunlightAggregationTerminal.Class;
|
||
|
|
using SunlightAggregationTerminal.Models;
|
||
|
|
using System.Data;
|
||
|
|
|
||
|
|
namespace SunlightAggregationTerminal.View;
|
||
|
|
|
||
|
|
public partial class LogPage : ContentPage
|
||
|
|
{
|
||
|
|
public static Action<string>? OnScanProfile;
|
||
|
|
public LogPage()
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
OnScanProfile = (result) =>
|
||
|
|
{
|
||
|
|
MainThread.BeginInvokeOnMainThread(() =>
|
||
|
|
{
|
||
|
|
Enterprise.Text = result;
|
||
|
|
});
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnScanButtonClicked(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
// 跳转到扫码页面
|
||
|
|
var scanPage = new ScanPage(3);
|
||
|
|
Navigation.PushAsync(scanPage);
|
||
|
|
}
|
||
|
|
|
||
|
|
private async void Log_Clicked(object sender, EventArgs e)//登录
|
||
|
|
{
|
||
|
|
TcpServer.Configuration(Enterprise.Text, UsernameEntry.Text, PasswordEntry.Text,
|
||
|
|
Models.AppModels.GetAppUniqueId());
|
||
|
|
|
||
|
|
// while(!App.GlobalData.LogNo);
|
||
|
|
/*
|
||
|
|
var temp_name = AppModels.Select("SELECT * FROM Users WHERE User='" + UsernameEntry.Text + "' LIMIT 1;");
|
||
|
|
if (temp_name != null)
|
||
|
|
{
|
||
|
|
//存在更新账号状态
|
||
|
|
//var name = temp_name.Tables[0].AsEnumerable().FirstOrDefault();
|
||
|
|
|
||
|
|
string sql = @"UPDATE Users SET ServerID = '" + Enterprise.Text
|
||
|
|
+ "', UserPassword = '" + PasswordEntry.Text+
|
||
|
|
"', LogNo = true WHERE User='" + UsernameEntry.Text + "';";
|
||
|
|
AppModels.Updata(sql);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
//插入账号
|
||
|
|
string sql = @"INSERT INTO Users (User,UserId ,UserName ,UserPassword ,
|
||
|
|
Enterprise ,Department ,ServerID ,Groups ,
|
||
|
|
ProxyID ,LogNo ,LocalAreaNetworkMode ,DarkMode ,
|
||
|
|
MessageNotificationMode ,GUID
|
||
|
|
)VALUES('"+ UsernameEntry.Text + "','SUNLIGHT','SUNLIGHT','"+ PasswordEntry.Text +
|
||
|
|
"','SUNLIGHT','ENGINEER','"+ Enterprise.Text + "','ENGINEER',"+
|
||
|
|
" '',0,0,0,0,'" + Models.AppModels.GetAppUniqueId() + "');";
|
||
|
|
AppModels.INSERT(sql);
|
||
|
|
}*/
|
||
|
|
await Navigation.PopModalAsync();
|
||
|
|
}
|
||
|
|
}
|