1. 加上返回鍵

2. 修改報名記錄中的活動開始結束時間
3. 修正列印問題
4. 信眾資料及報名管理起始不會出現資料
5. 信眾不得重複報名相同活動
6. 信眾資料的 cache(含結果與搜尋條件)
7. 修復信眾、活動、品項刪除功能
8. 增加自訂是否自動編號
9. 優化信眾資料頁面(彈出查詢頁面、顯示剛新增資料)
10. 新增管理表單匯出 excel 功能
11. 無查詢資料時不可點選匯出/列印按鈕
12. 匯出/列印管理報表時,若無資料則顯示提示
13. 新增信眾資料時,加入日期預設為今日
This commit is contained in:
2026-04-09 17:37:00 +08:00
parent 46cbcbde4c
commit aa5941a324
22 changed files with 890 additions and 529 deletions
+38 -38
View File
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 這個程式碼是由範本產生。 // 這個程式碼是由範本產生。
// //
// 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。 // 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。
// 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。 // 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -14,19 +14,19 @@ namespace Model
using System.Data.Entity.Infrastructure; using System.Data.Entity.Infrastructure;
using System.Data.Entity.Core.Objects; using System.Data.Entity.Core.Objects;
using System.Linq; using System.Linq;
public partial class ezEntities : DbContext public partial class ezEntities : DbContext
{ {
public ezEntities() public ezEntities()
: base("name=ezEntities") : base("name=ezEntities")
{ {
} }
protected override void OnModelCreating(DbModelBuilder modelBuilder) protected override void OnModelCreating(DbModelBuilder modelBuilder)
{ {
throw new UnintentionalCodeFirstException(); throw new UnintentionalCodeFirstException();
} }
public virtual DbSet<accounting> accountings { get; set; } public virtual DbSet<accounting> accountings { get; set; }
public virtual DbSet<accounting_files> accounting_files { get; set; } public virtual DbSet<accounting_files> accounting_files { get; set; }
public virtual DbSet<accounting_kind> accounting_kind { get; set; } public virtual DbSet<accounting_kind> accounting_kind { get; set; }
@@ -94,134 +94,134 @@ namespace Model
public virtual DbSet<AncestralTabletRegistrant> AncestralTabletRegistrant { get; set; } public virtual DbSet<AncestralTabletRegistrant> AncestralTabletRegistrant { get; set; }
public virtual DbSet<AncestralTabletStatus> AncestralTabletStatus { get; set; } public virtual DbSet<AncestralTabletStatus> AncestralTabletStatus { get; set; }
public virtual DbSet<GuaDanOrderGuest> GuaDanOrderGuest { get; set; } public virtual DbSet<GuaDanOrderGuest> GuaDanOrderGuest { get; set; }
public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount) public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount)
{ {
var startRowIndexParameter = startRowIndex.HasValue ? var startRowIndexParameter = startRowIndex.HasValue ?
new ObjectParameter("StartRowIndex", startRowIndex) : new ObjectParameter("StartRowIndex", startRowIndex) :
new ObjectParameter("StartRowIndex", typeof(int)); new ObjectParameter("StartRowIndex", typeof(int));
var pageSizeParameter = pageSize.HasValue ? var pageSizeParameter = pageSize.HasValue ?
new ObjectParameter("PageSize", pageSize) : new ObjectParameter("PageSize", pageSize) :
new ObjectParameter("PageSize", typeof(int)); new ObjectParameter("PageSize", typeof(int));
var tableNameParameter = tableName != null ? var tableNameParameter = tableName != null ?
new ObjectParameter("tableName", tableName) : new ObjectParameter("tableName", tableName) :
new ObjectParameter("tableName", typeof(string)); new ObjectParameter("tableName", typeof(string));
var columnNameParameter = columnName != null ? var columnNameParameter = columnName != null ?
new ObjectParameter("columnName", columnName) : new ObjectParameter("columnName", columnName) :
new ObjectParameter("columnName", typeof(string)); new ObjectParameter("columnName", typeof(string));
var sqlWhereParameter = sqlWhere != null ? var sqlWhereParameter = sqlWhere != null ?
new ObjectParameter("sqlWhere", sqlWhere) : new ObjectParameter("sqlWhere", sqlWhere) :
new ObjectParameter("sqlWhere", typeof(string)); new ObjectParameter("sqlWhere", typeof(string));
var orderByParameter = orderBy != null ? var orderByParameter = orderBy != null ?
new ObjectParameter("orderBy", orderBy) : new ObjectParameter("orderBy", orderBy) :
new ObjectParameter("orderBy", typeof(string)); new ObjectParameter("orderBy", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("pager_eztrust", startRowIndexParameter, pageSizeParameter, tableNameParameter, columnNameParameter, sqlWhereParameter, orderByParameter, rowCount); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("pager_eztrust", startRowIndexParameter, pageSizeParameter, tableNameParameter, columnNameParameter, sqlWhereParameter, orderByParameter, rowCount);
} }
public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition) public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ? var versionParameter = version.HasValue ?
new ObjectParameter("version", version) : new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int)); new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ? var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) : new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[])); new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
} }
public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition) public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ? var versionParameter = version.HasValue ?
new ObjectParameter("version", version) : new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int)); new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ? var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) : new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[])); new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
} }
public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id) public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
} }
public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id) public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
} }
public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id) public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
} }
public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname) public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
{ {
var diagramnameParameter = diagramname != null ? var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) : new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string)); new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ? var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) : new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int)); new ObjectParameter("owner_id", typeof(int));
var new_diagramnameParameter = new_diagramname != null ? var new_diagramnameParameter = new_diagramname != null ?
new ObjectParameter("new_diagramname", new_diagramname) : new ObjectParameter("new_diagramname", new_diagramname) :
new ObjectParameter("new_diagramname", typeof(string)); new ObjectParameter("new_diagramname", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
} }
public virtual int sp_upgraddiagrams() public virtual int sp_upgraddiagrams()
{ {
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams"); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
+1 -1
View File
@@ -1,4 +1,4 @@
// 已啟用模型 'D:\17168ERP\web\App_Code\Model\Model.edmx' 的 T4 程式碼產生。 // 已啟用模型 'E:\17168ERP\web\App_Code\Model\Model.edmx' 的 T4 程式碼產生。
// 若要啟用舊版程式碼產生,請將 [程式碼產生策略] 設計工具屬性的值 // 若要啟用舊版程式碼產生,請將 [程式碼產生策略] 設計工具屬性的值
//變更為 [舊版 ObjectContext]。當模型在設計工具中開啟時,這個屬性便可 //變更為 [舊版 ObjectContext]。當模型在設計工具中開啟時,這個屬性便可
//以在 [屬性] 視窗中使用。 //以在 [屬性] 視窗中使用。
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -9,7 +9,7 @@
<EntityTypeShape EntityType="Model.accounting_files" Width="1.5" PointX="15.75" PointY="27.75" IsExpanded="true" /> <EntityTypeShape EntityType="Model.accounting_files" Width="1.5" PointX="15.75" PointY="27.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind" Width="1.5" PointX="11.25" PointY="27.625" IsExpanded="true" /> <EntityTypeShape EntityType="Model.accounting_kind" Width="1.5" PointX="11.25" PointY="27.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind2" Width="1.5" PointX="13.5" PointY="11.25" IsExpanded="true" /> <EntityTypeShape EntityType="Model.accounting_kind2" Width="1.5" PointX="13.5" PointY="11.25" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem" Width="1.5" PointX="9.25" PointY="7.875" IsExpanded="true" /> <EntityTypeShape EntityType="Model.actItem" Width="1.5" PointX="8.375" PointY="27.25" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_files" Width="1.5" PointX="16.5" PointY="5.875" IsExpanded="true" /> <EntityTypeShape EntityType="Model.actItem_files" Width="1.5" PointX="16.5" PointY="5.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_kind" Width="1.5" PointX="6.125" PointY="7.875" IsExpanded="true" /> <EntityTypeShape EntityType="Model.actItem_kind" Width="1.5" PointX="6.125" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity" Width="1.5" PointX="3" PointY="8.875" IsExpanded="true" /> <EntityTypeShape EntityType="Model.activity" Width="1.5" PointX="3" PointY="8.875" IsExpanded="true" />
+1 -1
View File
@@ -28,7 +28,7 @@ namespace MyWeb
public AdmItem info { get; set; } public AdmItem info { get; set; }
//定義欄位cookie==================start //定義欄位cookie==================start
public class AdmItem public class AdmItem
{ {
public int num { get; set; } public int num { get; set; }
public string u_id { get; set; } public string u_id { get; set; }
+12 -9
View File
@@ -103,17 +103,18 @@ public class FollowerController : ApiController
{ {
foreach (var item in prod) foreach (var item in prod)
{ {
foreach (var item2 in item.pro_order_detail1) //foreach (var item2 in item.pro_order_detail1)
item2.from_id = null; //清空訂單明細的陽上報恩者from_id //f_num設定串聯刪除 // item2.from_id = null; //清空訂單明細的陽上報恩者from_id //f_num設定串聯刪除
foreach (var item2 in item.pro_order) //foreach (var item2 in item.pro_order)
item2.introducer = null; // item2.introducer = null;
item.leader = null;//清空leader //item.leader = null;//清空leader
_db.followers.RemoveRange(prod);
} }
_db.followers.RemoveRange(prod); //_db.followers.RemoveRange(prod);
_db.SaveChanges(); _db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log(); Model.admin_log admin_log = new Model.admin_log();
@@ -173,7 +174,7 @@ public class FollowerController : ApiController
} }
} }
// 電話/證號搜尋 (使用 search_keywords HEX 編碼) // 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!string.IsNullOrEmpty(q.phone_idcode) && GlobalVariables.UseSearchKeywords) if (!string.IsNullOrEmpty(q.phone_idcode) && GlobalVariables.UseSearchKeywords)
{ {
@@ -655,8 +656,10 @@ public class FollowerController : ApiController
list = orderrecord.Select(x => new list = orderrecord.Select(x => new
{ {
orderno = x.order_no, orderno = x.order_no,
startdate = x.reg_time, //startdate = x.reg_time,
endtime = x.up_time, //endtime = x.up_time,
startdate = x.activity.startDate_solar,
enddate = x.activity.endDate_solar,
pwcount = x.pro_order_detail.Where(a => a.actItem.act_bom.Where(b => b.item_num == a.actItem_num && b.package_num == null).Count() == 0).Count(), pwcount = x.pro_order_detail.Where(a => a.actItem.act_bom.Where(b => b.item_num == a.actItem_num && b.package_num == null).Count() == 0).Count(),
amount = x.pro_order_detail.Select(o => (float?)o.price).Sum(), amount = x.pro_order_detail.Select(o => (float?)o.price).Sum(),
activityname = x.activity.subject, activityname = x.activity.subject,
+25 -11
View File
@@ -1,14 +1,16 @@
using System; using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using Newtonsoft.Json;
using Org.BouncyCastle.Crypto;
using PagedList;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Entity;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Web.Http; using System.Web.Http;
using PagedList;
using Newtonsoft.Json;
using System.Collections;
using static TreeView; using static TreeView;
using System.Data.Entity;
// api/activity // api/activity
//[ezAuthorize(Roles = "admin")]//群組:* //[ezAuthorize(Roles = "admin")]//群組:*
@@ -126,6 +128,12 @@ public class activityController : ApiController
if (prod != null) if (prod != null)
{ {
////prod.IsDel = true; ////不確定是否新增欄位? 先註解 ////prod.IsDel = true; ////不確定是否新增欄位? 先註解
// 先刪除子項目
var prod2 = _db.act_bom.Where(q => q.package_num == prod.num).ToList();
_db.act_bom.RemoveRange(prod2);
_db.actItems.Remove(prod);
_db.SaveChanges(); _db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log(); Model.admin_log admin_log = new Model.admin_log();
MyWeb.admin admin = new MyWeb.admin();//api裡不可以用MyWeb MyWeb.admin admin = new MyWeb.admin();//api裡不可以用MyWeb
@@ -190,12 +198,18 @@ public class activityController : ApiController
if (prod.Count() > 0) if (prod.Count() > 0)
{ {
//var prod2 = _db.actItem_files.AsEnumerable().Where(q => ids.Contains(Convert.ToInt32(q.actItem_num))).ToList(); //var prod2 = _db.actItem_files.AsEnumerable().Where(q => ids.Contains(Convert.ToInt32(q.actItem_num))).ToList();
var prod2 = _db.actItem_files.Where(q => ids.Contains(q.actItem_num)).ToList(); //var prod2 = _db.actItem_files.Where(q => ids.Contains(q.actItem_num)).ToList();
if (prod2.Count > 0) //if (prod2.Count > 0)
{ //{
_db.actItem_files.RemoveRange(prod2); // _db.actItem_files.RemoveRange(prod2);
//_db.SaveChanges(); // //_db.SaveChanges();
} //}
// 先刪除子項目
var parentBoms = _db.act_bom.Where(q => q.item_num.HasValue && ids.Contains(q.item_num.Value)).ToList();
var parentIds = parentBoms.Select(x => x.num).ToList(); // 取得母件 id
var childBoms = _db.act_bom.Where(q => q.package_num.HasValue && parentIds.Contains(q.package_num.Value)).ToList();
_db.act_bom.RemoveRange(childBoms);
_db.actItems.RemoveRange(prod); _db.actItems.RemoveRange(prod);
_db.SaveChanges(); _db.SaveChanges();
+10 -9
View File
@@ -1,17 +1,18 @@
using System; using DocumentFormat.OpenXml.Drawing.Charts;
using Model;
using MyWeb;
using Newtonsoft.Json;
using PagedList;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IdentityModel.Metadata;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Web.Http; using System.Web.Http;
using PagedList;
using Newtonsoft.Json;
using System.Collections;
using static TreeView; using static TreeView;
using Model;
using System.IdentityModel.Metadata;
using MyWeb;
using DocumentFormat.OpenXml.Drawing.Charts;
// api/order // api/order
@@ -683,7 +684,7 @@ public class orderController : ApiController
.Where(q => q.num == item.num) .Where(q => q.num == item.num)
.FirstOrDefault();//修改 .FirstOrDefault();//修改
if (order != null) if (order != null)
{ {
order.actItem_num = (item.actItem_num.HasValue && item.actItem_num.Value > 0) order.actItem_num = (item.actItem_num.HasValue && item.actItem_num.Value > 0)
? item.actItem_num : null; ? item.actItem_num : null;
order.f_num = (item.f_num.HasValue && item.f_num.Value > 0) order.f_num = (item.f_num.HasValue && item.f_num.Value > 0)
@@ -16,6 +16,7 @@
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound"> <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate> <ItemTemplate>
<a class="nav-link" href="<%#ResolveUrl(ValString(Eval("url"))) %>" <a class="nav-link" href="<%#ResolveUrl(ValString(Eval("url"))) %>"
onclick="sessionStorage.removeItem('member_list_cache');sessionStorage.removeItem('member_query_params');"
target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>"> target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>">
<%#Eval("title") %></a> <%#Eval("title") %></a>
</ItemTemplate> </ItemTemplate>
+1 -1
View File
@@ -260,7 +260,7 @@ public partial class admin_follower_import : MyWeb.config
follower.introducer = ValString(sheet.Cells[currentRow, 17].Text.Trim()); follower.introducer = ValString(sheet.Cells[currentRow, 17].Text.Trim());
//檢查國籍代碼是否存在 //檢查國籍代碼是否存在
var country = _country.Where(x => x.name_zh == ValString(sheet.Cells[currentRow, 18].Text.Trim())).FirstOrDefault(); var country = _country.Where(x => x.name_zh == ValString(sheet.Cells[currentRow, 18].Text.Trim())).FirstOrDefault();
if(country != null) if(country != null)
{ {
//follower.country = ValString(sheet.Cells[currentRow, 18].Text.Trim()); //follower.country = ValString(sheet.Cells[currentRow, 18].Text.Trim());
+161 -19
View File
@@ -13,10 +13,12 @@
<a @click="print_dialog.show=true" class="btn btn-outline-primary btn-print" target="_blank"> <a @click="print_dialog.show=true" class="btn btn-outline-primary btn-print" target="_blank">
<i class="mdi mdi-printer"></i>列印管理報表 <i class="mdi mdi-printer"></i>列印管理報表
</a> </a>
<a @click="goPrint" class="btn btn-outline-primary btn-print" target="_blank"> <a @click="goPrint" class="btn btn-outline-primary btn-print" :class="{ 'disabled': data_table.list.length === 0 }" target="_blank">
<i class="mdi mdi-printer"></i>列印查詢資料 <i class="mdi mdi-printer"></i>列印查詢資料
</a> </a>
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success" OnClick="excel_Click"><span class="fa-solid fa-file-excel"></span> 匯出Excel</asp:LinkButton> <div :style="data_table.list.length === 0 ? 'pointer-events: none; opacity: 0.5;' : ''" style="display:inline-block;">
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success" OnClick="export_Click"><span class="fa-solid fa-file-excel"></span> 匯出查詢資料(Excel</asp:LinkButton>
</div>
</div> </div>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
@@ -24,11 +26,13 @@
Vue.filter('timeString', function (value, myFormat) { Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss'); return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
}); });
let VueApp=new Vue({ let VueApp = new Vue({
el: '#app', el: '#app',
vuetify: new Vuetify(vuetify_options), vuetify: new Vuetify(vuetify_options),
data() { data() {
return { return {
isSearched: false,
print_error_msg: '',
options: { multiSort: false }, options: { multiSort: false },
search_options: { multiSort: false }, search_options: { multiSort: false },
data_table: { data_table: {
@@ -38,10 +42,10 @@
singleSelect: false, singleSelect: false,
count: 0, count: 0,
page: 1, page: 1,
pageSize: 10, pageSize: 10,
header: [ header: [
{ text: '信眾編號', value: 'f_number', align: 'start' }, { text: '信眾編號', value: 'f_number', align: 'start' },
{ text: '信眾姓名', value: 'u_name'}, { text: '信眾姓名', value: 'u_name' },
{ text: '身分別', value: 'identity_type_desc' }, { text: '身分別', value: 'identity_type_desc' },
{ text: '性別', value: 'sex' }, { text: '性別', value: 'sex' },
{ text: '生日', value: 'birthday' }, { text: '生日', value: 'birthday' },
@@ -49,9 +53,9 @@
{ text: '', value: 'slot', sortable: false }, { text: '', value: 'slot', sortable: false },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }, { text: '', value: 'slot_btn', sortable: false, align: 'end' },
], ],
footer:{ footer: {
showFirstLastPage: true, showFirstLastPage: true,
pageSizeOptions:[5,10,20,30], pageSizeOptions: [5, 10, 20, 30],
}, },
}, },
search: { search: {
@@ -60,7 +64,7 @@
sex: '', sex: '',
//birthday: new Date().toISOString().split('T')[0], //birthday: new Date().toISOString().split('T')[0],
//birthday2: new Date().toISOString().split('T')[0] //birthday2: new Date().toISOString().split('T')[0]
birthday:'', birthday: '',
birthday2: '', birthday2: '',
address: '', address: '',
country: '', country: '',
@@ -69,14 +73,14 @@
/*注意這邊的參數不能跟下方print_search重複*/ /*注意這邊的參數不能跟下方print_search重複*/
}, },
//列印管理報表 //列印管理報表
print_conditions:'yy', print_conditions: 'yy',
print_search: { print_search: {
year: '', year: '',
month: '', month: '',
season: '', season: '',
}, },
select_items: { select_items: {
month: [{ month: [{
text: "請選擇", text: "請選擇",
val: 0 val: 0
},], },],
@@ -126,13 +130,18 @@
itemsPerPageText: '', itemsPerPageText: '',
}, },
}, },
} }
}, },
watch: { watch: {
options: { options: {
handler() { handler() {
this.getList() if (this.isSearched) {
this.getList()
}
else {
this.data_table.loading = false;
}
}, },
deep: true, deep: true,
}, },
@@ -141,23 +150,118 @@
this.search_get() this.search_get()
}, },
deep: true, deep: true,
}, }
}, mounted() { }, mounted() {
const printResult = document.getElementById('<%= hid_err_msg.ClientID %>').value;
document.getElementById('<%= hid_err_msg.ClientID %>').value = '';
window._printResult = printResult
this.search_dialog.current = this.search_dialog.controls.search1 ///default this.search_dialog.current = this.search_dialog.controls.search1 ///default
this.initPrintSearch(); this.initPrintSearch();
const navEntries = performance.getEntriesByType("navigation"); const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload"; const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
const url = new URL(window.location.href);
let params = url.searchParams;
if (params.get('dirty') === '1') { // 資料有更新時執行 getlist
this.search = JSON.parse(sessionStorage.getItem("member_query_params"));
this.getList();
params.delete('dirty');
window.history.replaceState({}, '', url.pathname + url.search);
}
if (isReload) { if (isReload) {
sessionStorage.removeItem("followerpage"); sessionStorage.removeItem("followerpage");
sessionStorage.removeItem("member_list_cache");
sessionStorage.removeItem("member_query_params");
}
else if ("<%=lastAddedID%>" !== "") {
const newQuery = { f_number: '<%=lastAddedID%>' };
sessionStorage.setItem('member_query_params', JSON.stringify(newQuery));
this.search = newQuery;
this.isSearched = true;
} }
else { else {
const savedPage = parseInt(sessionStorage.getItem('followerpage')); const savedPage = parseInt(sessionStorage.getItem('followerpage'));
const savedData = sessionStorage.getItem("member_list_cache");
const savedQuery = JSON.parse(sessionStorage.getItem("member_query_params"));
if (savedQuery) {
this.search = savedQuery;
this.isSearched = true;
}
if (savedPage) { if (savedPage) {
this.options.page = savedPage; this.options.page = savedPage;
} }
if (savedData && savedData !== "undefined") {
this.data_table = JSON.parse(savedData);
this.isSearched = true;
}
} }
//if (params.has('year')) {
// this.print_search.year = parseInt(params.get('year'));
// this.print_dialog.show = true;
//}
//if (params.has('month')) {
// this.print_search.month = parseInt(params.get('month'));
// this.print_dialog.show = true;
//}
//if (params.has('season')) {
// this.print_search.season = parseInt(params.get('season'));
// this.print_dialog.show = true;
//}
//if (params.has('mode')) {
// this.print_conditions = params.get('mode');
// this.print_dialog.show = true;
//}
if (printResult === 'nodata' || printResult === 'success') {
this.$nextTick(() => {
this.print_search.year = parseInt(document.getElementById('<%= hid_print_year.ClientID %>').value) || this.print_search.year;
this.print_search.month = parseInt(document.getElementById('<%= hid_print_month.ClientID %>').value) || this.print_search.month;
this.print_search.season = parseInt(document.getElementById('<%= hid_print_season.ClientID %>').value) || this.print_search.season;
this.print_conditions = document.getElementById('<%= hid_print_mode.ClientID %>').value || 'yy';
this.print_dialog.show = true;
if (printResult === 'nodata') {
this.print_error_msg = "查無資料,請重新選擇區間";
}
});
}
this.$nextTick(() => {
setTimeout(() => {
['year', 'month', 'season', 'mode', 'msg'].forEach(p => params.delete(p));
window.history.replaceState({}, '', url.pathname + url.search);
}, 100);
});
}, },
methods: { methods: {
triggerManagementExport(mode) {
this.print_dialog.show = false;
this.print_error_msg = "";
if (this.print_search.year == '') {
msgbox('請輸入年份');
return;
}
document.getElementById('<%= hid_print_mode.ClientID %>').value = this.print_conditions;
document.getElementById('<%= hid_print_year.ClientID %>').value = this.print_search.year;
if (this.print_conditions == 'mm') {
document.getElementById('<%= hid_print_month.ClientID %>').value = this.print_search.month;
}
else if (this.print_conditions == 'ss') {
document.getElementById('<%= hid_print_season.ClientID %>').value = this.print_search.season;
}
if (mode === 'print') {
const printWindow = window.open('about:blank', '列印信眾資料');
document.getElementById('<%= print_management.ClientID %>').click();
}
else if (mode === "excel") {
document.getElementById('<%= excel_management.ClientID %>').click();
}
},
search_show(curr) { search_show(curr) {
//console.log("btn_click:", curr, curr.api_url); //console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr; this.search_dialog.current = curr;
@@ -228,6 +332,7 @@
//console.log(row, row["u_name"], row["f_number"], curr.id, target); //console.log(row, row["u_name"], row["f_number"], curr.id, target);
}, },
getList(clearpage = false) { getList(clearpage = false) {
console.log("do getlist")
const { sortBy, sortDesc, page, itemsPerPage } = this.options const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = { const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0], sortBy: sortBy[0], sortDesc: sortDesc[0],
@@ -241,6 +346,9 @@
this.data_table.list = response.data.list this.data_table.list = response.data.list
this.data_table.count = response.data.count; this.data_table.count = response.data.count;
this.data_table.loading = false this.data_table.loading = false
const dataToStore = JSON.stringify(this.data_table);
sessionStorage.setItem("member_list_cache", dataToStore);
}) })
.catch( .catch(
error => console.log(error) error => console.log(error)
@@ -262,7 +370,7 @@
const index = this.data_table.list.indexOf(item) const index = this.data_table.list.indexOf(item)
if (index != -1) { if (index != -1) {
axios axios
.delete(HTTP_HOST + 'api/follower/' + item.num) .delete(HTTP_HOST + 'api/follower/Delete/' + item.num)
.then(response => { .then(response => {
this.getList(); this.getList();
}) })
@@ -282,18 +390,23 @@
//} //}
//this.data_table.selected = []; //this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length //this.data_table.count = this.data_table.list.length
location.reload(); //location.reload();
this.getList();
}) })
.catch(error => console.log(error)) .catch(error => console.log(error))
} }
}, },
btn_search() { btn_search() {
isSearched = true;
sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
this.getList(true) this.getList(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide() bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
}, },
btn_all() { btn_all() {
isSearched = false;
clearObjProps(this.search); clearObjProps(this.search);
this.btn_search() sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
//this.btn_search()
}, },
goPrint() { goPrint() {
//debugger; //debugger;
@@ -309,6 +422,7 @@
//列印管理報表 //列印管理報表
print_close() { print_close() {
this.print_dialog.show = false; this.print_dialog.show = false;
this.print_error_msg = "";
} }
, ,
initPrintSearch() { initPrintSearch() {
@@ -391,10 +505,30 @@
$('#country2').val(''); $('#country2').val('');
VueApp.search.country2 = ''; VueApp.search.country2 = '';
}); });
$(document).ready(function () {
// 判斷是否彈出 search dialog
let hasSearchResult = sessionStorage.getItem("member_list_cache") !== null;
if (!hasSearchResult && window._printResult === '') {
let $btn = $("a[data-bs-target='#offcanvasRight'][href='#search_panel']");
$btn.click();
let el = document.getElementById('offcanvasRight');
let offcanvas = bootstrap.Offcanvas.getOrCreateInstance(el);
offcanvas.show();
}
});
</script> </script>
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" /> <uc1:alert runat="server" ID="L_msg" Text="" />
<asp:HiddenField ID="hid_err_msg" runat="server" />
<asp:HiddenField ID="hid_print_year" runat="server" />
<asp:HiddenField ID="hid_print_month" runat="server" />
<asp:HiddenField ID="hid_print_season" runat="server" />
<asp:HiddenField ID="hid_print_mode" runat="server" />
<asp:LinkButton ID="excel_management" runat="server" OnClick="export_Click" style="display:none;" />
<asp:LinkButton ID="print_management" runat="server" OnClick="export_Click" style="display:none;" />
<div id="content" class="container-fluid"> <div id="content" class="container-fluid">
<v-data-table <v-data-table
v-model="data_table.selected" v-model="data_table.selected"
@@ -508,9 +642,17 @@
</v-col> </v-col>
</v-row> </v-row>
<v-row>
<v-col>
<div v-if="print_error_msg" class="red--text mt-2 text-center" style="font-weight: bold;">
{{ print_error_msg }}
</div>
</v-col>
</v-row>
<v-row densee class="pt-3" > <v-row densee class="pt-3" >
<v-col :cols="12" class="pt-3 text-center" > <v-col :cols="12" class="pt-3 text-center" >
<v-btn class="ma-2" color="primary" dark @click="goPrint2" > 列印 </v-btn> <v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('print')" > 列印 </v-btn>
<v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('excel')"> 匯出 Excel </v-btn>
<v-btn class="ma-2" color="green" dark @click="print_close" > 取消 </v-btn> <v-btn class="ma-2" color="green" dark @click="print_close" > 取消 </v-btn>
</v-col> </v-col>
</v-row> </v-row>
+296 -183
View File
@@ -1,17 +1,19 @@
using System; using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Data.OleDb; using System.Data.OleDb;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using System.Configuration; using System.Windows.Interop;
using System.IO;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Spreadsheet;
using System.Linq;
using static TreeView; using static TreeView;
@@ -19,16 +21,22 @@ public partial class admin_follower_index : MyWeb.config
{ {
public int page = 1; public int page = 1;
private Model.ezEntities _db = new Model.ezEntities(); private Model.ezEntities _db = new Model.ezEntities();
protected string lastAddedID;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
if (Session["LastAddedID"] != null)
{
lastAddedID = Session["LastAddedID"].ToString();
Session.Remove("LastAddedID");
}
BuildKind(); BuildKind();
} }
else else
{ {
} }
} }
@@ -42,10 +50,10 @@ public partial class admin_follower_index : MyWeb.config
//國籍 //國籍
s_country.Items.Clear(); s_country.Items.Clear();
s_country.Items.Add(new ListItem("請選擇", "")); s_country.Items.Add(new ListItem("請選擇", ""));
var qry =_db.countries.OrderBy(x => x.range).ThenBy(x => x.name_en).ToList(); var qry = _db.countries.OrderBy(x => x.range).ThenBy(x => x.name_en).ToList();
if (qry.Count > 0) if (qry.Count > 0)
{ {
foreach(var x in qry) foreach (var x in qry)
s_country.Items.Add(new ListItem(x.name_zh, x.ID)); s_country.Items.Add(new ListItem(x.name_zh, x.ID));
} }
@@ -68,208 +76,313 @@ public partial class admin_follower_index : MyWeb.config
#endregion #endregion
#region Excel #region
protected void excel_Click(object sender, EventArgs e) protected void export_Click(object sender, EventArgs e)
{ {
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
LinkButton btn = sender as LinkButton;
if (btn == null) return;
bool isPrintMode = (btn.ID == "print_management");
bool isExcelMode = (btn.ID == "excel_management" || btn.ID == "excel");
bool isManagementMode = (btn.ID == "excel_management" || btn.ID == "print_management");
//查詢要匯出的資料
string _query = ""; // 紀錄匯出條件
var list = searchData(ref _query, isManagementMode);
if (isExcelMode)
{ {
var wb = doc.AddWorkbookPart();
wb.Workbook = new Workbook();
var sheets = wb.Workbook.AppendChild(new Sheets());
//建立第一個頁籤
var ws = wb.AddNewPart<WorksheetPart>();
ws.Worksheet = new Worksheet();
sheets.Append(new Sheet()
{
Id = wb.GetIdOfPart(ws),
SheetId = 1,
Name = "信眾資料"
});
//設定欄寬
var cu = new Columns();
cu.Append(
new Column { Min = 1, Max = 2, Width = 15, CustomWidth = true },
new Column { Min = 3, Max = 3, Width = 10, CustomWidth = true },
new Column { Min = 4, Max = 11, Width = 15, CustomWidth = true },
new Column { Min = 12, Max = 12, Width = 25, CustomWidth = true },
new Column { Min = 13, Max = 13, Width = 8, CustomWidth = true },
new Column { Min = 14, Max = 14, Width = 35, CustomWidth = true },
new Column { Min = 15, Max = 16, Width = 15, CustomWidth = true }
);
ws.Worksheet.Append(cu);
//建立資料頁
var sd = new SheetData();
ws.Worksheet.AppendChild(sd);
//第一列資料
var tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue("信眾編號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("信眾姓名"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("性別"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("身分別"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("生日(國曆)"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("聯絡電話"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("手機號碼"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("皈依道場"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("皈依法名"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("皈依日期"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("加入日期"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("緊急連絡人"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("緊急連絡人電話"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("血型"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("國籍"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("收件地址"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("介紹人"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("LINE帳號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("其它社群帳號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("建檔日期"), DataType = CellValues.String }
,new Cell() { CellValue = new CellValue("身分證號"), DataType = CellValues.String }
//,new Cell() { CellValue = new CellValue("SHA"), DataType = CellValues.String }
);
sd.AppendChild(tr);
//查詢要匯出的資料
//紀錄匯出條件
string _query = "";
var list = searchData(ref _query);
if (list.Count > 0) if (list.Count > 0)
{ {
MyWeb.encrypt encrypt = new MyWeb.encrypt(); using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
Model.country country = new Model.country();
var tdesc = publicFun.enum_desc<Model.follower.type>();
foreach (var item in list)
{ {
//新增資料列 var wb = doc.AddWorkbookPart();
tr = new Row(); wb.Workbook = new Workbook();
string s1, s2, sha; var sheets = wb.Workbook.AppendChild(new Sheets());
s1= encrypt.DecryptAutoKey(item.phone);
s2= encrypt.DecryptAutoKey(item.id_code); //建立第一個頁籤
sha = encrypt.followerHash(s1, s2); var ws = wb.AddNewPart<WorksheetPart>();
ws.Worksheet = new Worksheet();
sheets.Append(new Sheet()
{
Id = wb.GetIdOfPart(ws),
SheetId = 1,
Name = "信眾資料"
});
//設定欄寬
var cu = new Columns();
cu.Append(
new Column { Min = 1, Max = 2, Width = 15, CustomWidth = true },
new Column { Min = 3, Max = 3, Width = 10, CustomWidth = true },
new Column { Min = 4, Max = 11, Width = 15, CustomWidth = true },
new Column { Min = 12, Max = 12, Width = 25, CustomWidth = true },
new Column { Min = 13, Max = 13, Width = 8, CustomWidth = true },
new Column { Min = 14, Max = 14, Width = 35, CustomWidth = true },
new Column { Min = 15, Max = 16, Width = 15, CustomWidth = true }
);
ws.Worksheet.Append(cu);
//建立資料頁
var sd = new SheetData();
ws.Worksheet.AppendChild(sd);
//第一列資料
var tr = new Row();
tr.Append( tr.Append(
new Cell() { CellValue = new CellValue(item.f_number), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("信眾編號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.u_name), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("信眾姓名"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.sex), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("性別"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.identity_type)? tdesc[item.identity_type ?? 1] :""), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("身分別"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.birthday.HasValue ? ValDate(item.birthday.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("生日(國曆)"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("聯絡電話"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.cellphone)), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("手機號碼"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_area), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("皈依道場"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_name), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("皈依法名"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refugedate.HasValue ? ValDate(item.refugedate.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("皈依日期"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.join_date.HasValue ? ValDate(item.join_date.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("加入日期"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.contactor), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("緊急連絡人"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.contactor_phone)), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("緊急連絡人電話"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.blood), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("血型"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.country) ? item.country1.name_zh : ""), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("國籍"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("收件地址"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.introducer), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("介紹人"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid1), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("LINE帳號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid2), DataType = CellValues.String }, new Cell() { CellValue = new CellValue("其它社群帳號"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.reg_time.HasValue ? ValDate(item.reg_time.Value).ToString("yyyy/MM/dd HH:mm:ss") : ""), DataType = CellValues.String } new Cell() { CellValue = new CellValue("建檔日期"), DataType = CellValues.String }
,new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.id_code)), DataType = CellValues.String } , new Cell() { CellValue = new CellValue("身分證號"), DataType = CellValues.String }
//, new Cell() { CellValue = new CellValue(sha), DataType = CellValues.String } //,new Cell() { CellValue = new CellValue("SHA"), DataType = CellValues.String }
); );
sd.AppendChild(tr); sd.AppendChild(tr);
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.country country = new Model.country();
var tdesc = publicFun.enum_desc<Model.follower.type>();
foreach (var item in list)
{
//新增資料列
tr = new Row();
string s1, s2, sha;
s1 = encrypt.DecryptAutoKey(item.phone);
s2 = encrypt.DecryptAutoKey(item.id_code);
sha = encrypt.followerHash(s1, s2);
tr.Append(
new Cell() { CellValue = new CellValue(item.f_number), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.u_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.sex), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.identity_type) ? tdesc[item.identity_type ?? 1] : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.birthday.HasValue ? ValDate(item.birthday.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.cellphone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_area), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refugedate.HasValue ? ValDate(item.refugedate.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.join_date.HasValue ? ValDate(item.join_date.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.contactor), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.contactor_phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.blood), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.country) ? item.country1.name_zh : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.introducer), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid1), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid2), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.reg_time.HasValue ? ValDate(item.reg_time.Value).ToString("yyyy/MM/dd HH:mm:ss") : ""), DataType = CellValues.String }
, new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.id_code)), DataType = CellValues.String }
//, new Cell() { CellValue = new CellValue(sha), DataType = CellValues.String }
);
sd.AppendChild(tr);
}
//空一列
tr = new Row();
sd.AppendChild(tr);
//匯出資訊
string _data = "匯出時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
_data += " " + admin.info.u_id;
tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
);
sd.AppendChild(tr);
_data = "匯出條件 : " + (!isStrNull(_query) ? _query : "-");
tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
);
sd.AppendChild(tr);
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => x.f_number + x.u_name).ToList()));
} }
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=信眾_data.xlsx");
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
HttpContext.Current.Response.End();
//空一列 hid_err_msg.Value = "success";
tr = new Row();
sd.AppendChild(tr);
//匯出資訊
string _data = "匯出時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
_data += " " + admin.info.u_id;
tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
);
sd.AppendChild(tr);
_data = "匯出條件 : " + (!isStrNull(_query) ? _query : "-");
tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
);
sd.AppendChild(tr);
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => x.f_number + x.u_name).ToList()));
} }
else else
{ {
ScriptMsg2("查無資料"); //ScriptMsg2("查無資料");
hid_err_msg.Value = "nodata";
} }
} }
else if (isPrintMode)
{
string urlParams = "";
int selYear = !string.IsNullOrEmpty(hid_print_year.Value) ? int.Parse(hid_print_year.Value) : 0;
int selMonth = !string.IsNullOrEmpty(hid_print_month.Value) ? int.Parse(hid_print_month.Value) : 0;
int selSeason = !string.IsNullOrEmpty(hid_print_season.Value) ? int.Parse(hid_print_season.Value) : 0;
string selMode = !string.IsNullOrEmpty(hid_print_mode.Value) ? hid_print_mode.Value : "";
HttpContext.Current.Response.Clear(); var qry = _db.followers.AsQueryable();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=信眾_data.xlsx"); if (selYear > 0)
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; {
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray()); urlParams += "&year=" + selYear;
HttpContext.Current.Response.End(); }
if (selMode == "mm" && selMonth > 0)
{
urlParams += "&month=" + selMonth;
}
else if (selMode == "ss" && selSeason > 0)
{
urlParams += "&season=" + selSeason;
}
if (list.Count > 0)
{
hid_err_msg.Value = "success";
hid_print_year.Value = selYear.ToString();
hid_print_month.Value = selMonth.ToString();
hid_print_season.Value = selSeason.ToString();
hid_print_mode.Value = selMode;
string script = $@"window.open('print.aspx?{urlParams}&mode={selMode}', '列印信眾資料');";
ScriptManager.RegisterStartupScript(this, GetType(), "ExecutePrint", script, true);
}
else
{
hid_err_msg.Value = "nodata";
string script = $@"
var win = window.open('', '列印信眾資料');
if (win) win.close()";
ScriptManager.RegisterStartupScript(this, GetType(), "CancelPrint", script, true);
}
}
} }
protected List<Model.follower> searchData(ref string _query) protected List<Model.follower> searchData(ref string _query, bool isManagementMode = false)
{ {
//查詢要匯出的資料 //查詢要匯出的資料
var qry = _db.followers.AsQueryable(); var qry = _db.followers.AsQueryable();
//紀錄匯出條件 // 管理報表
if (!isStrNull(s_f_number.Value)) if (isManagementMode)
{ {
qry = qry.Where(o => o.f_number.Contains(s_f_number.Value.Trim())); int selYear = !string.IsNullOrEmpty(hid_print_year.Value) ? int.Parse(hid_print_year.Value) : 0;
int selMonth = !string.IsNullOrEmpty(hid_print_month.Value) ? int.Parse(hid_print_month.Value) : 0;
_query += "信眾編號:" + s_f_number.Value.Trim() + "\n"; int selSeason = !string.IsNullOrEmpty(hid_print_season.Value) ? int.Parse(hid_print_season.Value) : 0;
string selMode = !string.IsNullOrEmpty(hid_print_mode.Value) ? hid_print_mode.Value : "";
}
if (!isStrNull(s_u_name.Value)) if (selYear > 0)
{
qry = qry.Where(o => o.u_name.Contains(s_u_name.Value.Trim()));
_query += "信眾姓名:" + s_u_name.Value.Trim() + "\n";
}
if (!isStrNull(s_address.Value))
{
qry = qry.Where(o => o.address.Contains(s_address.Value.Trim()));
_query += "地址:" + s_u_name.Value.Trim() + "\n";
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!isStrNull(s_phone_idcode.Value) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string hexSearch = encrypt.ConvertToHex(s_phone_idcode.Value.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{ {
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch)); qry = qry.Where(o => o.join_date.HasValue && o.join_date.Value.Year == selYear);
_query += "電話/證號:" + s_phone_idcode.Value.Trim() + "\n"; _query += "年份:" + selYear + "\n";
} }
if (selMode == "mm" && selMonth > 0)
{
qry = qry.Where(o => o.join_date.HasValue && o.join_date.Value.Month == selMonth);
_query += "月份:" + selMonth + "\n";
}
else if (selMode == "ss" && selSeason > 0)
{
if (selSeason == 1)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 1 || o.join_date.Value.Month == 2 || o.join_date.Value.Month == 3);
}
else if (selSeason == 2)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 4 || o.join_date.Value.Month == 5 || o.join_date.Value.Month == 6);
}
else if (selSeason == 3)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 7 || o.join_date.Value.Month == 8 || o.join_date.Value.Month == 9);
}
else if (selSeason == 4)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 10 || o.join_date.Value.Month == 11 || o.join_date.Value.Month == 12);
}
_query += "季度:" + selSeason + "\n";
}
qry = qry.OrderByDescending(o => o.num);
return qry.ToList();
} }
else
if (!isStrNull(s_birthday.Value) && isDate(s_birthday.Value)) // 匯出查詢資料
{ {
qry = qry.Where(o => o.birthday >= ValDate(s_birthday.Value)); //紀錄匯出條件
_query += "生日(起):" + s_birthday.Value.Trim() + "\n"; if (!isStrNull(s_f_number.Value))
{
qry = qry.Where(o => o.f_number.Contains(s_f_number.Value.Trim()));
_query += "信眾編號:" + s_f_number.Value.Trim() + "\n";
}
if (!isStrNull(s_u_name.Value))
{
qry = qry.Where(o => o.u_name.Contains(s_u_name.Value.Trim()));
_query += "信眾姓名:" + s_u_name.Value.Trim() + "\n";
}
if (!isStrNull(s_address.Value))
{
qry = qry.Where(o => o.address.Contains(s_address.Value.Trim()));
_query += "地址:" + s_address.Value.Trim() + "\n";
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!isStrNull(s_phone_idcode.Value) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string hexSearch = encrypt.ConvertToHex(s_phone_idcode.Value.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
_query += "電話/證號:" + s_phone_idcode.Value.Trim() + "\n";
}
}
if (!isStrNull(s_birthday.Value) && isDate(s_birthday.Value))
{
qry = qry.Where(o => o.birthday >= ValDate(s_birthday.Value));
_query += "生日(起):" + s_birthday.Value.Trim() + "\n";
}
if (!isStrNull(s_birthday2.Value) && isDate(s_birthday2.Value))
{
qry = qry.Where(o => o.birthday < Convert.ToDateTime(s_birthday2.Value).AddDays(1));
_query += "生日(訖):" + s_birthday2.Value.Trim() + "\n";
}
qry = qry.OrderByDescending(o => o.num);
return qry.ToList();
} }
if (!isStrNull(s_birthday2.Value) && isDate(s_birthday2.Value))
{
qry = qry.Where(o => o.birthday < Convert.ToDateTime(s_birthday2.Value).AddDays(1));
_query += "生日(訖):" + s_birthday2.Value.Trim() + "\n";
}
qry = qry.OrderByDescending(o => o.num);
return qry.ToList();
} }
+1
View File
@@ -8,6 +8,7 @@
<span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal> <span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal>
</div> </div>
</div> </div>
<a href="index.aspx" class="btn btn-outline-secondary">返回</a>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="container-fluid"> <div class="container-fluid">
+5 -4
View File
@@ -4,10 +4,11 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex"> <div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
<div class="ms-3"> <div class="ms-3">
<span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal> <span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal>
</div> </div>
</div> </div>
<a href="order_record.aspx?userid=<%=Request["userid"] %>" class="btn btn-outline-secondary">返回</a>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="container-fluid"> <div class="container-fluid">
+3 -2
View File
@@ -3,6 +3,7 @@ using DocumentFormat.OpenXml.Vml.Office;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
@@ -26,7 +27,7 @@ public partial class admin_follower_print_ : System.Web.UI.Page
//紀錄匯出條件 //紀錄匯出條件
string _query = ""; string _query = "";
var qry = _db.followers.AsQueryable(); var qry = _db.followers.AsQueryable();
// ❌ 錯誤寫法: qry = qry.Where(o => o.f_number.Contains(Request["f_number"].Trim())); // ❌ 錯誤寫法: qry = qry.Where(o => o.f_number.Contains(Request["f_number"].Trim()));
// LINQ to Entities 無法轉換 Request[] 方法,必須先轉換為變數再使用 // LINQ to Entities 無法轉換 Request[] 方法,必須先轉換為變數再使用
string fNumberParam = Request["f_number"]?.Trim(); string fNumberParam = Request["f_number"]?.Trim();
@@ -85,7 +86,7 @@ public partial class admin_follower_print_ : System.Web.UI.Page
} }
_query += "國家:" + (_db.countries.Where(x => x.ID == country2Id).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n"; _query += "國家:" + (_db.countries.Where(x => x.ID == country2Id).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n";
} }
//管理報表 //管理報表
if (!string.IsNullOrEmpty(Request["year"])) if (!string.IsNullOrEmpty(Request["year"]))
{ {
+30 -30
View File
@@ -190,7 +190,7 @@
text_prop: 'name_zh', text_prop: 'name_zh',
value_prop: 'id', value_prop: 'id',
keys: [ keys: [
{ id: 'keyword', title: '關鍵字' }, { id: 'keyword', title: '關鍵字' },
], ],
api_url: HTTP_HOST + 'api/country/GetList', api_url: HTTP_HOST + 'api/country/GetList',
columns: [ columns: [
@@ -208,11 +208,11 @@
title: '稱謂', title: '稱謂',
text_prop: 'title', text_prop: 'title',
value_prop: 'num', value_prop: 'num',
keys: [ keys: [
], ],
api_url: HTTP_HOST + 'api/appellation/GetList', api_url: HTTP_HOST + 'api/appellation/GetList',
columns: [ columns: [
{ id: 'title', title: '稱謂' }, { id: 'title', title: '稱謂' },
], ],
selected: {}, selected: {},
select(item, index, t) { select(item, index, t) {
@@ -230,7 +230,7 @@
{ id: 'f_number', title: '編號' }, { id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' }, { id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' }, { id: 'address', title: '地址' },
{ id: 'onlyfamily', title: '只查親屬'}, { id: 'onlyfamily', title: '只查親屬' },
], ],
api_url: HTTP_HOST + 'api/follower/GetList', api_url: HTTP_HOST + 'api/follower/GetList',
columns: [ columns: [
@@ -241,7 +241,7 @@
selected: {}, selected: {},
select(item, index, t) { select(item, index, t) {
console.log("select search5", t); console.log("select search5", t);
} }
}, },
}, },
@@ -314,10 +314,10 @@
birthday: '', birthday: '',
phoneDes: '', phoneDes: '',
demo: '', demo: '',
appellation_id_selected : appellation_id_selected:
{ {
text : '', text: '',
val : 0, val: 0,
}, },
}, },
@@ -372,33 +372,33 @@
], ],
tabletsDetail: { multiSort: false }, tabletsDetail: { multiSort: false },
tabletTable: { tabletTable: {
Loading:true, Loading: true,
disableButton: true, disableButton: true,
searchDetail: '', searchDetail: '',
headersDetail: [ headersDetail: [
{ text: '超渡/陽上', value: 'type', sortable: false, width: "100px" }, { text: '超渡/陽上', value: 'type', sortable: false, width: "100px" },
{ text: '* 牌位標題', value: 'title', sortable: true }, { text: '* 牌位標題', value: 'title', sortable: true },
{ text: '', value: 'actions', sortable: false, width: "100px" }, { text: '', value: 'actions', sortable: false, width: "100px" },
], ],
desserts: [], desserts: [],
desserts_count: 0, desserts_count: 0,
editedIndex: -1, editedIndex: -1,
editedItem: { editedItem: {
id: 0, id: 0,
num: 0, num: 0,
f_num: 0, f_num: 0,
title: '', title: '',
}, },
defaultItem: { defaultItem: {
id: 0, id: 0,
num: 0, num: 0,
f_num: 0, f_num: 0,
type: this.selectedTabletType, type: this.selectedTabletType,
title:'', title: '',
}, },
}, },
//新:家人 //新:家人
family:{ family: {
dialog: false, dialog: false,
isEditing: false, isEditing: false,
is_tw: true, is_tw: true,
@@ -420,8 +420,8 @@
chinese_year: "", chinese_year: "",
zodiac: "", zodiac: "",
birth_time: "", birth_time: "",
city:"", city: "",
area:"", area: "",
address: "", address: "",
phone: "", phone: "",
mobile: "", mobile: "",
@@ -440,8 +440,8 @@
chinese_year: "", chinese_year: "",
zodiac: "", zodiac: "",
birth_time: "", birth_time: "",
city:"", city: "",
area:"", area: "",
address: "", address: "",
phone: "", phone: "",
mobile: "", mobile: "",
@@ -458,11 +458,11 @@
areaOptions: {}, // 區域選項 areaOptions: {}, // 區域選項
//天干地支:甲子, 乙丑... //天干地支:甲子, 乙丑...
chineseYears: [ chineseYears: [
'甲子', '乙丑', '丙寅', '丁卯', '戊辰', '己巳', '庚午', '辛未', '壬申', '癸酉', '甲子', '乙丑', '丙寅', '丁卯', '戊辰', '己巳', '庚午', '辛未', '壬申', '癸酉',
'甲戌', '乙亥', '丙子', '丁丑', '戊寅', '己卯', '庚辰', '辛巳', '壬午', '癸未', '甲戌', '乙亥', '丙子', '丁丑', '戊寅', '己卯', '庚辰', '辛巳', '壬午', '癸未',
'甲申', '乙酉', '丙戌', '丁亥', '戊子', '己丑', '庚寅', '辛卯', '壬辰', '癸巳', '甲申', '乙酉', '丙戌', '丁亥', '戊子', '己丑', '庚寅', '辛卯', '壬辰', '癸巳',
'甲午', '乙未', '丙申', '丁酉', '戊戌', '己亥', '庚子', '辛丑', '壬寅', '癸卯', '甲午', '乙未', '丙申', '丁酉', '戊戌', '己亥', '庚子', '辛丑', '壬寅', '癸卯',
'甲辰', '乙巳', '丙午', '丁未', '戊申', '己酉', '庚戌', '辛亥', '壬子', '癸丑', '甲辰', '乙巳', '丙午', '丁未', '戊申', '己酉', '庚戌', '辛亥', '壬子', '癸丑',
'甲寅', '乙卯', '丙辰', '丁巳', '戊午', '己未', '庚申', '辛酉', '壬戌', '癸亥' '甲寅', '乙卯', '丙辰', '丁巳', '戊午', '己未', '庚申', '辛酉', '壬戌', '癸亥'
], ],
//生肖 //生肖
@@ -585,7 +585,7 @@
this.search_dialog.list = response.data.list this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count this.search_dialog.count = response.data.count
this.search_dialog.loading = false this.search_dialog.loading = false
console.log(this.search_dialog.list)
}) })
.catch(error => { .catch(error => {
console.log(error) console.log(error)
@@ -1332,7 +1332,7 @@
</label> </label>
</div> </div>
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary edit_Click noedit" /> <asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary edit_Click noedit" />
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary edit_Click noedit" /> <asp:Button ID="edit" runat="server" Text="儲存" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary edit_Click noedit" />
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" /> <asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div> </div>
</asp:Content> </asp:Content>
+81 -23
View File
@@ -1,34 +1,44 @@
using System; using Model;
using Newtonsoft.Json;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Data.Entity;
using System.Data.OleDb; using System.Data.OleDb;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Globalization;
using Model;
public partial class admin_follower_reg : MyWeb.config public partial class admin_follower_reg : MyWeb.config
{ {
private Model.ezEntities _db = new Model.ezEntities(); private Model.ezEntities _db = new Model.ezEntities();
public ArrayList _tmp = new ArrayList(); public ArrayList _tmp = new ArrayList();
public bool isDataChanged = false;
public bool isAutoNumbering = ConfigurationManager.AppSettings["IsAutoNumbering"].ToString() == "true" ? true : false;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
CallAjax(); CallAjax();
if (!IsPostBack) if (!IsPostBack)
{ {
InitEnumsOptions<Model.follower.type>(identity_type); //身分別 InitEnumsOptions<Model.follower.type>(identity_type); //身分別
//var qry = _db.followers.AsEnumerable(); //var qry = _db.followers.AsEnumerable();
var qry = _db.followers.AsQueryable(); var qry = _db.followers.AsQueryable();
if (isStrNull(Request["num"])) if (isStrNull(Request["num"]))
{ {
if (!isAutoNumbering)
{
f_number.ReadOnly = false;
}
if (!isStrNull(Request["leader"])) if (!isStrNull(Request["leader"]))
{ {
int _num = Val(Request["leader"]); int _num = Val(Request["leader"]);
@@ -50,9 +60,14 @@ public partial class admin_follower_reg : MyWeb.config
//預設國籍 //預設國籍
country.Value = "158"; country.Value = "158";
country_txt.Value = "中華民國(台灣)"; country_txt.Value = "中華民國(台灣)";
// 預設加入日期
join_date.Text = DateTime.Now.ToString("yyyy-MM-dd");
} }
else else
{ {
f_number.ReadOnly = true;
int _num = Val(Request["num"]); int _num = Val(Request["num"]);
var prod = qry.Where(q => q.num == _num).FirstOrDefault(); var prod = qry.Where(q => q.num == _num).FirstOrDefault();
if (prod != null) if (prod != null)
@@ -206,8 +221,11 @@ public partial class admin_follower_reg : MyWeb.config
} }
} }
} }
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制 if (isAutoNumbering)
followers.f_number = follower.generate_f_number(sex.SelectedValue); {
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制
followers.f_number = follower.generate_f_number(sex.SelectedValue);
}
followers.identity_type = Val(identity_type.SelectedValue); followers.identity_type = Val(identity_type.SelectedValue);
if(!isStrNull(leader.Value)) followers.leader = Val(leader.Value); if(!isStrNull(leader.Value)) followers.leader = Val(leader.Value);
if (!isStrNull(country.Value)) followers.country = country.Value; if (!isStrNull(country.Value)) followers.country = country.Value;
@@ -239,7 +257,9 @@ public partial class admin_follower_reg : MyWeb.config
Model.admin_log admin_log = new Model.admin_log(); Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Insert, f_number.Text + u_name.Text); admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Insert, f_number.Text + u_name.Text);
Session["LastAddedID"] = followers.f_number;
Response.Redirect("index.aspx"); Response.Redirect("index.aspx");
} }
else else
@@ -282,7 +302,7 @@ public partial class admin_follower_reg : MyWeb.config
try try
{ {
foreach (Control obj in cardBodyPanel.Controls) foreach (Control obj in cardBodyPanel.Controls)
{ {
if (obj is TextBox) if (obj is TextBox)
{ {
var ObjValue = followers.GetType().GetProperty(obj.ID); var ObjValue = followers.GetType().GetProperty(obj.ID);
@@ -300,7 +320,7 @@ public partial class admin_follower_reg : MyWeb.config
ObjValue.SetValue(followers, null); ObjValue.SetValue(followers, null);
} }
} }
@@ -310,22 +330,60 @@ public partial class admin_follower_reg : MyWeb.config
followers.sex = sex.SelectedValue; followers.sex = sex.SelectedValue;
followers.blood = blood.SelectedValue; followers.blood = blood.SelectedValue;
followers.tab = tab.Value.Trim(','); followers.tab = tab.Value.Trim(',');
followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); //followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
followers.follower_hash = encrypt.followerHash(followers.phone, followers.id_code); followers.follower_hash = encrypt.followerHash(followers.phone, followers.id_code);
// 如果啟用 search_keywords 功能,生成並更新 search_keywords // 如果啟用 search_keywords 功能,生成並更新 search_keywords
if (GlobalVariables.UseSearchKeywords) if (GlobalVariables.UseSearchKeywords)
{ {
followers.search_keywords = encrypt.GenerateSearchKeywords(followers); followers.search_keywords = encrypt.GenerateSearchKeywords(followers);
} }
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log(); // 檢查是否有修改資料
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Update, f_number.Text + u_name.Text); var entry = _db.Entry(followers);
this.isDataChanged = entry.CurrentValues.PropertyNames.Any(name =>
{
if (name == "admin_log" || name == "follower_hash")
return false;
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"])); var originalVal = entry.OriginalValues[name]?.ToString();
var currentVal = entry.CurrentValues[name]?.ToString();
// 針對加密欄位進行特殊處理
bool isEncryptedField = (name == "phone" || name == "id_code");
if (isEncryptedField)
{
string originalPlain = !string.IsNullOrEmpty(originalVal) ? encrypt.DecryptAutoKey(originalVal) : "";
string currentPlain = !string.IsNullOrEmpty(currentVal) ? encrypt.DecryptAutoKey(currentVal) : "";
return originalPlain.Trim() != currentPlain.Trim();
}
return !object.Equals(originalVal, currentVal);
});
if (this.isDataChanged)
{
followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
}
else
{
entry.State = EntityState.Unchanged;
}
int isDataSaved = _db.SaveChanges();
if (isDataSaved > 0)
{
//L_msg.Type = alert_type.success;
//L_msg.Text = "修改成功";
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Update, f_number.Text + u_name.Text);
Response.Redirect("index.aspx?dirty=1&page=" + Convert.ToString(Request["page"]));
}
else
{
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -339,7 +397,7 @@ public partial class admin_follower_reg : MyWeb.config
L_msg.Type = alert_type.danger; L_msg.Type = alert_type.danger;
L_msg.Text = "查無資料"; L_msg.Text = "查無資料";
} }
/* /*
if (chk_pro_num(f_number.Text, Val(Request["num"]))) if (chk_pro_num(f_number.Text, Val(Request["num"])))
{ {
} }
@@ -349,7 +407,7 @@ public partial class admin_follower_reg : MyWeb.config
L_msg.Text = "信眾編號重複"; L_msg.Text = "信眾編號重複";
} }
*/ */
} }
} }
#endregion #endregion
+1 -1
View File
@@ -8,7 +8,7 @@
<ul class="collapsible_item"> <ul class="collapsible_item">
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound"> <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate> <ItemTemplate>
<li><a class="menu" href="<%#ResolveUrl(ValString(Eval("url"))) %>" <li><a class="menu" href="<%#ResolveUrl(ValString(Eval("url"))) %>"
target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>"><%#Eval("title") %></a></li> target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>"><%#Eval("title") %></a></li>
</ItemTemplate> </ItemTemplate>
</asp:Repeater> </asp:Repeater>
+13 -2
View File
@@ -39,6 +39,7 @@
vuetify: new Vuetify(vuetify_options), vuetify: new Vuetify(vuetify_options),
data() { data() {
return { return {
isFirstLoad: true,
this_act : '<%= Request["act_id"]%>', this_act : '<%= Request["act_id"]%>',
options: { multiSort: false }, options: { multiSort: false },
search_options: { multiSort: false }, search_options: { multiSort: false },
@@ -211,9 +212,13 @@
this.initActivity(); this.initActivity();
const navEntries = performance.getEntriesByType("navigation"); const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload"; const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
const isBackForward = navEntries.length > 0 && navEntries[0].type === "back_forward";
if (isReload) { if (isReload) {
sessionStorage.removeItem("orderpage"); sessionStorage.removeItem("orderpage");
} }
else if (isBackForward) {
this.isFirstLoad = false;
}
else { else {
const savedPage = parseInt(sessionStorage.getItem('orderpage')); const savedPage = parseInt(sessionStorage.getItem('orderpage'));
if (savedPage) { if (savedPage) {
@@ -224,6 +229,11 @@
watch: { watch: {
options: { options: {
handler() { handler() {
if (this.isFirstLoad) {
this.isFirstLoad = false;
this.data_table.loading = false;
return;
}
this.getDefault() this.getDefault()
}, },
deep: true, deep: true,
@@ -368,7 +378,8 @@
//} //}
//this.data_table.selected = []; //this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length //this.data_table.count = this.data_table.list.length
location.reload(); //location.reload();
this.getDefault();
}) })
.catch(error => console.log(error)) .catch(error => console.log(error))
} }
@@ -537,7 +548,7 @@
initActivity() { initActivity() {
axios.get(HTTP_HOST + 'api/activity') axios.get(HTTP_HOST + 'api/activity')
.then(response => { .then(response => {
this.select_act_list = response.data this.select_act_list = response.data
}) })
.catch(error => { .catch(error => {
console.log(error) console.log(error)
+5 -3
View File
@@ -526,7 +526,7 @@
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if (event.data.source === 'editor.btn.click') { if (event.data.source === 'editor.btn.click') {
const receivedData = event.data.data; const receivedData = event.data.data;
// 更新編輯中的項目 // 更新編輯中的項目
//if (receivedData.tabletItem && this.editedIndex > -1) { //if (receivedData.tabletItem && this.editedIndex > -1) {
if (receivedData.tabletItem) { if (receivedData.tabletItem) {
@@ -807,7 +807,7 @@
isValidDate = Date.parse(item.pay_date); isValidDate = Date.parse(item.pay_date);
if (!isNaN(isValidDate)) if (!isNaN(isValidDate))
item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd") item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd")
console.log(item);
this.editedItem = $.extend(true, {}, item); this.editedItem = $.extend(true, {}, item);
this.data_dialog.show = true; this.data_dialog.show = true;
this.data_dialog.isAddNew = false; this.data_dialog.isAddNew = false;
@@ -971,9 +971,11 @@
/* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/ /* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/
this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/ this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/
{ {
console.log(this.editedItem);
//check price //check price
if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) { if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) {
console.log(this.editedItem.f_num_selected.val);
console.log(this.editedItem.from_id_selected.val);
//check qty //check qty
//數量不可小於掛單明細的數量 //數量不可小於掛單明細的數量
if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) { if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) {
+23 -12
View File
@@ -1,15 +1,16 @@
using System; using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Data.Entity.Infrastructure;
using System.Data.OleDb; using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Data.Entity.Infrastructure;
public partial class admin_order_reg : MyWeb.config public partial class admin_order_reg : MyWeb.config
{ {
@@ -187,16 +188,26 @@ public partial class admin_order_reg : MyWeb.config
{ {
if (!isStrNull(pro_order.order_no)) if (!isStrNull(pro_order.order_no))
{ {
_db.pro_order.Add(pro_order); bool isRegistered = _db.pro_order.Any(x => x.f_num == pro_order.f_num && x.activity_num == pro_order.activity_num);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log(); if (isRegistered) // 重複報名
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no); {
L_msg.Type = alert_type.warning;
L_msg.Text = "此信眾已報名過本活動";
}
else
{
_db.pro_order.Add(pro_order);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
string url = "index.aspx"; string url = "index.aspx";
url = "reg.aspx?order_no=" + pro_order.order_no; url = "reg.aspx?order_no=" + pro_order.order_no;
Response.Redirect(url); Response.Redirect(url);
}
} }
else else
{ {
+4 -2
View File
@@ -42,11 +42,13 @@
<add key="UseSearchKeywords" value="true" /> <add key="UseSearchKeywords" value="true" />
<!--網站的簡稱,用來區別session和cookie--> <!--網站的簡稱,用來區別session和cookie-->
<add key="SC" value="erp17168" /> <add key="SC" value="erp17168" />
<!--是否啟用信眾自動編號 (true=啟用, false=停用)-->
<add key="IsAutoNumbering" value="true" />
</appSettings> </appSettings>
<connectionStrings> <connectionStrings>
<!--SQL用--> <!--SQL用-->
<add name="shopConn" providerName="System.Data.SqlClient" connectionString="Data Source=192.168.5.21;Initial Catalog=17168erp_t;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Provider=SQLOLEDB;Connection Timeout=10;" /> <add name="shopConn" providerName="System.Data.SqlClient" connectionString="Data Source=localhost;Initial Catalog=17168erp_t;User ID=sa;Password=778611;Encrypt=False;TrustServerCertificate=True;Provider=SQLOLEDB;Connection Timeout=10;" />
<add name="ezEntities" providerName="System.Data.EntityClient" connectionString="metadata=res://*/App_Code.Model.Model.csdl|res://*/App_Code.Model.Model.ssdl|res://*/App_Code.Model.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=192.168.5.21;Initial Catalog=17168erp_t;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Connection Timeout=10;&quot;" /> <add name="ezEntities" providerName="System.Data.EntityClient" connectionString="metadata=res://*/App_Code.Model.Model.csdl|res://*/App_Code.Model.Model.ssdl|res://*/App_Code.Model.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=17168erp_t;User ID=sa;Password=778611;Encrypt=False;TrustServerCertificate=True;Connection Timeout=10;&quot;" />
<!-- <!--
--> -->
<!--SQL用--> <!--SQL用-->