public PartialViewResult BatchUpdate()
        {
            Models.TrackersBatchModel m = new Models.TrackersBatchModel();

            using (var client = new OltpLogicClient(session_id))
            {
                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_tracker_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Gateyway);
                    if (is_tracker_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = -1
                        });
                    }
                }
                Oltp.ChannelDataTable channels = client.Service.Channel_Get();
                m.Channels     = channels.ToDictionary(c => c.ID, c => c.DisplayName);
                m.LandingPages = client.Service.Page_Get(acc_id, null, true, -1).ToDictionary(p => p.GK, p => p.DisplayName);
            }


            return(PartialView("BatchTrackers", m));
        }
        public ActionResult Index(int account, string session)
        {
            AppState.AccountID = account;
            AppState.SessionID = session == "" ? null : "";

            acc_id     = AppState.AccountID;
            session_id = AppState.SessionID;

            Models.TrackersListModel m = new Models.TrackersListModel();

            using (var client = new OltpLogicClient(session_id))
            {
                // Load Channels
                Oltp.ChannelDataTable channels = client.Service.Channel_Get();
                m.Channels = channels.OrderBy(x => x.DisplayName).ToDictionary(c => c.ID, c => c.DisplayName);

                // Load Segments
                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);

                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_tracker_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Gateyway);
                    if (is_tracker_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList()
                        });
                    }
                }
            }
            return(View(m));
        }
        public ActionResult EditCreative(long creativeGK)
        {
            Models.CreativeModel m = new Models.CreativeModel();

            using (var client = new OltpLogicClient(session_id))
            {
                Oltp.CreativeRow creative = client.Service.Creative_GetSingle(creativeGK)[0];
                //client.Service.Creative_Get(
                m.Creative = creative;

                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, false);

                foreach (Oltp.SegmentRow r in segments)
                {
                    bool is_creative_segment = ((Auxilary.SegmentAssociationFlags)r.Association).HasFlag(Auxilary.SegmentAssociationFlags.Creative);
                    if (is_creative_segment)
                    {
                        Oltp.SegmentValueDataTable values = client.Service.SegmentValue_Get(acc_id, r.SegmentID);
                        int value;
                        switch (r.SegmentID)
                        {
                        case 1: value = creative.Segment1; break;

                        case 2: value = creative.Segment2; break;

                        case 3: value = creative.Segment3; break;

                        case 4: value = creative.Segment4; break;

                        case 5: value = creative.Segment5; break;

                        default: value = creative.Segment1; break;
                        }


                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = r, Values = values.ToList(), SelectedValue = value
                        });
                    }
                }

                Oltp.AdgroupDataTable creative_adgroups = client.Service.Adgroup_GetByCreative(creativeGK);
                Dictionary <int, Oltp.CampaignRow> campaings_dictionaty = client.Service.Campaign_GetIndividualCampaigns(creative_adgroups.Select(f => f.CampaignGK).ToArray()).ToDictionary(f => f.GK, f => f);

                foreach (Oltp.AdgroupRow r in creative_adgroups)
                {
                    m.Associations.Add(new Models.AssociationRowModel()
                    {
                        AdGroup = r, Campaign = campaings_dictionaty[(int)r.CampaignGK]
                    });
                }

                m.Creative = creative;
            }

            return(PartialView("~/Views/Creatives/CreativeDetails.cshtml", m));
        }
