/// <summary>
        /// 更新活动信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool UpdateThirdPartActivity(ThirdPartActivity data, string user)
        {
            var result = false;

            try
            {
                if (data != null)
                {
                    result = dbScopeManager.Execute(conn => DALThirdPartActivity.UpdateThirdPartActivity(conn, data)) > 0;
                }
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex, "UpdateThirdPartActivity");
            }

            if (result)
            {
                ActivityBoardManager.InsertLog("UpdateThirdPartActivity", data.PKID.ToString(),
                                               $"Data:{JsonConvert.SerializeObject(data)}", result ? "修改成功" : "修改失败", user, LogType);
                CallCRMService.NewUpdateActivity(data.ActivityName, data.StartTime, data.EndTime, data.WebUrl, data.ActivityRules, data.PKID.ToString(), CRMSourceType.ActivityBoaardThirdParty, user);
            }

            return(result);
        }
        /// <summary>
        /// 添加活动信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool InsertThirdPartActivity(ThirdPartActivity data, string user)
        {
            var result = 0;

            try
            {
                if (data != null)
                {
                    dbScopeManager.Execute(conn =>
                    {
                        result = DALThirdPartActivity.InsertThirdPartActivity(conn, data);
                    });
                }
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex, "InsertThirdPartActivity");
            }

            if (result > 0)
            {
                ActivityBoardManager.InsertLog("InsertThirdPartActivity", result.ToString(),
                                               $"Data:{JsonConvert.SerializeObject(data)}", result > 0 ? "添加成功" : "添加失败", user, LogType);
                CallCRMService.NewAddActivity(data.ActivityName, data.StartTime, data.EndTime, data.WebUrl, data.ActivityRules, result.ToString(), CRMSourceType.ActivityBoaardThirdParty, user);
            }

            return(result > 0);
        }
