Browse Source

验证

Lishi
pry 2 years ago
parent
commit
a5b6140c9f
4 changed files with 37 additions and 5 deletions
  1. +2
    -3
      HKCardManager/Form1.cs
  2. +7
    -1
      HKCardManager/PersonnelEntry.cs
  3. +27
    -0
      HKCardManager/Servers/Extend.cs
  4. +1
    -1
      HKLib/DB/DbContext.cs

+ 2
- 3
HKCardManager/Form1.cs View File

@@ -7,11 +7,10 @@ namespace HKCardManager
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();

Task.Factory.StartNew(() =>
Task.Factory.StartNew(() =>
{ {
DbContext.InitTable(); DbContext.InitTable();
});
});
} }


private void ÈËԱ¼ÈëToolStripMenuItem_Click(object sender, EventArgs e) private void ÈËԱ¼ÈëToolStripMenuItem_Click(object sender, EventArgs e)


+ 7
- 1
HKCardManager/PersonnelEntry.cs View File

@@ -1,4 +1,6 @@
using HKLib.Logic;
using HKLib.Dto;
using HKLib.Interfaces;
using HKLib.Logic;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -33,6 +35,10 @@ namespace HKCardManager
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {


HKLibHelper.AddUser(new UserDto()
{

});
} }
} }
} }

+ 27
- 0
HKCardManager/Servers/Extend.cs View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace HKCardManager
{
public static class Extend
{
/// <summary>
///
/// </summary>
/// <param name="str"></param>
/// <param name="IsStrict"></param>
/// <returns></returns>
public static bool IsMobile(this string str, bool IsStrict = false)
{
if (string.IsNullOrEmpty(str)) return false;
//string regex=@"^1[0123456789]\d{9}$";
Regex.IsMatch(str, @"^(1)\d{10}$");
string regex = IsStrict ? @"^[1][358]\d{9}$" : @"[1]\d{10}";
return Regex.IsMatch(str, regex);
}
}
}

+ 1
- 1
HKLib/DB/DbContext.cs View File

@@ -29,7 +29,7 @@ namespace HKLib.DB
static string Route() static string Route()
{ {
var dir = SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database")); var dir = SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database"));
var r= SyncStatic.CreateFile(Path.Combine(dir, "data.db3"));
var r = SyncStatic.CreateFile(Path.Combine(dir, "data.db3"));
return r; return r;
} }
public static void InitTable() public static void InitTable()


Loading…
Cancel
Save