Esempio n. 4
0
        public PartialViewResult EditMultipleAdgroups(string adgroupsGK)
        {
            Oltp.AdgroupDataTable adgroups;
            List <long>           AdgroupsGK = adgroupsGK.Split(',').Select(s => s.Length > 0 ? long.Parse(s) : 0).ToList();

            Models.MultipleAdgroupModel m = new Models.MultipleAdgroupModel();
            m.AdgroupsGK = adgroupsGK;

            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                foreach (long adgroupGK in AdgroupsGK)
                {
                    Oltp.AdgroupDataTable t = client.Service.Adgroup_GetSingle(adgroupGK);
                    if (t.Count > 0)
                    {
                        m.Adgroups.Add(t[0]);
                    }
                }


                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_adgroup_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Adgroup);
                    if (is_adgroup_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        int value;
                        switch (segment.SegmentID)
                        {
                        case 1: value = GetCommonValue(m.Adgroups.Select(x => x.Segment1).ToList()); break;

                        case 2: value = GetCommonValue(m.Adgroups.Select(x => x.Segment2).ToList()); break;

                        case 3: value = GetCommonValue(m.Adgroups.Select(x => x.Segment3).ToList()); break;

                        case 4: value = GetCommonValue(m.Adgroups.Select(x => x.Segment4).ToList()); break;

                        case 5: value = GetCommonValue(m.Adgroups.Select(x => x.Segment5).ToList()); break;

                        default: value = GetCommonValue(m.Adgroups.Select(x => x.Segment1).ToList()); break;
                        }
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                        });
                    }
                }
            }

            return(PartialView("MultipleAdgroupDetails", m));
        }
        public ActionResult EditMultipleCreatives(string creativesGK)
        {
            List <long> CreativesGK = creativesGK.Split(',').Select(s => s.Length > 0 ? long.Parse(s) : 0).ToList();

            Models.MutliCreativeModel m = new Models.MutliCreativeModel();
            m.CreativesGK = creativesGK;

            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                foreach (long creativeGK in CreativesGK)
                {
                    Oltp.CreativeDataTable t = client.Service.Creative_GetSingle(creativeGK);
                    if (t.Count > 0)
                    {
                        m.Creatives.Add(t[0]);
                    }
                }

                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, false);

                foreach (Oltp.SegmentRow r in segments)
                {
                    bool is_creative_segment = ((Auxilary.SegmentAssociationFlags)r.Association).HasFlag(Auxilary.SegmentAssociationFlags.Creative);
                    if (is_creative_segment)
                    {
                        Oltp.SegmentValueDataTable values = client.Service.SegmentValue_Get(acc_id, r.SegmentID);
                        int value;
                        switch (r.SegmentID)
                        {
                        case 1: value = GetCommonValue(m.Creatives.Select(x => x.Segment1).ToList()); break;

                        case 2: value = GetCommonValue(m.Creatives.Select(x => x.Segment2).ToList()); break;

                        case 3: value = GetCommonValue(m.Creatives.Select(x => x.Segment3).ToList()); break;

                        case 4: value = GetCommonValue(m.Creatives.Select(x => x.Segment4).ToList()); break;

                        case 5: value = GetCommonValue(m.Creatives.Select(x => x.Segment5).ToList()); break;

                        default: value = GetCommonValue(m.Creatives.Select(x => x.Segment1).ToList()); break;
                        }

                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = r, Values = values.ToList(), SelectedValue = value
                        });
                    }
                }
            }

            return(PartialView("MultiCreativeDetails", m));
        }
Esempio n. 6
0
        public PartialViewResult EditCampaign(long campaignGK)
        {
            Models.CampaignModel m = new Models.CampaignModel();

            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                m.Campaign = client.Service.Campaign_GetSingle(campaignGK)[0];


                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_campaign_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Campaign);
                    if (is_campaign_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        int value;
                        switch (segment.SegmentID)
                        {
                        case 1: value = m.Campaign.Segment1; break;

                        case 2: value = m.Campaign.Segment2; break;

                        case 3: value = m.Campaign.Segment3; break;

                        case 4: value = m.Campaign.Segment4; break;

                        case 5: value = m.Campaign.Segment5; break;

                        default: value = m.Campaign.Segment1; break;
                        }
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                        });
                    }
                }

                DataTable t = client.Service.CampaignTargets_Get(acc_id, campaignGK);
                if (t.Rows.Count > 0)
                {
                    m.Target_Customer  = t.Rows[0]["CPA_new_users"] == DBNull.Value ? null : (double?)t.Rows[0]["CPA_new_users"];
                    m.Target_Depositor = t.Rows[0]["CPA_new_activations"] == DBNull.Value ? null : (double?)t.Rows[0]["CPA_new_activations"];
                }
            }


            return(PartialView("CampaignDetails", m));
        }
        public PartialViewResult EditTracker(string identifier)
        {
            Models.TrackerModel m = new Models.TrackerModel();

            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                m.Tracker = client.Service.Gateway_GetByIdentifier(acc_id, identifier)[0];

                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_tracker_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Gateyway);
                    if (is_tracker_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        int value;
                        switch (segment.SegmentID)
                        {
                        case 1: value = m.Tracker.Segment1; break;

                        case 2: value = m.Tracker.Segment2; break;

                        case 3: value = m.Tracker.Segment3; break;

                        case 4: value = m.Tracker.Segment4; break;

                        case 5: value = m.Tracker.Segment5; break;

                        default: value = m.Tracker.Segment1; break;
                        }
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                        });
                    }
                }
                Oltp.ChannelDataTable channels = client.Service.Channel_Get();
                m.Channels     = channels.ToDictionary(c => c.ID, c => c.DisplayName);
                m.LandingPages = client.Service.Page_Get(acc_id, null, true, -1).ToDictionary(p => p.GK, p => p.DisplayName);
                m.AppliedTo    = GetReferenceData(m.Tracker, client);
            }


            return(PartialView("TrackerDetails", m));
        }
