process request keys at page load
This commit is contained in:
@@ -14,212 +14,228 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
|||||||
List<Model.pro_order_detail> _detail = new List<Model.pro_order_detail>();
|
List<Model.pro_order_detail> _detail = new List<Model.pro_order_detail>();
|
||||||
List<Model.bed_order_detail> _bedDt = new List<Model.bed_order_detail>();
|
List<Model.bed_order_detail> _bedDt = new List<Model.bed_order_detail>();
|
||||||
Dictionary<int, string> tdesc = new Dictionary<int, string>();
|
Dictionary<int, string> tdesc = new Dictionary<int, string>();
|
||||||
|
|
||||||
|
// Request 參數變數
|
||||||
|
private string _orderNo;
|
||||||
|
private string _subject;
|
||||||
|
private string _uName;
|
||||||
|
private string _introducer;
|
||||||
|
private string _actItem;
|
||||||
|
private string _keyin1;
|
||||||
|
private string _address;
|
||||||
|
private string _upTime1;
|
||||||
|
private string _upTime2;
|
||||||
|
private string _country;
|
||||||
|
private string _country2;
|
||||||
|
private string _hasPrice;
|
||||||
|
private string _year;
|
||||||
|
private string _month;
|
||||||
|
private string _season;
|
||||||
|
private string _chkHasAct;
|
||||||
|
private string _chkNoAct;
|
||||||
|
private string _selectAct;
|
||||||
|
private string _selectActItem;
|
||||||
|
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!IsPostBack)
|
if (!IsPostBack)
|
||||||
{
|
{
|
||||||
|
// 初始化所有 Request 參數
|
||||||
|
InitializeRequestParameters();
|
||||||
|
|
||||||
MyWeb.admin admin = new MyWeb.admin();
|
MyWeb.admin admin = new MyWeb.admin();
|
||||||
|
|
||||||
if ( admin.isLoign())
|
if (admin.isLoign())
|
||||||
{
|
{
|
||||||
|
|
||||||
//紀錄匯出條件
|
//紀錄匯出條件
|
||||||
string _query = "";
|
string _query = "";
|
||||||
var qry = _db.pro_order.AsQueryable();
|
var qry = _db.pro_order.AsQueryable();
|
||||||
|
|
||||||
// ❌ 錯誤寫法: qry = qry.Where(o => o.order_no.Contains(Request["order_no"].Trim()));
|
if (!string.IsNullOrEmpty(_orderNo))
|
||||||
// LINQ to Entities 無法轉換 Request[] 方法,必須先轉換為變數再使用
|
|
||||||
string orderNoParam = Request["order_no"]?.Trim();
|
|
||||||
if (!string.IsNullOrEmpty(orderNoParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.order_no.Contains(orderNoParam));
|
qry = qry.Where(o => o.order_no.Contains(_orderNo));
|
||||||
_query += "單號:" + orderNoParam + "\n";
|
_query += "單號:" + _orderNo + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string subjectParam = Request["subject"]?.Trim();
|
if (!string.IsNullOrEmpty(_subject))
|
||||||
if (!string.IsNullOrEmpty(subjectParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(subjectParam));
|
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(_subject));
|
||||||
_query += "報名活動:" + subjectParam + "\n";
|
_query += "報名活動:" + _subject + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string uNameParam = Request["u_name"]?.Trim();
|
if (!string.IsNullOrEmpty(_uName))
|
||||||
if (!string.IsNullOrEmpty(uNameParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(uNameParam));
|
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(_uName));
|
||||||
_query += "姓名/名稱:" + uNameParam + "\n";
|
_query += "姓名/名稱:" + _uName + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string introducerParam = Request["introducerTxt"]?.Trim();
|
if (!string.IsNullOrEmpty(_introducer))
|
||||||
if (!string.IsNullOrEmpty(introducerParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(introducerParam));
|
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(_introducer));
|
||||||
_query += "介紹人:" + introducerParam + "\n";
|
_query += "介紹人:" + _introducer + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string actItemParam = Request["actItemTxt"]?.Trim();
|
if (!string.IsNullOrEmpty(_actItem))
|
||||||
if (!string.IsNullOrEmpty(actItemParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(actItemParam)).Count() > 0);
|
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(_actItem)).Count() > 0);
|
||||||
_query += "品項:" + actItemParam + "\n";
|
_query += "品項:" + _actItem + "\n";
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(Request["keyin1"]))
|
|
||||||
{
|
|
||||||
// ❌ 錯誤寫法: qry = qry.Where(o => o.keyin1==Request["keyin1"].ToString());
|
|
||||||
// LINQ to Entities 無法轉換 Request[].ToString(),必須先轉換為變數再使用
|
|
||||||
string keyin1Value = Request["keyin1"]?.ToString();
|
|
||||||
qry = qry.Where(o => o.keyin1 == keyin1Value);
|
|
||||||
_query += "單據狀態:" + Model.pro_order.keyin1_value_to_text( Request["keyin1"].Trim()) + "\n";
|
|
||||||
}
|
|
||||||
string addressParam = Request["address"]?.Trim();
|
|
||||||
if (!string.IsNullOrEmpty(addressParam))
|
|
||||||
{
|
|
||||||
qry = qry.Where(o => o.address.Contains(addressParam));
|
|
||||||
_query += "地址:" + addressParam + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["up_time1"]))
|
if (!string.IsNullOrEmpty(_keyin1))
|
||||||
{
|
{
|
||||||
DateTime upTime1Param = Convert.ToDateTime(Request["up_time1"].Trim());
|
qry = qry.Where(o => o.keyin1 == _keyin1);
|
||||||
qry = qry.Where(o => o.up_time >= upTime1Param);
|
_query += "單據狀態:" + Model.pro_order.keyin1_value_to_text(_keyin1) + "\n";
|
||||||
_query += "報名日期(起):" + upTime1Param.ToString("yyyy/MM/dd") + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["up_time2"]))
|
if (!string.IsNullOrEmpty(_address))
|
||||||
{
|
{
|
||||||
DateTime upTime2Param = Convert.ToDateTime(Request["up_time2"].Trim());
|
qry = qry.Where(o => o.address.Contains(_address));
|
||||||
qry = qry.Where(o => o.up_time < upTime2Param.AddDays(1));
|
_query += "地址:" + _address + "\n";
|
||||||
_query += "報名日期(訖):" + upTime2Param.ToString("yyyy/MM/dd") + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string countryParam = Request["country"]?.ToString();
|
if (!string.IsNullOrEmpty(_upTime1))
|
||||||
if (!string.IsNullOrEmpty(countryParam))
|
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.f_num != null && o.follower.country == countryParam);
|
DateTime upTime1 = Convert.ToDateTime(_upTime1);
|
||||||
_query += "國家:" + (_db.countries.Where(x => x.ID == countryParam).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n";
|
qry = qry.Where(o => o.up_time >= upTime1);
|
||||||
|
_query += "報名日期(起):" + upTime1.ToString("yyyy/MM/dd") + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string country2Param = Request["country2"]?.ToString();
|
if (!string.IsNullOrEmpty(_upTime2))
|
||||||
if (!string.IsNullOrEmpty(country2Param))
|
|
||||||
{
|
{
|
||||||
if (country2Param == "1")
|
DateTime upTime2 = Convert.ToDateTime(_upTime2);
|
||||||
|
qry = qry.Where(o => o.up_time < upTime2.AddDays(1));
|
||||||
|
_query += "報名日期(訖):" + upTime2.ToString("yyyy/MM/dd") + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(_country))
|
||||||
|
{
|
||||||
|
qry = qry.Where(o => o.f_num != null && o.follower.country == _country);
|
||||||
|
_query += "國家:" + (_db.countries.Where(x => x.ID == _country).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(_country2))
|
||||||
|
{
|
||||||
|
if (_country2 == "1")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.f_num != null && o.follower.country == "158");
|
qry = qry.Where(o => o.f_num != null && o.follower.country == "158");
|
||||||
}
|
}
|
||||||
else if (country2Param == "2")
|
else if (_country2 == "2")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.f_num != null && o.follower.country != "158");
|
qry = qry.Where(o => o.f_num != null && o.follower.country != "158");
|
||||||
}
|
}
|
||||||
_query += "國家:" + (_db.countries.Where(x => x.ID == country2Param).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n";
|
_query += "國家:" + (_country2 == "1" ? "台灣" : _country2 == "2" ? "非台灣" : "") + "\n";
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(Request["hasPrice"]))
|
|
||||||
|
if (!string.IsNullOrEmpty(_hasPrice))
|
||||||
{
|
{
|
||||||
if (Request["hasPrice"].ToString() == "Y")
|
if (_hasPrice == "Y")
|
||||||
{
|
{
|
||||||
_query += "有金額\n";
|
_query += "有金額\n";
|
||||||
}
|
}
|
||||||
else if (Request["hasPrice"].ToString() == "N")
|
else if (_hasPrice == "N")
|
||||||
{
|
{
|
||||||
_query += "無金額\n";
|
_query += "無金額\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//管理報表
|
//管理報表
|
||||||
if (!string.IsNullOrEmpty(Request["year"]))
|
if (!string.IsNullOrEmpty(_year))
|
||||||
{
|
{
|
||||||
title.Text = "報名管理報表";
|
title.Text = "報名管理報表";
|
||||||
int yearParam = Convert.ToInt32(Request["year"]);
|
int year = Convert.ToInt32(_year);
|
||||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Year == yearParam);
|
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Year == year);
|
||||||
_query += "年份:" + Request["year"] + "\n";
|
_query += "年份:" + _year + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["month"]))
|
if (!string.IsNullOrEmpty(_month))
|
||||||
{
|
{
|
||||||
int monthParam = Convert.ToInt32(Request["month"]);
|
int month = Convert.ToInt32(_month);
|
||||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Month == monthParam);
|
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Month == month);
|
||||||
_query += "月份:" + Request["month"] + "\n";
|
_query += "月份:" + _month + "\n";
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(Request["season"]))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (Request["season"] == "1")
|
if (!string.IsNullOrEmpty(_season))
|
||||||
|
{
|
||||||
|
if (_season == "1")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.up_time.HasValue)
|
qry = qry.Where(o => o.up_time.HasValue)
|
||||||
.Where(o => o.up_time.Value.Month == 1 || o.up_time.Value.Month == 2 || o.up_time.Value.Month == 3);
|
.Where(o => o.up_time.Value.Month == 1 || o.up_time.Value.Month == 2 || o.up_time.Value.Month == 3);
|
||||||
}
|
}
|
||||||
else if (Request["season"] == "2")
|
else if (_season == "2")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.up_time.HasValue)
|
qry = qry.Where(o => o.up_time.HasValue)
|
||||||
.Where(o => o.up_time.Value.Month == 4 || o.up_time.Value.Month == 5 || o.up_time.Value.Month == 6);
|
.Where(o => o.up_time.Value.Month == 4 || o.up_time.Value.Month == 5 || o.up_time.Value.Month == 6);
|
||||||
}
|
}
|
||||||
else if (Request["season"] == "3")
|
else if (_season == "3")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.up_time.HasValue)
|
qry = qry.Where(o => o.up_time.HasValue)
|
||||||
.Where(o => o.up_time.Value.Month == 7 || o.up_time.Value.Month == 8 || o.up_time.Value.Month == 9);
|
.Where(o => o.up_time.Value.Month == 7 || o.up_time.Value.Month == 8 || o.up_time.Value.Month == 9);
|
||||||
}
|
}
|
||||||
else if (Request["season"] == "4")
|
else if (_season == "4")
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.up_time.HasValue)
|
qry = qry.Where(o => o.up_time.HasValue)
|
||||||
.Where(o => o.up_time.Value.Month == 10 || o.up_time.Value.Month == 11 || o.up_time.Value.Month == 12);
|
.Where(o => o.up_time.Value.Month == 10 || o.up_time.Value.Month == 11 || o.up_time.Value.Month == 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
_query += "季度:" + Request["season"] + "\n";
|
_query += "季度:" + _season + "\n";
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(Request["chk_hasact"]) && Convert.ToBoolean(Request["chk_hasact"]))
|
|
||||||
|
if (!string.IsNullOrEmpty(_chkHasAct) && Convert.ToBoolean(_chkHasAct))
|
||||||
{
|
{
|
||||||
_query += "活動報名\n";
|
_query += "活動報名\n";
|
||||||
if (!string.IsNullOrEmpty(Request["chk_noact"]) && Convert.ToBoolean(Request["chk_noact"]))
|
|
||||||
|
if (!string.IsNullOrEmpty(_chkNoAct) && Convert.ToBoolean(_chkNoAct))
|
||||||
{
|
{
|
||||||
_query += "非活動報名\n";
|
_query += "非活動報名\n";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["select_act"]))
|
if (!string.IsNullOrEmpty(_selectAct))
|
||||||
{
|
{
|
||||||
int selectActParam = Convert.ToInt32(Request["select_act"]);
|
int selectAct = Convert.ToInt32(_selectAct);
|
||||||
if (selectActParam > 0)
|
if (selectAct > 0)
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.activity_num.HasValue && o.activity_num.Value == selectActParam);
|
qry = qry.Where(o => o.activity_num.HasValue && o.activity_num.Value == selectAct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.activity_num.HasValue);
|
qry = qry.Where(o => o.activity_num.HasValue);
|
||||||
if (!string.IsNullOrEmpty(Request["select_act"]))
|
|
||||||
|
if (!string.IsNullOrEmpty(_selectAct))
|
||||||
{
|
{
|
||||||
int selectActParam = Convert.ToInt32(Request["select_act"]);
|
int selectAct = Convert.ToInt32(_selectAct);
|
||||||
if (selectActParam > 0)
|
if (selectAct > 0)
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.activity_num.Value == selectActParam);
|
qry = qry.Where(o => o.activity_num.Value == selectAct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Request["chk_noact"]) && Convert.ToBoolean(Request["chk_noact"]))
|
if (!string.IsNullOrEmpty(_chkNoAct) && Convert.ToBoolean(_chkNoAct))
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.activity_num == null);
|
qry = qry.Where(o => o.activity_num == null);
|
||||||
_query += "非活動報名\n";
|
_query += "非活動報名\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["select_actitem"]))
|
if (!string.IsNullOrEmpty(_selectActItem))
|
||||||
{
|
{
|
||||||
int selectActItemParam = Convert.ToInt32(Request["select_actitem"]);
|
int selectActItem = Convert.ToInt32(_selectActItem);
|
||||||
if (selectActItemParam > 0)
|
if (selectActItem > 0)
|
||||||
{
|
{
|
||||||
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem_num.Value == selectActItemParam).Count() > 0);
|
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem_num.Value == selectActItem).Count() > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request["year"]))
|
if (!string.IsNullOrEmpty(_year))
|
||||||
qry = qry.OrderByDescending(o => o.activity != null ? o.activity.startDate_solar : null).ThenByDescending(o=>o.up_time).ThenByDescending(o=>o.order_no);
|
qry = qry.OrderByDescending(o => o.activity != null ? o.activity.startDate_solar : null).ThenByDescending(o => o.up_time).ThenByDescending(o => o.order_no);
|
||||||
else
|
else
|
||||||
qry = qry.OrderByDescending(o => o.order_no);
|
qry = qry.OrderByDescending(o => o.order_no);
|
||||||
|
|
||||||
//紀錄匯出條件
|
//紀錄匯出條件
|
||||||
var prod= qry.ToList();
|
var prod = qry.ToList();
|
||||||
if (prod.Count > 0)
|
if (prod.Count > 0)
|
||||||
{
|
{
|
||||||
tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
|
tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
|
||||||
@@ -234,14 +250,10 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
|||||||
|
|
||||||
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.Order, (int)Model.admin_log.Status.Print, admin_log.LogViewBtn(prod.Select(x => x.order_no).ToList()));
|
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Print, admin_log.LogViewBtn(prod.Select(x => x.order_no).ToList()));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlaceHolder1.Visible = true;
|
PlaceHolder1.Visible = true;
|
||||||
//Response.Clear();
|
|
||||||
//Response.StatusCode = 404;
|
|
||||||
//Response.End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string _data = "列印時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
string _data = "列印時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
@@ -249,91 +261,194 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
|||||||
_data += "<br>列印條件 : " + (!string.IsNullOrEmpty(_query) ? _query : "-");
|
_data += "<br>列印條件 : " + (!string.IsNullOrEmpty(_query) ? _query : "-");
|
||||||
footer.Text = _data;
|
footer.Text = _data;
|
||||||
|
|
||||||
if (Request["hasPrice"].ToString() == "Y")
|
if (!string.IsNullOrEmpty(_hasPrice) && _hasPrice == "Y" && Repeater1.Items.Count > 0)
|
||||||
{
|
{
|
||||||
((Panel)Repeater1.Items[Repeater1.Items.Count - 1].FindControl("hr")).Visible = false;
|
Panel hrPanel = (Panel)Repeater1.Items[Repeater1.Items.Count - 1].FindControl("hr");
|
||||||
|
if (hrPanel != null)
|
||||||
|
{
|
||||||
|
hrPanel.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
int _total = 0;
|
int _total = 0;
|
||||||
int _item_qty = 0;
|
int _item_qty = 0;
|
||||||
foreach (RepeaterItem gItem in Repeater1.Items)
|
foreach (RepeaterItem gItem in Repeater1.Items)
|
||||||
{
|
{
|
||||||
Repeater rpt = (Repeater)gItem.FindControl("Repeater2");
|
Repeater rpt = (Repeater)gItem.FindControl("Repeater2");
|
||||||
foreach (RepeaterItem rItem in rpt.Items)
|
if (rpt != null)
|
||||||
{
|
{
|
||||||
Literal item_price = (Literal)rItem.FindControl("item_price");
|
foreach (RepeaterItem rItem in rpt.Items)
|
||||||
Literal item_qty = (Literal)rItem.FindControl("item_qty");
|
{
|
||||||
|
Literal item_price = (Literal)rItem.FindControl("item_price");
|
||||||
|
Literal item_qty = (Literal)rItem.FindControl("item_qty");
|
||||||
|
|
||||||
_total += Convert.ToInt32(item_price.Text) * Convert.ToInt32(item_qty.Text);
|
int price = 0;
|
||||||
_item_qty += Convert.ToInt32(item_qty.Text);
|
int qty = 0;
|
||||||
|
|
||||||
|
if (item_price != null && !string.IsNullOrEmpty(item_price.Text))
|
||||||
|
{
|
||||||
|
int.TryParse(item_price.Text, out price);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item_qty != null && !string.IsNullOrEmpty(item_qty.Text))
|
||||||
|
{
|
||||||
|
int.TryParse(item_qty.Text, out qty);
|
||||||
|
}
|
||||||
|
|
||||||
|
_total += price * qty;
|
||||||
|
_item_qty += qty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_data = "報名單筆數 : " + Repeater1.Items.Count;
|
_data = "報名單筆數 : " + Repeater1.Items.Count;
|
||||||
_data += "</td><td>項目數量合計 : " + _item_qty;
|
_data += "</td><td>項目數量合計 : " + _item_qty;
|
||||||
_data += "</td><td>金額合計 : $" + _total;
|
_data += "</td><td>金額合計 : $" + _total;
|
||||||
|
|
||||||
count_data.Text = _data;
|
count_data.Text = _data;
|
||||||
count_data2.Text = _data;
|
count_data2.Text = _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Response.Clear();
|
Response.Clear();
|
||||||
Response.StatusCode = 404;
|
Response.StatusCode = 404;
|
||||||
Response.End();
|
Response.End();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化所有 Request 參數
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeRequestParameters()
|
||||||
|
{
|
||||||
|
_orderNo = Request["order_no"]?.Trim();
|
||||||
|
_subject = Request["subject"]?.Trim();
|
||||||
|
_uName = Request["u_name"]?.Trim();
|
||||||
|
_introducer = Request["introducerTxt"]?.Trim();
|
||||||
|
_actItem = Request["actItemTxt"]?.Trim();
|
||||||
|
_keyin1 = Request["keyin1"]?.Trim();
|
||||||
|
_address = Request["address"]?.Trim();
|
||||||
|
_upTime1 = Request["up_time1"]?.Trim();
|
||||||
|
_upTime2 = Request["up_time2"]?.Trim();
|
||||||
|
_country = Request["country"]?.Trim();
|
||||||
|
_country2 = Request["country2"]?.Trim();
|
||||||
|
_hasPrice = Request["hasPrice"]?.Trim();
|
||||||
|
_year = Request["year"]?.Trim();
|
||||||
|
_month = Request["month"]?.Trim();
|
||||||
|
_season = Request["season"]?.Trim();
|
||||||
|
_chkHasAct = Request["chk_hasact"]?.Trim();
|
||||||
|
_chkNoAct = Request["chk_noact"]?.Trim();
|
||||||
|
_selectAct = Request["select_act"]?.Trim();
|
||||||
|
_selectActItem = Request["select_actitem"]?.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
||||||
{
|
{
|
||||||
Model.pro_order row = (Model.pro_order)e.Item.DataItem;
|
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||||
|
{
|
||||||
|
Model.pro_order row = (Model.pro_order)e.Item.DataItem;
|
||||||
|
|
||||||
((Literal)e.Item.FindControl("keyin1")).Text = Model.pro_order.keyin1_value_to_text(row.keyin1);
|
Literal keyin1Lit = (Literal)e.Item.FindControl("keyin1");
|
||||||
((Literal)e.Item.FindControl("f_numTxt")).Text = row.f_num.HasValue ? row.follower.u_name : "";
|
if (keyin1Lit != null)
|
||||||
((Literal)e.Item.FindControl("activityTxt")).Text = row.activity_num.HasValue ? row.activity.subject : "";
|
{
|
||||||
|
keyin1Lit.Text = Model.pro_order.keyin1_value_to_text(row.keyin1);
|
||||||
|
}
|
||||||
|
|
||||||
Repeater Repeater2 = (Repeater)e.Item.FindControl("Repeater2");
|
Literal fNumTxtLit = (Literal)e.Item.FindControl("f_numTxt");
|
||||||
var _ds = _detail.Where(x => x.order_no == row.order_no).ToList();
|
if (fNumTxtLit != null)
|
||||||
if (_ds .Count>0) {
|
{
|
||||||
((PlaceHolder)e.Item.FindControl("detailTable")).Visible = true;
|
fNumTxtLit.Text = row.f_num.HasValue && row.follower != null ? row.follower.u_name : "";
|
||||||
Repeater2.DataSource = _ds;
|
}
|
||||||
Repeater2.DataBind();
|
|
||||||
|
|
||||||
((PlaceHolder)e.Item.FindControl("PlaceHolder2")).Visible = Request["hasPrice"].ToString() == "Y";
|
Literal activityTxtLit = (Literal)e.Item.FindControl("activityTxt");
|
||||||
|
if (activityTxtLit != null)
|
||||||
|
{
|
||||||
|
activityTxtLit.Text = row.activity_num.HasValue && row.activity != null ? row.activity.subject : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater Repeater2 = (Repeater)e.Item.FindControl("Repeater2");
|
||||||
|
if (Repeater2 != null)
|
||||||
|
{
|
||||||
|
var _ds = _detail.Where(x => x.order_no == row.order_no).ToList();
|
||||||
|
if (_ds.Count > 0)
|
||||||
|
{
|
||||||
|
PlaceHolder detailTable = (PlaceHolder)e.Item.FindControl("detailTable");
|
||||||
|
if (detailTable != null)
|
||||||
|
{
|
||||||
|
detailTable.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater2.DataSource = _ds;
|
||||||
|
Repeater2.DataBind();
|
||||||
|
|
||||||
|
PlaceHolder ph2 = (PlaceHolder)e.Item.FindControl("PlaceHolder2");
|
||||||
|
if (ph2 != null)
|
||||||
|
{
|
||||||
|
ph2.Visible = !string.IsNullOrEmpty(_hasPrice) && _hasPrice == "Y";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
||||||
{
|
{
|
||||||
Model.pro_order_detail row = (Model.pro_order_detail)e.Item.DataItem;
|
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||||
|
{
|
||||||
|
Model.pro_order_detail row = (Model.pro_order_detail)e.Item.DataItem;
|
||||||
|
|
||||||
Literal actitem_numTxt = (Literal)e.Item.FindControl("actitem_numTxt");
|
Literal actitem_numTxt = (Literal)e.Item.FindControl("actitem_numTxt");
|
||||||
actitem_numTxt.Text = row.actItem_num.HasValue ? row.actItem.subject : "";
|
if (actitem_numTxt != null)
|
||||||
|
{
|
||||||
|
actitem_numTxt.Text = row.actItem_num.HasValue && row.actItem != null ? row.actItem.subject : "";
|
||||||
|
}
|
||||||
|
|
||||||
((Literal)e.Item.FindControl("f_numTxt")).Text = row.f_num.HasValue ? row.follower.u_name : "";
|
Literal fNumTxtLit = (Literal)e.Item.FindControl("f_numTxt");
|
||||||
((Literal)e.Item.FindControl("from_idTxt")).Text = row.from_id.HasValue ? row.follower1.u_name : "";
|
if (fNumTxtLit != null)
|
||||||
|
{
|
||||||
|
fNumTxtLit.Text = row.f_num.HasValue && row.follower != null ? row.follower.u_name : "";
|
||||||
|
}
|
||||||
|
|
||||||
((Literal)e.Item.FindControl("due_date")).Text = row.due_date.HasValue? row.due_date.Value.ToString("yyyy-MM-dd"):"";
|
Literal fromIdTxtLit = (Literal)e.Item.FindControl("from_idTxt");
|
||||||
// ((Literal)e.Item.FindControl("start_date")).Text = row.start_date.HasValue? row.start_date.Value.ToString("yyyy-MM-dd"):"";
|
if (fromIdTxtLit != null)
|
||||||
((Literal)e.Item.FindControl("extend_date")).Text = row.extend_date.HasValue? row.extend_date.Value.ToString("yyyy-MM-dd"):"";
|
{
|
||||||
|
fromIdTxtLit.Text = row.from_id.HasValue && row.follower1 != null ? row.follower1.u_name : "";
|
||||||
|
}
|
||||||
|
|
||||||
//劃位狀態
|
Literal dueDateLit = (Literal)e.Item.FindControl("due_date");
|
||||||
int writeBedQty = _bedDt.Where(b => b.bed_order.o_detail_id == row.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(); //已劃數量
|
if (dueDateLit != null)
|
||||||
int notBedQty = _bedDt.Where(b => b.bed_order.o_detail_id == row.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(); //未劃數量
|
{
|
||||||
((Literal)e.Item.FindControl("BedQty")).Text = (Convert.ToInt32(row.actItem?.category) == (int)Model.activity.category.Order) ? (notBedQty + "/" + writeBedQty) : "";
|
dueDateLit.Text = row.due_date.HasValue ? row.due_date.Value.ToString("yyyy-MM-dd") : "";
|
||||||
|
}
|
||||||
|
|
||||||
((Literal)e.Item.FindControl("keyin1")).Text = row.keyin1.HasValue && row.keyin1.Value > 0 ? tdesc[row.keyin1 ?? 1] : "";
|
Literal extendDateLit = (Literal)e.Item.FindControl("extend_date");
|
||||||
|
if (extendDateLit != null)
|
||||||
|
{
|
||||||
|
extendDateLit.Text = row.extend_date.HasValue ? row.extend_date.Value.ToString("yyyy-MM-dd") : "";
|
||||||
|
}
|
||||||
|
|
||||||
((PlaceHolder)e.Item.FindControl("PlaceHolder2")).Visible = Request["hasPrice"].ToString() == "Y";
|
//劃位狀態
|
||||||
|
int writeBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count();
|
||||||
|
int notBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count();
|
||||||
|
|
||||||
|
Literal bedQtyLit = (Literal)e.Item.FindControl("BedQty");
|
||||||
|
if (bedQtyLit != null)
|
||||||
|
{
|
||||||
|
bedQtyLit.Text = (row.actItem != null && row.actItem.category.HasValue && Convert.ToInt32(row.actItem.category.Value) == (int)Model.activity.category.Order) ? (notBedQty + "/" + writeBedQty) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Literal keyin1Lit = (Literal)e.Item.FindControl("keyin1");
|
||||||
|
if (keyin1Lit != null)
|
||||||
|
{
|
||||||
|
keyin1Lit.Text = row.keyin1.HasValue && row.keyin1.Value > 0 && tdesc.ContainsKey(row.keyin1.Value) ? tdesc[row.keyin1.Value] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaceHolder ph2 = (PlaceHolder)e.Item.FindControl("PlaceHolder2");
|
||||||
|
if (ph2 != null)
|
||||||
|
{
|
||||||
|
ph2.Visible = !string.IsNullOrEmpty(_hasPrice) && _hasPrice == "Y";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user