public HttpResponseBase UserConditonAddOrEdit() { string json = "{success:false}"; try { EventPromoUserConditionQuery query = new EventPromoUserConditionQuery(); if (!string.IsNullOrEmpty(Request.Params["condition_ids"])) { query.condition_id = Convert.ToInt32(Request.Params["condition_ids"]); } if (!string.IsNullOrEmpty(Request.Params["condition_name"])) { query.condition_name = Request.Params["condition_name"]; } if (!string.IsNullOrEmpty(Request.Params["level_id"])) { query.level_id = Request.Params["level_id"]; } if (!string.IsNullOrEmpty(Request.Params["first_buy_time"])) { query.first_buy_time = Convert.ToInt32(BLL.gigade.Common.CommonFunction.GetPHPTime(Request.Params["first_buy_time"])); } if (!string.IsNullOrEmpty(Request.Params["reg_start"])) { query.reg_start = Convert.ToInt32(BLL.gigade.Common.CommonFunction.GetPHPTime(Request.Params["reg_start"])); } if (!string.IsNullOrEmpty(Request.Params["reg_end"])) { query.reg_end = Convert.ToInt32(BLL.gigade.Common.CommonFunction.GetPHPTime(Request.Params["reg_end"])); } if (!string.IsNullOrEmpty(Request.Params["buy_times_min"])) { query.buy_times_min = Convert.ToInt32(Request.Params["buy_times_min"]); } if (!string.IsNullOrEmpty(Request.Params["buy_times_max"])) { query.buy_times_max = Convert.ToInt32(Request.Params["buy_times_max"]); } if (!string.IsNullOrEmpty(Request.Params["buy_amount_min"])) { query.buy_amount_min = Convert.ToInt32(Request.Params["buy_amount_min"]); } if (!string.IsNullOrEmpty(Request.Params["buy_amount_max"])) { query.buy_amount_max = Convert.ToInt32(Request.Params["buy_amount_max"]); } if (!string.IsNullOrEmpty(Request.Params["group_id"])) { query.group_id = Convert.ToInt32(Request.Params["group_id"]); } ipuConditionMgr = new EventpromoUserConditionMgr(mySqlConnectionString); if (query.condition_id > 0)//表示是編輯 { query.modify_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; query.modify_time = DateTime.Now; int result = ipuConditionMgr.AddOrUpdate(query); if (result > 0) { json = "{success:true}"; } } else { query.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; query.create_time = DateTime.Now; query.modify_user = query.create_user; query.modify_time = query.create_time; int result = ipuConditionMgr.AddOrUpdate(query); if (result > 0) { json = "{success:true}"; } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }