1. 加上返回鍵
2. 修改報名記錄中的活動開始結束時間 3. 修正列印問題 4. 信眾資料及報名管理起始不會出現資料 5. 信眾不得重複報名相同活動 6. 信眾資料的 cache(含結果與搜尋條件) 7. 修復信眾、活動、品項刪除功能 8. 增加自訂是否自動編號 9. 優化信眾資料頁面(彈出查詢頁面、顯示剛新增資料) 10. 新增管理表單匯出 excel 功能 11. 無查詢資料時不可點選匯出/列印按鈕 12. 匯出/列印管理報表時,若無資料則顯示提示 13. 新增信眾資料時,加入日期預設為今日
This commit is contained in:
+296
-183
@@ -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.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.Diagnostics;
|
||||
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 DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System.Linq;
|
||||
using System.Windows.Interop;
|
||||
using static TreeView;
|
||||
|
||||
|
||||
@@ -19,16 +21,22 @@ public partial class admin_follower_index : MyWeb.config
|
||||
{
|
||||
public int page = 1;
|
||||
private Model.ezEntities _db = new Model.ezEntities();
|
||||
protected string lastAddedID;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
if (Session["LastAddedID"] != null)
|
||||
{
|
||||
lastAddedID = Session["LastAddedID"].ToString();
|
||||
Session.Remove("LastAddedID");
|
||||
}
|
||||
BuildKind();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,10 +50,10 @@ public partial class admin_follower_index : MyWeb.config
|
||||
//國籍
|
||||
s_country.Items.Clear();
|
||||
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)
|
||||
{
|
||||
foreach(var x in qry)
|
||||
{
|
||||
foreach (var x in qry)
|
||||
s_country.Items.Add(new ListItem(x.name_zh, x.ID));
|
||||
}
|
||||
|
||||
@@ -68,208 +76,313 @@ public partial class admin_follower_index : MyWeb.config
|
||||
#endregion
|
||||
|
||||
|
||||
#region 匯出Excel
|
||||
#region 匯出
|
||||
|
||||
protected void excel_Click(object sender, EventArgs e)
|
||||
protected void export_Click(object sender, EventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
|
||||
{
|
||||
//新增資料列
|
||||
tr = new Row();
|
||||
string s1, s2, sha;
|
||||
s1= encrypt.DecryptAutoKey(item.phone);
|
||||
s2= encrypt.DecryptAutoKey(item.id_code);
|
||||
sha = encrypt.followerHash(s1, s2);
|
||||
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(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 }
|
||||
);
|
||||
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);
|
||||
|
||||
|
||||
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();
|
||||
|
||||
//空一列
|
||||
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()));
|
||||
|
||||
hid_err_msg.Value = "success";
|
||||
}
|
||||
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();
|
||||
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();
|
||||
var qry = _db.followers.AsQueryable();
|
||||
if (selYear > 0)
|
||||
{
|
||||
urlParams += "&year=" + selYear;
|
||||
}
|
||||
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();
|
||||
|
||||
//紀錄匯出條件
|
||||
if (!isStrNull(s_f_number.Value))
|
||||
// 管理報表
|
||||
if (isManagementMode)
|
||||
{
|
||||
qry = qry.Where(o => o.f_number.Contains(s_f_number.Value.Trim()));
|
||||
|
||||
_query += "信眾編號:" + s_f_number.Value.Trim() + "\n";
|
||||
|
||||
}
|
||||
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 : "";
|
||||
|
||||
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_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))
|
||||
if (selYear > 0)
|
||||
{
|
||||
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
|
||||
_query += "電話/證號:" + s_phone_idcode.Value.Trim() + "\n";
|
||||
qry = qry.Where(o => o.join_date.HasValue && o.join_date.Value.Year == selYear);
|
||||
_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();
|
||||
}
|
||||
|
||||
if (!isStrNull(s_birthday.Value) && isDate(s_birthday.Value))
|
||||
else
|
||||
// 匯出查詢資料
|
||||
{
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user