Commit af383681 authored by 吴春's avatar 吴春

团号随机数

parent c5a494c2
......@@ -5,6 +5,7 @@ using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.GetTaxiInvoiceDriverResponse.Types.Photo.Types;
namespace REBORN.Common.Plugin
{
......@@ -13,9 +14,33 @@ namespace REBORN.Common.Plugin
/// </summary>
public class StringHelper
{
private const string digits = "0123456789";
private const string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static Random random = new Random();
#region "随机数"
/// <summary>
/// 生成9位数字+1位字母
/// </summary>
/// <returns></returns>
public static string GenerateRandomString()
{
char[] result = new char[10];
// 先填充9位数字
for (int i = 0; i < 9; i++)
{
result[i] = (char)random.Next('0', '9' + 1);
}
// 生成1位字母
char letter = (char)random.Next('A', 'Z' + 1);
// 随机选择一个位置插入字母
int letterPosition = random.Next(10);
result[letterPosition] = letter;
return new string(result);
}
/// <summary>
/// 随机生成8位随机数
......@@ -148,7 +173,7 @@ namespace REBORN.Common.Plugin
{
if (!dStart.HasValue || !dEnd.HasValue) return new TimeSpan();
TimeSpan ts = (dEnd.Value - dStart.Value);
ts=ts.Add(new TimeSpan(0,Convert.ToInt32((startUTCZone - endUTCZone)*60),0));
ts = ts.Add(new TimeSpan(0, Convert.ToInt32((startUTCZone - endUTCZone) * 60), 0));
return ts;
}
/// <summary>
......@@ -636,7 +661,7 @@ namespace REBORN.Common.Plugin
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static bool IsActive( DateTime now, DateTime start, DateTime end)
public static bool IsActive(DateTime now, DateTime start, DateTime end)
{
return now >= start && now <= end;
}
......@@ -646,7 +671,7 @@ namespace REBORN.Common.Plugin
/// <param name="now"></param>
/// <param name="end"></param>
/// <returns></returns>
public static bool IsExpired( DateTime now, DateTime end)
public static bool IsExpired(DateTime now, DateTime end)
{
return now > end;
}
......@@ -657,7 +682,7 @@ namespace REBORN.Common.Plugin
/// <param name="now"></param>
/// <param name="start"></param>
/// <returns></returns>
public static bool IsFuture( DateTime now, DateTime start)
public static bool IsFuture(DateTime now, DateTime start)
{
return now < start;
}
......@@ -1972,7 +1997,7 @@ namespace REBORN.Common.Plugin
/// <param name="Name">名</param>
public static void GetChinseSurNameAndName(string value, out string SurName, out string Name)
{
List<string> compoundSurnames = new List<string> { "欧阳", "司马", "诸葛", "慕容", "上官", "公孙", "皇甫", "端木"};
List<string> compoundSurnames = new List<string> { "欧阳", "司马", "诸葛", "慕容", "上官", "公孙", "皇甫", "端木" };
SurName = "";
Name = "";
if (!string.IsNullOrEmpty(value))
......@@ -1981,7 +2006,7 @@ namespace REBORN.Common.Plugin
if (value.Length >= 2 && compoundSurnames.Contains(value.Substring(0, 2)))
{
SurName = value.Substring(0, 2);
Name = value.Length > 2 ? value.Substring(2):"";
Name = value.Length > 2 ? value.Substring(2) : "";
}
else
{
......
......@@ -5589,7 +5589,7 @@ namespace REBORN.Module.SellModule
tmodel.OutBranchId = userInfo.RB_Branch_id;
tmodel.RB_Group_Id = dmodel.RB_Group_Id;
tmodel.RB_Department_Id = userInfo.RB_Department_Id;
tmodel.TCNUM = tmodel.StartDate.Value.ToString("yyyyMMddHHmmssfff");
tmodel.TCNUM = StringHelper.FormatDate(tmodel.StartDate) +StringHelper.GenerateRandomString();
tmodel.Status = GroupStateEnum.Normal;
tmodel.TCState = TravelSaleStateEnum.SaleTeam;
var hotelId = travel_PriceRepository.Insert(tmodel);
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