1. 加上返回鍵
2. 修改報名記錄中的活動開始結束時間 3. 修正列印問題 4. 信眾資料及報名管理起始不會出現資料 5. 信眾不得重複報名相同活動 6. 信眾資料的 cache(含結果與搜尋條件) 7. 修復信眾、活動、品項刪除功能 8. 增加自訂是否自動編號 9. 優化信眾資料頁面(彈出查詢頁面、顯示剛新增資料) 10. 新增管理表單匯出 excel 功能 11. 無查詢資料時不可點選匯出/列印按鈕 12. 匯出/列印管理報表時,若無資料則顯示提示 13. 新增信眾資料時,加入日期預設為今日
This commit is contained in:
@@ -1,34 +1,44 @@
|
||||
using System;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Data.OleDb;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
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
|
||||
{
|
||||
private Model.ezEntities _db = new Model.ezEntities();
|
||||
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)
|
||||
{
|
||||
CallAjax();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
{
|
||||
|
||||
InitEnumsOptions<Model.follower.type>(identity_type); //身分別
|
||||
//var qry = _db.followers.AsEnumerable();
|
||||
var qry = _db.followers.AsQueryable();
|
||||
|
||||
var qry = _db.followers.AsQueryable();
|
||||
|
||||
if (isStrNull(Request["num"]))
|
||||
{
|
||||
if (!isAutoNumbering)
|
||||
{
|
||||
f_number.ReadOnly = false;
|
||||
}
|
||||
|
||||
if (!isStrNull(Request["leader"]))
|
||||
{
|
||||
int _num = Val(Request["leader"]);
|
||||
@@ -50,9 +60,14 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
//預設國籍
|
||||
country.Value = "158";
|
||||
country_txt.Value = "中華民國(台灣)";
|
||||
|
||||
// 預設加入日期
|
||||
join_date.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
}
|
||||
else
|
||||
{
|
||||
f_number.ReadOnly = true;
|
||||
|
||||
int _num = Val(Request["num"]);
|
||||
var prod = qry.Where(q => q.num == _num).FirstOrDefault();
|
||||
if (prod != null)
|
||||
@@ -206,8 +221,11 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
}
|
||||
}
|
||||
}
|
||||
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制
|
||||
followers.f_number = follower.generate_f_number(sex.SelectedValue);
|
||||
if (isAutoNumbering)
|
||||
{
|
||||
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制
|
||||
followers.f_number = follower.generate_f_number(sex.SelectedValue);
|
||||
}
|
||||
followers.identity_type = Val(identity_type.SelectedValue);
|
||||
if(!isStrNull(leader.Value)) followers.leader = Val(leader.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();
|
||||
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");
|
||||
}
|
||||
else
|
||||
@@ -282,7 +302,7 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
try
|
||||
{
|
||||
foreach (Control obj in cardBodyPanel.Controls)
|
||||
{
|
||||
{
|
||||
if (obj is TextBox)
|
||||
{
|
||||
var ObjValue = followers.GetType().GetProperty(obj.ID);
|
||||
@@ -300,7 +320,7 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
ObjValue.SetValue(followers, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -310,22 +330,60 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
followers.sex = sex.SelectedValue;
|
||||
followers.blood = blood.SelectedValue;
|
||||
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);
|
||||
|
||||
|
||||
// 如果啟用 search_keywords 功能,生成並更新 search_keywords
|
||||
if (GlobalVariables.UseSearchKeywords)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -339,7 +397,7 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
L_msg.Type = alert_type.danger;
|
||||
L_msg.Text = "查無資料";
|
||||
}
|
||||
/*
|
||||
/*
|
||||
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 = "信眾編號重複";
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user