客堂登記報名

This commit is contained in:
2026-08-04 18:06:23 +08:00
parent da913d2584
commit d6c817475c
6 changed files with 465 additions and 42 deletions
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyWeb
{
/// <summary>
/// autoNum 的摘要描述
/// </summary>
public class autoNum
{
private Model.ezEntities _db = new Model.ezEntities();
public autoNum()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
public string createOrderNumber()
{
//Application.Lock();
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
var qry = _db.companies.AsQueryable();
//var prod = qry.Where(q => q.last_order_no.Contains(order_no)).FirstOrDefault();
var prod = qry.Where(q => q.num == 1).FirstOrDefault();
if (prod != null)
{
if (!string.IsNullOrEmpty(prod.last_order_no) && prod.last_order_no.Contains(order_no))
{
int tmp = Convert.ToInt32(prod.last_order_no.Replace(order_no, "")) + 1;
order_no = order_no + tmp.ToString("0000");
}
else
{
order_no = order_no + "0001";
}
prod.last_order_no = order_no;
_db.SaveChanges();
}
else
order_no = "";
//Application.UnLock();
return order_no;
}
}
}