Ejemplo n.º 3
0
        public bool DeleteTiresActivityConfig(Guid activityId, string user)
        {
            var result = false;

            try
            {
                dbScopeManager.CreateTransaction(conn =>
                {
                    DALTiresActivity.DeleteTiresActivityConfig(conn, activityId);
                    var floorActivityInfo = DALTiresActivity.SelectTiresFloorInfoByParentId(conn, activityId);
                    if (floorActivityInfo != null && floorActivityInfo.Any())
                    {
                        foreach (var item in floorActivityInfo)
                        {
                            DALTiresActivity.DeleteTiresFloorActivity(conn, item.FloorActivityId);
                        }
                    }
                    result = true;
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            if (result)
            {
                InsertLog("DeleteTiresActivityConfig", activityId, "删除轮胎活动", "删除轮胎活动", user, LogType);
                CallCRMService.NewDeleteActivityBySourceId(activityId.ToString(), CRMSourceType.TiresActivityTwo, user);
            }

            return(result);
        }
Ejemplo n.º 4
0
        public bool UpserTiresActivity(TiresActivityModel data, string user)
        {
            var result = false;
            var msg    = string.Empty;
            var isAdd  = false;

            try
            {
                dbScopeManager.Execute(conn =>
                {
                    if (data == null || data.ActivityId == Guid.Empty)
                    {
                        isAdd           = true;
                        msg             = "增加轮胎活动";
                        data.ActivityId = Guid.NewGuid();
                        result          = DALTiresActivity.InsertTiresActivityConfig(conn, data, user) > 0;
                    }
                    else
                    {
                        msg    = "修改轮胎活动";
                        result = DALTiresActivity.UpdateTiresActivityConfig(conn, data, user) > 0;
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            if (result)
            {
                InsertLog("UpserTiresActivity", data.ActivityId, JsonConvert.SerializeObject(data), msg, user, LogType);
                if (isAdd)
                {
                    CallCRMService.NewAddActivity(data.ActivityName, data.StartTime.GetValueOrDefault(), data.EndTime.GetValueOrDefault(), "", data.ActivityRules, data.ActivityId.ToString(), CRMSourceType.TiresActivityTwo, user);
                }
                else
                {
                    CallCRMService.NewUpdateActivity(data.ActivityName, data.StartTime.GetValueOrDefault(), data.EndTime.GetValueOrDefault(), "", data.ActivityRules, data.ActivityId.ToString(), CRMSourceType.TiresActivityTwo, user);
                }
            }

            return(result);
        }
        /// <summary>
        /// 删除活动信息
        /// </summary>
        /// <param name="pkid"></param>
        /// <returns></returns>
        public bool DeleteActivityByPKID(int pkid, string user)
        {
            var result = false;

            try
            {
                result = dbScopeManager.Execute(conn => DALThirdPartActivity.DeleteActivityByPKID(conn, pkid)) > 0;
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex, "DeleteActivityByPKID");
            }
            if (result)
            {
                ActivityBoardManager.InsertLog("DeleteActivityByPKID", pkid.ToString(), $"删除第三方活动", result ? "删除成功" : "删除失败", user, LogType);
                CallCRMService.NewDeleteActivityBySourceId(pkid.ToString(), CRMSourceType.ActivityBoaardThirdParty, user);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public bool DeleteRegionMarketingConfig(Guid activityId, string user)
        {
            var result = false;

            try
            {
                result = dbScopeManager.Execute(conn => DALRegionMarketing.DeleteRegionMarketingConfig(conn, activityId)) > 0;
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex, "");
            }

            if (result)
            {
                InsertLog("DeleteRegionMarketingConfig", activityId, "", "删除活动", user, LogType);
                CallCRMService.NewDeleteActivityBySourceId(activityId.ToString(), CRMSourceType.TiresActivityOne, user);
            }

            return(result);
        }
Ejemplo n.º 7
0
        public bool SaveRegionarketingConfig(RegionMarketingModel data, string user)
        {
            var    result    = false;
            var    flag      = false;
            string msg       = string.Empty;
            var    isAdd     = false;
            var    startTime = data.StartTime.GetValueOrDefault();
            var    endTime   = data.EndTime.GetValueOrDefault();

            try
            {
                if (data != null)
                {
                    data.StartTime = data.EndTime = null;
                    dbScopeManager.CreateTransaction(conn =>
                    {
                        var info = DALRegionMarketing.SelectRegionMarketingConfig(conn, data.ActivityId, string.Empty, null, null, 1, 10);
                        if (info == null || info.Count == 0)
                        {
                            isAdd = true;
                            msg   = "添加活动配置";
                            flag  = DALRegionMarketing.InsertRegionMarketingConfig(conn, data) > 0;
                        }
                        else
                        {
                            msg  = "修改活动配置";
                            flag = DALRegionMarketing.UpdateRegionMarketingConfig(conn, data) > 0;
                        }
                        if (flag)
                        {
                            foreach (var item in data.ImgList)
                            {
                                var imgInfo = DALRegionMarketing.SelectActivityImgByIdAndType(conn, item.ActivityId, item.Type);
                                if (imgInfo != null)
                                {
                                    result = DALRegionMarketing.UpdateActivityImgByIdAnType(conn, item.ActivityId, item.ImgUrl, item.Type, item.Position) > 0;
                                }
                                else
                                {
                                    result = DALRegionMarketing.InsertActivityImg(conn, item.ActivityId, item.ImgUrl, item.Type, item.Position) > 0;
                                }
                            }
                            foreach (var item in data.ProductList)
                            {
                                var proInfo = DALRegionMarketing.SelectRegionProductsByPID(conn, item.ActivityId, item.ProductId);
                                if (proInfo != null)
                                {
                                    result = DALRegionMarketing.UpdateRegionProductInfo(conn, item.ActivityId, item.ProductId, item.AdvertiseTitle, item.SpecialCondition) > 0;
                                }
                                else
                                {
                                    result = DALRegionMarketing.InsertRegionProductInfo(conn, item.ActivityId, item.ProductId, item.AdvertiseTitle, item.SpecialCondition) > 0;
                                }
                            }
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                result = false;
                logger.Log(Level.Error, ex, "SaveRegionarketingConfig");
            }

            if (result)
            {
                data.ProductList = new List <RegionMarketingProductConfig>();
                data.ImgList     = new List <DataAccess.Entity.RegionMarketing.ActivityImageConfig>();
                InsertLog("RegionMarketingLog", data.ActivityId, JsonConvert.SerializeObject(data), msg, user, LogType);
                if (isAdd)
                {
                    CallCRMService.NewAddActivity(data.ActivityName, startTime, endTime, "", data.ActivityRules, data.ActivityId.ToString(), CRMSourceType.TiresActivityOne, user);
                }
                else
                {
                    CallCRMService.NewUpdateActivity(data.ActivityName, startTime, endTime, "", data.ActivityRules, data.ActivityId.ToString(), CRMSourceType.TiresActivityOne, user);
                }
            }

            return(result);
        }