コード例 #1
0
 public HttpResponseBase GetEventCondiUser()
 {
     string json = "{success:false,data:[]}";
     try
     {
         ipuConditionMgr = new EventpromoUserConditionMgr(mySqlConnectionString);
         json = ipuConditionMgr.GetEventCondi(new EventPromoUserConditionQuery { });
     }
     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;
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        public HttpResponseBase DeleteUserCondition()
        {
            string json = string.Empty;
            try
            {
                EventPromoUserConditionQuery query = new EventPromoUserConditionQuery();
                if (!string.IsNullOrEmpty(Request.Params["ids"]))
                {
                    string condition_id = Request.Params["ids"];
                    query.condition_id_tostring = condition_id.Substring(0, condition_id.LastIndexOf(','));
                }
                ipuConditionMgr = new EventpromoUserConditionMgr(mySqlConnectionString);
                int result = ipuConditionMgr.Delete(query);
                if (result > 0)
                {
                    json = "{success:true}";
                }
                else
                {
                    json = "{success:false}";
                }

            }
            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);
                json = "{success:false,msg:\"" + "" + "\"}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
コード例 #4
0
 public HttpResponseBase GetUserConditionList()
 {
     string json = string.Empty;
     int totalCount = 0;
     EventPromoUserConditionQuery query = new EventPromoUserConditionQuery();
     DataTable _dt = new DataTable();
     query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
     query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["text"]))
         {
             query.condition_name = Request.Params["text"].Trim();
         }
         ipuConditionMgr = new EventpromoUserConditionMgr(mySqlConnectionString);
         _dt = ipuConditionMgr.GetList(query, out totalCount);
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(_dt, Formatting.Indented, timeConverter) + "}";
     }
     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);
         json = "{success:false,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }