Esempio n. 1
0
        /// <summary>
        /// 保存EventTime
        /// </summary>
        public string SaveEventTimeData()
        {
            var    service           = new MarketEventBLL(CurrentUserInfo);
            var    marketWaveBandBLL = new MarketWaveBandBLL(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.MarketEventID == null || obj.MarketEventID.Trim().Length == 0 ||
                obj.MarketEventID == "null" || obj.MarketEventID == "undefined")
            {
                responseData.success = false;
                responseData.msg     = "活动标示不能为空";
                return(responseData.ToJSON());
            }

            service.Update(obj, false);

            //if (obj.MarketWaveBandList != null)
            //{
            //    foreach (var item in obj.MarketWaveBandList)
            //    {
            //        item.BeginTime = Convert.ToDateTime(item.BeginTime).ToString("yyyy-MM-dd");
            //        item.EndTime = Convert.ToDateTime(item.EndTime).ToString("yyyy-MM-dd");

            //        var exsitObj = marketWaveBandBLL.GetByID(item.WaveBandID);
            //        if (exsitObj != null && exsitObj.WaveBandID.ToString().Length > 0)
            //        {
            //            marketWaveBandBLL.Update(item, false);
            //        }
            //        else
            //        {
            //            marketWaveBandBLL.Create(item);
            //        }
            //    }
            //}

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }
Esempio n. 2
0
        /// <summary>
        /// 保存EventPerson
        /// </summary>
        public string SaveEventPersonData()
        {
            var    service           = new MarketEventBLL(CurrentUserInfo);
            var    marketWaveBandBLL = new MarketWaveBandBLL(CurrentUserInfo);
            var    marketPersonBLL   = new MarketPersonBLL(CurrentUserInfo);
            var    obj          = new MarketPersonEntity();
            var    eventObj     = 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 <MarketPersonEntity>();

            if (obj.MarketEventID == null || obj.MarketEventID.Trim().Length == 0 ||
                obj.MarketEventID == "null" || obj.MarketEventID == "undefined")
            {
                responseData.success = false;
                responseData.msg     = "活动标示不能为空";
                return(responseData.ToJSON());
            }

            marketPersonBLL.WebDelete(new MarketPersonEntity()
            {
                MarketEventID = obj.MarketEventID
            });
            if (obj.MarketPersonInfoList != null)
            {
                foreach (var item in obj.MarketPersonInfoList)
                {
                    //item.MarketPersonID = Utils.NewGuid();
                    item.MarketEventID = MarketEventID;
                    marketPersonBLL.Create(item);
                }
            }

            eventObj.MarketEventID = MarketEventID;
            eventObj.PersonCount   = obj.MarketPersonInfoList.Count;
            service.Update(eventObj, false);

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }
Esempio n. 3
0
        public string SetWaveBandData()
        {
            string content      = string.Empty;
            var    responseData = new ResponseData();
            string key          = string.Empty;

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

            marketWaveBandEntity = key.DeserializeJSONTo <MarketWaveBandEntity>();
            if (marketWaveBandEntity == null)
            {
                responseData.success = false;
                responseData.msg     = "没有传递波段信息";
                return(responseData.ToJSON());
            }
            if (marketWaveBandEntity.MarketWaveBandInfoList == null && marketWaveBandEntity.MarketWaveBandInfoList.Count == 0)
            {
                responseData.success = false;
                responseData.msg     = "没有传递波段内容";
                return(responseData.ToJSON());
            }
            MarketWaveBandBLL server = new MarketWaveBandBLL(this.CurrentUserInfo);

            foreach (MarketWaveBandEntity info in marketWaveBandEntity.MarketWaveBandInfoList)
            {
                if (info.WaveBandID == null || info.WaveBandID.Equals(""))
                {
                    responseData.success = false;
                    responseData.msg     = "没有传递主标识";
                    return(responseData.ToJSON());
                }
                else
                {
                    if (info.WaveBandID.Equals("xxxxx"))
                    {
                        MarketEventEntity eventInfo = new MarketEventEntity();
                        eventInfo.MarketEventID = info.MarketEventID;
                        eventInfo.BeginTime     = info.FactBeginTime;
                        eventInfo.EndTime       = info.FactEndTime;
                        MarketEventBLL eventBll = new MarketEventBLL(this.CurrentUserInfo);
                        eventBll.Update(eventInfo, false);
                    }
                    else
                    {
                        server.Update(info, false);
                    }
                }
            }
            responseData.success = true;
            responseData.msg     = "保存成功.";
            content = responseData.ToJSON();
            return(content);
        }
Esempio n. 4
0
        /// <summary>
        /// 保存EventSend
        /// </summary>
        public string SaveEventSendData()
        {
            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;
            bool   chk           = true;
            bool   chkSMS        = true;
            bool   chkAPP        = true;

            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();
            }

            if (Request("chk") != null && Request("chk") != string.Empty)
            {
                chk = Convert.ToBoolean(Request("chk").ToString().Trim());
            }
            if (Request("chkSMS") != null && Request("chkSMS") != string.Empty)
            {
                chkSMS = Convert.ToBoolean(Request("chkSMS").ToString().Trim());
            }
            if (Request("chkAPP") != null && Request("chkAPP") != string.Empty)
            {
                chkAPP = Convert.ToBoolean(Request("chkAPP").ToString().Trim());
            }

            obj = key.DeserializeJSONTo <MarketEventEntity>();

            var             eventObj        = service.GetByID(MarketEventID);
            string          msgUrl          = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim();
            MarketPersonBLL marketPersonBLL = new MarketPersonBLL(this.CurrentUserInfo);
            var             sendFlag        = marketPersonBLL.SetEventPush(MarketEventID, msgUrl, eventObj.SendTypeId, chk, chkSMS, chkAPP);

            // Update
            obj.MarketEventID = MarketEventID;
            service.Update(obj, false);

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

            content = responseData.ToJSON();
            return(content);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }