Ejemplo n.º 1
0
        /// <summary>
        /// 保存EventTemplate
        /// </summary>
        public string SaveEventTemplateData()
        {
            var    service      = new MarketEventBLL(CurrentUserInfo);
            var    obj          = new MarketEventEntity();
            string content      = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key           = string.Empty;
            string MarketEventID = string.Empty;

            if (Request("data") != null && Request("data") != string.Empty)
            {
                key = Request("data").ToString().Trim();
            }
            if (Request("MarketEventID") != null && Request("MarketEventID") != string.Empty)
            {
                MarketEventID = Request("MarketEventID").ToString().Trim();
            }

            obj = key.DeserializeJSONTo <MarketEventEntity>();

            if (MarketEventID.Trim().Length == 0 || MarketEventID == "null" || MarketEventID == "undefined")
            {
                obj.MarketEventID = Utils.NewGuid();
                obj.EventStatus   = 1;
                service.Create(obj);
            }
            else
            {
                obj.MarketEventID = MarketEventID;
                service.Update(obj, false);
            }

            responseData.success = true;
            responseData.msg     = error;
            responseData.data    = obj.MarketEventID;

            content = responseData.ToJSON();
            return(content);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存Event
        /// </summary>
        public string SaveEventData()
        {
            var    service      = new MarketEventBLL(CurrentUserInfo);
            var    obj          = new MarketEventEntity();
            string content      = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key           = string.Empty;
            string MarketEventID = string.Empty;

            if (Request("data") != null && Request("data") != string.Empty)
            {
                key = Request("data").ToString().Trim();
            }
            if (Request("MarketEventID") != null && Request("MarketEventID") != string.Empty)
            {
                MarketEventID = Request("MarketEventID").ToString().Trim();
            }

            obj = key.DeserializeJSONTo <MarketEventEntity>();

            //if (obj.BrandID == null || obj.BrandID.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "品牌不能为空";
            //    return responseData.ToJSON();
            //}
            //if (obj.EventType == null || obj.EventType.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "活动类型不能为空";
            //    return responseData.ToJSON();
            //}
            //if (obj.EventMode == null || obj.EventMode.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "活动方式不能为空";
            //    return responseData.ToJSON();
            //}

            if (MarketEventID.Trim().Length == 0 || MarketEventID == "null" || MarketEventID == "undefined")
            {
                obj.MarketEventID = Utils.NewGuid();
                obj.CustomerId    = CurrentUserInfo.CurrentUser.customer_id;
                obj.EventStatus   = 1;
                obj.StoreCount    = 0;
                obj.PersonCount   = 0;
                service.Create(obj);
            }
            else
            {
                obj.MarketEventID = MarketEventID;
                service.Update(obj, false);
            }

            responseData.success = true;
            responseData.msg     = error;
            responseData.data    = obj.MarketEventID;

            content = responseData.ToJSON();
            return(content);
        }