Example #1
0
        /// <summary>
        /// Loads the specified Promotion id.
        /// </summary>
        /// <param name="PromotionId">The Promotion id.</param>
        internal void Load(int PromotionId, Guid customerId, int orderGroupId)
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_mktg_PromotionUsage");
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", MarketingConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("PromotionId", PromotionId, DataParameterType.Int));

            if (customerId == Guid.Empty)
            {
                cmd.Parameters.Add(new DataParameter("CustomerId", DataParameterType.UniqueIdentifier));
            }
            else
            {
                cmd.Parameters.Add(new DataParameter("CustomerId", customerId, DataParameterType.UniqueIdentifier));
            }

            cmd.Parameters.Add(new DataParameter("OrderGroupId", orderGroupId, DataParameterType.Int));

            cmd.DataSet      = this.CurrentDto;
            cmd.TableMapping = Mapping;

            DataService.LoadDataSet(cmd);
        }
Example #2
0
        /// <summary>
        /// Updates the Segment.
        /// </summary>
        internal void Save()
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            using (TransactionScope scope = new TransactionScope())
            {
                DataHelper.SaveDataSetSimple(MarketingContext.MetaDataContext, cmd, CurrentDto, "Segment", "SegmentMember", "SegmentCondition");
                scope.Complete();
            }
        }
Example #3
0
        /// <summary>
        /// Updates the Promotion.
        /// </summary>
        internal void Save()
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            using (TransactionScope scope = new TransactionScope())
            {
                DataHelper.SaveDataSetSimple(MarketingContext.MetaDataContext, cmd, CurrentDto, "PromotionUsage");
                scope.Complete();
            }
        }
Example #4
0
        /// <summary>
        /// Updates the Campaign.
        /// </summary>
        internal void Save()
        {
            // TODO: Check if user is allowed to perform this operation
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            using (TransactionScope scope = new TransactionScope())
            {
                DataHelper.SaveDataSetSimple(MarketingContext.MetaDataContext, cmd, CurrentDto, "Campaign", "CampaignSegment");
                scope.Complete();
            }
        }
Example #5
0
        /// <summary>
        /// Loads the specified Campaign id.
        /// </summary>
        /// <param name="CampaignId">The Campaign id.</param>
        internal void Load(int CampaignId)
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_mktg_Campaign");
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", MarketingConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("CampaignId", CampaignId, DataParameterType.Int));
            cmd.DataSet      = this.CurrentDto;
            cmd.TableMapping = Mapping;

            DataService.LoadDataSet(cmd);
        }
Example #6
0
        /// <summary>
        /// Loads the by category.
        /// </summary>
        /// <param name="category">The category.</param>
        internal void LoadByCategory(string category)
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_mktg_Expression_Category");
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", MarketingConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("Category", category, DataParameterType.NVarChar, 50));
            cmd.DataSet      = this.CurrentDto;
            cmd.TableMapping = Mapping;

            DataService.LoadDataSet(cmd);
        }
Example #7
0
        /// <summary>
        /// Loads the promotion using the specified datetime.
        /// </summary>
        /// <param name="datetime">The datetime in UTC format.</param>
        internal void Load(DateTime datetime)
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_mktg_PromotionByDate");
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", MarketingConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("DateTime", datetime, DataParameterType.DateTime));
            cmd.DataSet      = this.CurrentDto;
            cmd.TableMapping = Mapping;

            DataService.LoadDataSet(cmd);
        }
Example #8
0
        /// <summary>
        /// Loads the statistics table. Pass Guid.Empty for customer id to load non customer specific statistics (gloabl).
        /// </summary>
        /// <param name="customerId">The customer id.</param>
        /// <returns></returns>
        internal DataTable LoadStatistics(Guid customerId)
        {
            DataCommand cmd = MarketingDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_mktg_PromotionUsageStatistics");
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", MarketingConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));

            if (customerId == Guid.Empty)
            {
                cmd.Parameters.Add(new DataParameter("CustomerId", DataParameterType.UniqueIdentifier));
            }
            else
            {
                cmd.Parameters.Add(new DataParameter("CustomerId", customerId, DataParameterType.UniqueIdentifier));
            }

            return(DataService.LoadTable(cmd));
        }