ソースを参照

去掉本地化

Lishi
xxe 2年前
コミット
77c3461893
11個のファイルの変更55行の追加142行の削除
  1. +0
    -2
      HKCardManager/Form1.cs
  2. +3
    -5
      HKCardManager/UserPages/CarMangerPage.cs
  3. +3
    -3
      HKCardManager/UserPages/InstitutionalEntryPage.cs
  4. +3
    -5
      HKCardManager/UserPages/PersonnelEntryPage.cs
  5. +0
    -44
      HKLib/DB/DbContext.cs
  6. +0
    -20
      HKLib/DB/Model/BaseEntity.cs
  7. +0
    -21
      HKLib/DB/Model/Entity/OrgTable.cs
  8. +31
    -0
      HKLib/Dto/OrgDto.cs
  9. +0
    -1
      HKLib/HKLib.csproj
  10. +15
    -4
      HKLib/Interfaces/HKLibHelper.cs
  11. +0
    -37
      HKLib/Logic/ServiceHandler.cs

+ 0
- 2
HKCardManager/Form1.cs ファイルの表示

@@ -1,4 +1,3 @@
using HKLib.DB;
using HKCardManager.UserPages;
using UHFHelper;

@@ -13,7 +12,6 @@ namespace HKCardManager
DataGridViewInit();
Task.Factory.StartNew(() =>
{
DbContext.InitTable();
var res = UHFCardHelper.GetInstance().OpenPort();
if (res != null && res.Res)
MessageLogNotify.GetInstance.ShowError("制卡设备已连接!");


+ 3
- 5
HKCardManager/UserPages/CarMangerPage.cs ファイルの表示

@@ -1,7 +1,5 @@
using HKLib.DB.Model.Entity;
using HKLib.Dto;
using HKLib.Dto;
using HKLib.Interfaces;
using HKLib.Logic;
using Snowflake.Core;
using System;
using System.Collections.Generic;
@@ -20,7 +18,7 @@ namespace HKCardManager.UserPages
public partial class CarMangerPage : UserControl
{
//List<string> OrgList = new List<string>();
List<OrgTable> orgTables = new List<OrgTable>();
List<OrgDto> orgTables = new List<OrgDto>();
List<string> Personnels = new List<string>();
public CarMangerPage()
{
@@ -35,7 +33,7 @@ namespace HKCardManager.UserPages

radioButton1.Checked = true;
comboBox2.Visible = false;
orgTables = ServiceHandler.GetOrgList();
orgTables = HKLibHelper.GetOrg();
Global.UserListDtos.ForEach(item => { if (!string.IsNullOrEmpty(item.UserName)) Personnels.Add(item.UserName); });
comboBox2.DataSource = Personnels;
comboBox1.DataSource = Global.OrgList;


+ 3
- 3
HKCardManager/UserPages/InstitutionalEntryPage.cs ファイルの表示

@@ -1,5 +1,4 @@
using HKLib.Logic;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -8,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using XExten.Advance.LinqFramework;

namespace HKCardManager.UserPages
{
@@ -36,7 +36,7 @@ namespace HKCardManager.UserPages
Task.Factory.StartNew(() =>
{
this.Invoke(() => { button2.Enabled = false; });
if (ServiceHandler.AddOrg(name))
if (!HKLib.Interfaces.HKLibHelper.SetOrg(name).IsNullOrEmpty())
{
Global.OrgList.Add(name);
MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功");


+ 3
- 5
HKCardManager/UserPages/PersonnelEntryPage.cs ファイルの表示

@@ -1,7 +1,5 @@
using HKLib.DB.Model.Entity;
using HKLib.Dto;
using HKLib.Dto;
using HKLib.Interfaces;
using HKLib.Logic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -16,14 +14,14 @@ namespace HKCardManager.UserPages
{
public partial class PersonnelEntryPage : UserControl
{
List<OrgTable> orgTables = new List<OrgTable>();
List<OrgDto> orgTables = new List<OrgDto>();

public PersonnelEntryPage()
{
InitializeComponent();
DataGridViewInit();
EventInit();
orgTables = ServiceHandler.GetOrgList();
orgTables = HKLibHelper.GetOrg();
Global.OrgList.Clear();
orgTables?.ForEach(item => { Global.OrgList.Add(item.Name); });
comboBox2.DataSource = Global.OrgList;


+ 0
- 44
HKLib/DB/DbContext.cs ファイルの表示

@@ -1,44 +0,0 @@
using HKLib.DB.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using XExten.Advance.StaticFramework;

namespace HKLib.DB
{
public class DbContext
{
public static SqlSugarScope Context = new SqlSugarScope(new ConnectionConfig()
{
ConnectionString = Route,
DbType = DbType.Sqlite,//数据库类型
IsAutoCloseConnection = true //不设成true要手动close
}, db =>
{
db.Aop.OnLogExecuting = (sql, pars) =>
{

};
});

public static string Route
{
get
{
var dir = SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database"));
return $"DataSource={SyncStatic.CreateFile(Path.Combine(dir, "Data.db3"))}";
}
}
public static void InitTable()
{
var Tables = Assembly.GetAssembly(typeof(DbContext))
.GetTypes().Where(t => t.BaseType == typeof(BaseEntity)).ToArray();
Context.CodeFirst.InitTables(Tables);
}
}
}

+ 0
- 20
HKLib/DB/Model/BaseEntity.cs ファイルの表示

@@ -1,20 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace HKLib.DB.Model
{
public class BaseEntity
{
[SugarColumn(IsPrimaryKey = true)]
public Guid Id { get; set; }
[SugarColumn(ColumnDataType = "DATETIME")]
public DateTime CreateTime { get; set; }
public void Create()
{
this.Id = Guid.NewGuid();
this.CreateTime = DateTime.Now;
}
}
}

+ 0
- 21
HKLib/DB/Model/Entity/OrgTable.cs ファイルの表示

@@ -1,21 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace HKLib.DB.Model.Entity
{
[SugarTable("Org")]
public class OrgTable : BaseEntity
{
/// <summary>
/// 机构名称
/// </summary>
public string Name { get; set; }

/// <summary>
/// 加盟返回的Id
/// </summary>
public string SId { get; set; }
}
}

+ 31
- 0
HKLib/Dto/OrgDto.cs ファイルの表示

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace HKLib.Dto
{
public class OrgDto
{
/// <summary>
/// 机构名称
/// </summary>
public string Name { get; set; }

/// <summary>
/// 加盟返回的Id
/// </summary>
public string SId { get; set; }
}
internal class OrgOutDto
{
/// <summary>
/// 机构名称
/// </summary>
public string Name { get; set; }

/// <summary>
/// 加盟返回的Id
/// </summary>
public string Id { get; set; }
}
}

+ 0
- 1
HKLib/HKLib.csproj ファイルの表示

@@ -8,6 +8,5 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
<PackageReference Include="XExten.Advance" Version="1.2.4.2-preview" />
<PackageReference Include="SqlSugarCore" Version="5.1.2.7" />
</ItemGroup>
</Project>

+ 15
- 4
HKLib/Interfaces/HKLibHelper.cs ファイルの表示

@@ -76,10 +76,21 @@ namespace HKLib.Interfaces
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"]["id"].ToString();
}

//public static string GetKou()
//{
///// api / GateInfo / gatelist ? StoreId = 0c32b2e2 - 0dc9 - 4941 - b73d - 3dc91f7268ab & Current = 1 & PageSize = 10
//}
public static List<OrgDto> GetOrg()
{
var data = IHttpMultiClient.HttpMulti

.AddNode(t =>
{
t.NodePath = $"{Configer.SaasRoute}api/one-card/member-tag-list";
t.ReqType = MultiType.GET;
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"].ToJson().ToModel<List<OrgOutDto>>();
return data.Where(t => !t.Name.IsNullOrEmpty()).Select(t => new OrgDto
{
Name = t.Name,
SId = t.Id
}).ToList();
}

/// <summary>
/// 修改机构


+ 0
- 37
HKLib/Logic/ServiceHandler.cs ファイルの表示

@@ -1,37 +0,0 @@
using HKLib.DB;
using HKLib.DB.Model.Entity;
using HKLib.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;

namespace HKLib.Logic
{
public class ServiceHandler
{
#region 机构类
public static bool AddOrg(string Name)
{
var check = DbContext.Context.Queryable<OrgTable>().First(t => t.Name == Name);
if (check != null) return false;
var SiD = HKLibHelper.SetOrg(Name);
return DbContext.Context.Insertable(new OrgTable
{
Name = Name,
SId = SiD
}).CallEntityMethod(t => t.Create()).ExecuteCommand() > 0;
}
public static List<OrgTable> GetOrgList()
{
return DbContext.Context.Queryable<OrgTable>().ToList();
}
public static bool AlterOrg(string Name, string Id)
{
var s = HKLibHelper.AlterOrg(Name, Id);
if (s)
return DbContext.Context.Updateable<OrgTable>().SetColumns(t => t.Name == Name).Where(t => t.SId == Id).ExecuteCommandHasChange();
else return false;
}
#endregion
}
}

読み込み中…
キャンセル
保存