Esempio n. 8
0
        public ActionResult EditMultipleCampaign(string campaignsGK)
        {
            List <long> CampaingsGK = campaignsGK.Split(',').Select(s => s.Length > 0 ? long.Parse(s) : 0).ToList();

            Models.MultiCampaignModel m = new Models.MultiCampaignModel();
            m.CampaignsGK = campaignsGK;
            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                m.Campaigns = client.Service.Campaign_GetIndividualCampaigns(CampaingsGK.ToArray()).ToList();

                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_campaign_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Campaign);
                    if (is_campaign_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        int value;
                        switch (segment.SegmentID)
                        {
                        case 1: value = GetCommonValue(m.Campaigns.Select(x => x.Segment1).ToList()); break;

                        case 2: value = GetCommonValue(m.Campaigns.Select(x => x.Segment2).ToList()); break;

                        case 3: value = GetCommonValue(m.Campaigns.Select(x => x.Segment3).ToList()); break;

                        case 4: value = GetCommonValue(m.Campaigns.Select(x => x.Segment4).ToList()); break;

                        case 5: value = GetCommonValue(m.Campaigns.Select(x => x.Segment5).ToList()); break;

                        default: value = GetCommonValue(m.Campaigns.Select(x => x.Segment1).ToList()); break;
                        }
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                        });
                    }
                }
            }


            return(PartialView("MultiCampaignDetails", m));
        }
Esempio n. 9
0
        public PartialViewResult EditAdgroup(long adgroupGK)
        {
            Models.AdgroupModel m = new Models.AdgroupModel();

            using (var client = OltpLogicClient.Open(session_id))
            {
                if (client == null)
                {
                    return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml"));
                }

                m.Adgroup = client.Service.Adgroup_GetSingle(adgroupGK)[0];


                Oltp.SegmentDataTable segments = client.Service.Segment_Get(acc_id, true);
                foreach (Oltp.SegmentRow segment in segments)
                {
                    bool is_adgroup_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.Adgroup);
                    if (is_adgroup_segment)
                    {
                        Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                        int value;
                        switch (segment.SegmentID)
                        {
                        case 1: value = m.Adgroup.Segment1; break;

                        case 2: value = m.Adgroup.Segment2; break;

                        case 3: value = m.Adgroup.Segment3; break;

                        case 4: value = m.Adgroup.Segment4; break;

                        case 5: value = m.Adgroup.Segment5; break;

                        default: value = m.Adgroup.Segment1; break;
                        }
                        m.Segments.Add(new Models.SegmentRowModel()
                        {
                            SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                        });
                    }
                }

                Oltp.AdgroupKeywordDataTable k = client.Service.AdgroupKeyword_Get(adgroupGK);
                foreach (Oltp.AdgroupKeywordRow r in k)
                {
                    Models.AdgroupKeywordModel m1 = new Models.AdgroupKeywordModel();
                    m1.DestinationURL = r.DestinationUrlDisplay;
                    m1.KeywordGK      = r.KeywordGK;
                    m1.KeywordName    = r.KeywordDisplay;
                    m1.MatchType      = r.MatchTypeDisplay;
                    m.Keywords.Add(m1);
                }

                Oltp.AdgroupCreativeDataTable c = client.Service.AdgroupCreative_Get(adgroupGK);
                foreach (Oltp.AdgroupCreativeRow r in c)
                {
                    Models.AdgroupCreativeModel m1 = new Models.AdgroupCreativeModel();
                    m1.AdgroupCreativeGK = r.AdgroupCreativeGK;
                    m1.CreativeGK        = r.CreativeGK;
                    m1.Desc1             = r.Desc1;
                    m1.Desc2             = r.Desc2;
                    m1.DestinationURL    = r.DestinationURL;
                    m1.DisplayURL        = r.DisplayURL;
                    m1.Title             = r.Title;

                    foreach (Oltp.SegmentRow segment in segments)
                    {
                        bool is_adgroupcreative_segment = ((Auxilary.SegmentAssociationFlags)segment.Association).HasFlag(Auxilary.SegmentAssociationFlags.AdgroupCreative);
                        if (is_adgroupcreative_segment)
                        {
                            Oltp.SegmentValueDataTable segment_values = client.Service.SegmentValue_Get(acc_id, segment.SegmentID);
                            long value;
                            switch (segment.SegmentID)
                            {
                            case 1: value = r.Segment1; break;

                            case 2: value = r.Segment2; break;

                            case 3: value = r.Segment3; break;

                            case 4: value = r.Segment4; break;

                            case 5: value = r.Segment5; break;

                            case 999: value = r.PageGK; break;

                            default: value = r.Segment1; break;
                            }
                            m1.Segments.Add(new Models.SegmentRowModel()
                            {
                                SegmentRow = segment, Values = segment_values.ToList(), SelectedValue = value
                            });
                        }
                    }

                    m.Creatives.Add(m1);
                }
            }


            return(PartialView("AdgroupDetails", m));
        }