重寫信眾編號程式
This commit is contained in:
@@ -27,8 +27,6 @@
|
||||
//GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
|
||||
//註冊自訂路由
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
InitializeFNumberSerial();//啟動項目的時候查詢出信眾編號的最大值放在記憶體中
|
||||
|
||||
//bundle js、css
|
||||
//BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
|
||||
@@ -63,38 +61,4 @@
|
||||
System.Web.HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
|
||||
}
|
||||
|
||||
private void InitializeFNumberSerial()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var _db = new Model.ezEntities())
|
||||
{
|
||||
var maxFNumber = _db.followers
|
||||
.Where(m =>
|
||||
////m.IsDel == false && ////不確定是否新增欄位? 先註解
|
||||
m.f_number.Length == 14 &&
|
||||
(m.f_number.StartsWith("M") || m.f_number.StartsWith("F")))
|
||||
.OrderByDescending(m => m.reg_time)
|
||||
.Select(m => m.f_number)
|
||||
.FirstOrDefault();
|
||||
|
||||
int nextSerial = 0;
|
||||
if (!string.IsNullOrEmpty(maxFNumber))
|
||||
{
|
||||
try
|
||||
{
|
||||
var serialPart = maxFNumber.Substring(9, 5);
|
||||
nextSerial = int.Parse(serialPart);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
Application["FNumberSerial"] = nextSerial;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Application["FNumberSerial"] = 0;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user