1. 新增法會活動品項:牌位陽上與超度人數限制功能
2. 信眾資料新增全年性選項以及開始參加活動日期,自動報名並代入前一次的報名資料(品項)
This commit is contained in:
@@ -235,6 +235,36 @@ public partial class admin_activity_reg : MyWeb.config
|
||||
#endregion
|
||||
|
||||
#region 資料新增
|
||||
protected string createOrderNumber()
|
||||
{
|
||||
Application.Lock();
|
||||
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
|
||||
|
||||
var qry = _db.companies.AsQueryable();
|
||||
//var prod = qry.Where(q => q.last_order_no.Contains(order_no)).FirstOrDefault();
|
||||
var prod = qry.Where(q => q.num == 1).FirstOrDefault();
|
||||
if (prod != null)
|
||||
{
|
||||
if (!isStrNull(prod.last_order_no) && prod.last_order_no.Contains(order_no))
|
||||
{
|
||||
int tmp = Convert.ToInt32(prod.last_order_no.Replace(order_no, "")) + 1;
|
||||
order_no = order_no + tmp.ToString("0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
order_no = order_no + "0001";
|
||||
}
|
||||
|
||||
prod.last_order_no = order_no;
|
||||
_db.SaveChanges();
|
||||
}
|
||||
else
|
||||
order_no = "";
|
||||
|
||||
Application.UnLock();
|
||||
|
||||
return order_no;
|
||||
}
|
||||
|
||||
protected void add_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -293,6 +323,60 @@ public partial class admin_activity_reg : MyWeb.config
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Activity, (int)Model.admin_log.Status.Insert, subject.Text);
|
||||
|
||||
// 自動報名的信眾報名
|
||||
var qry = _db.followers.Where(f => f.is_auto_enroll == true).AsQueryable();
|
||||
var followers = qry.ToList();
|
||||
if (followers != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var follower in followers)
|
||||
{
|
||||
Model.pro_order pro_order = new Model.pro_order(); //新增
|
||||
|
||||
pro_order.order_no = createOrderNumber();
|
||||
pro_order.up_time = DateTime.Now;
|
||||
pro_order.reg_time = DateTime.Now;
|
||||
pro_order.keyin1 = "A01";
|
||||
pro_order.f_num = follower.num;
|
||||
if (!isStrNull(follower.phone)) { pro_order.phone = follower.phone; }
|
||||
if (!isStrNull(follower.cellphone)) { pro_order.phone = follower.cellphone; }
|
||||
if (IsNumeric(activity.num)) { pro_order.activity_num = activity.num; }
|
||||
pro_order.address = isStrNull(follower.auto_enroll_receipt_address) ? "" : follower.auto_enroll_receipt_address;
|
||||
pro_order.receipt_title = isStrNull(follower.auto_enroll_receipt_title) ? "" : follower.auto_enroll_receipt_title;
|
||||
pro_order.send_receipt = isStrNull(follower.auto_enroll_is_receipt) ? false : follower.auto_enroll_is_receipt;
|
||||
pro_order.demo = "";
|
||||
pro_order.customize_data = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == pro_order.f_num && x.activity_num == pro_order.activity_num);
|
||||
|
||||
if (isRegistered) // 重複報名
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Response.Redirect("index.aspx");
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user