public int UpdateModel(EventPromoAdditionalPriceGroup model)
 {
     try
     {
         return dao.UpdateModel(model);
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceGroupMgr-->UpdateModel-->" + ex.Message, ex);
     }
 }
 public List<EventPromoAdditionalPriceGroup> GetPromoProductGroup(EventPromoAdditionalPriceGroup model)
 {
     try
     {
         return dao.GetPromoProductGroup(model);
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceProductMgr-->GetPromoProductGroup-->" + ex.Message, ex);
     }
 }
 public List<EventPromoAdditionalPriceGroupQuery> GetList(EventPromoAdditionalPriceGroup model)
 {
     try
     {
         return dao.GetList(model);
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceGroupMgr-->GetList-->" + ex.Message, ex);
     }
 }
 public List<EventPromoAdditionalPriceGroup> GetPromoProductGroup(EventPromoAdditionalPriceGroup model)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("select * from event_promo_additional_price_product ");
         sql.AppendFormat(" where group_id={0}", model.group_id);
         return access.getDataTableForObj<Model.EventPromoAdditionalPriceGroup>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceProductDao-->GetPromoProductGroup-->" + ex.Message + sql.ToString(), ex);
     }
 }
        public int UpdateModel(EventPromoAdditionalPriceGroup model)
        {
            StringBuilder sbAll = new StringBuilder();
            try
            {
                sbAll.AppendFormat("update event_promo_additional_price_group set group_name='{0}',group_status={1},modify_user={2},modify_time='{3}' where group_id={4}",model.group_name,model.group_status,model.modify_user,Common.CommonFunction.DateTimeToString(model.modify_time),model.group_id);
                return access.execCommand(sbAll.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("EventPromoAdditionalPriceGroupDao-->UpdateModel-->" + ex.Message + sbAll.ToString(), ex);
            }
        }
 public int InsertModel(EventPromoAdditionalPriceGroup model)
 {
     StringBuilder sbAll = new StringBuilder();
     try
     {
         sbAll.Append("insert into event_promo_additional_price_group(group_name,create_user,create_date,modify_user,modify_time,group_status)");
         sbAll.AppendFormat("values('{0}',{1},'{2}',{3},'{4}',{5})",model.group_name,model.create_user,Common.CommonFunction.DateTimeToString(model.create_date),model.modify_user,Common.CommonFunction.DateTimeToString(model.modify_time),model.group_status);
         return access.execCommand(sbAll.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceGroupDao-->InsertModel-->" + ex.Message + sbAll.ToString(), ex);
     }
 }
 public List<EventPromoAdditionalPriceGroupQuery> GetList(EventPromoAdditionalPriceGroup model)
 {
     StringBuilder sbAll = new StringBuilder();
     try
     {
         sbAll.Append("SELECT eg.group_id,mu.user_username,eg.group_name,eg.group_status,eg.create_user,eg.create_date,eg.modify_user,eg.modify_time FROM event_promo_additional_price_group  AS eg ");
         sbAll.Append("left join manage_user mu on eg.create_user=mu.user_id ");
         if(model.group_name!=string.Empty)
         {
             sbAll.AppendFormat(" where eg.group_name='{0}'",model.group_name);
         }
         return access.getDataTableForObj<EventPromoAdditionalPriceGroupQuery>(sbAll.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("EventPromoAdditionalPriceGroupDao-->GetList-->" + ex.Message+sbAll.ToString(), ex);
     }
 }
        public HttpResponseBase GetProductGroupCbo()
        {

            string jsonStr = "{success:false,data:[]}";
            try
            {
                EventPromoAdditionalPriceGroup model = new EventPromoAdditionalPriceGroup();
                epapgMgr = new EventPromoAdditionalPriceGroupMgr(mySqlConnectionString);
                List<EventPromoAdditionalPriceGroupQuery> _list = epapgMgr.GetList(model);

                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                jsonStr = "{success:true,data:" + JsonConvert.SerializeObject(_list, Formatting.Indented, timeConverter) + "}";//返回json數據
            }
            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(jsonStr.ToString());
            this.Response.End();
            return this.Response;
        }
 public HttpResponseBase GetGroupName()
 {
     string jsonStr = "{success:false}";
     try
     {
         EventPromoAdditionalPriceGroup model = new EventPromoAdditionalPriceGroup();
         if (!string.IsNullOrEmpty(Request.Params["group_name"]))
         {
             model.group_name = Request.Params["group_name"];
         }
         epapgMgr = new EventPromoAdditionalPriceGroupMgr(mySqlConnectionString);
         if (epapgMgr.GetList(model).Count > 0)
         {
             jsonStr = "{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(jsonStr.ToString());
     this.Response.End();
     return this.Response;
 }
        public HttpResponseBase SaveEventPromoAdditionalPriceGroup()
        {

            string jsonStr = "{success:false}";
            try
            {
                EventPromoAdditionalPriceGroup model = new EventPromoAdditionalPriceGroup();


                if (!string.IsNullOrEmpty(Request.Params["group_name"]))
                {
                    model.group_name = Request.Params["group_name"];
                }
                if (!string.IsNullOrEmpty(Request.Params["group_id"]))
                {
                    model.group_id = int.Parse(Request.Params["group_id"]);
                }

                model.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                model.create_date = DateTime.Now;
                model.modify_user = model.create_user;
                model.modify_time = model.create_date;
                model.group_status = 1;

                epapgMgr = new EventPromoAdditionalPriceGroupMgr(mySqlConnectionString);
                if (model.group_id == 0)
                {
                    if (epapgMgr.InsertModel(model) > 0)
                    {
                        jsonStr = "{success:true}";
                    }
                }
                else
                {
                    if (epapgMgr.UpdateModel(model) > 0)
                    {
                        jsonStr = "{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(jsonStr.ToString());
            this.Response.End();
            return this.Response;
        }