public ActionResult EditKeyword(long keywordGK) { Models.KeywordModel m = new Models.KeywordModel(); using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } m.Keyword = client.Service.Keyword_GetSingle(keywordGK)[0]; Oltp.AdgroupDataTable keyword_adgroups = client.Service.Adgroup_GetByKeyword(keywordGK); Dictionary <int, Oltp.CampaignRow> campaings_dictionaty = client.Service.Campaign_GetIndividualCampaigns(keyword_adgroups.Select(f => f.CampaignGK).ToArray()).ToDictionary(f => f.GK, f => f); foreach (Oltp.AdgroupRow r in keyword_adgroups) { m.Associations.Add(new Models.AssociationRowModel() { AdGroup = r, Campaign = campaings_dictionaty[(int)r.CampaignGK] }); } } return(PartialView("~/Views/Keywords/KeywordDetails.cshtml", m)); }
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)); }
/// <summary> /// /// </summary> /// <param name="filter"></param> /// <param name="include"></param> private void GetPages(Oltp.AccountRow account, string filter, bool include) { Oltp.AccountRow currentAccount = account == null ? this.Window.CurrentAccount : account; if (currentAccount == null) { return; } OltpLogicClient proxy = new OltpLogicClient(); using (proxy) { _pages = proxy.Service.Page_Get(currentAccount.ID, filter, include, -1); } // Get an empty new list if (_items == null) { _items = new ObservableCollection <DataRow>(); } else { _items.Clear(); } // Add all items foreach (DataRow r in _pages.Rows) { _items.Add(r); } _listTable.ListView.ItemsSource = _items; }
public ActionResult Index(int account, string session) { AppState.AccountID = account; AppState.SessionID = session; acc_id = AppState.AccountID; session_id = AppState.SessionID; Models.CampaignListModel m = new Models.CampaignListModel(); using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } Oltp.CampaignDataTable t = client.Service.Campaign_Get(acc_id, null, null, null, false); m.Statuses = client.Service.CampaignStatus_Get().ToDictionary(x => x.ID, x => x.Name); m.Channels = client.Service.Channel_Get().ToDictionary(h => h.ID, h => h.DisplayName); foreach (Oltp.CampaignRow c in t) { m.Campaigns.Add(new Models.CampaignRowModel() { CampaignGK = c.GK, CampaignName = c.IsNameNull() ? "(no name)" : c.Name, Status = m.Statuses.ContainsKey(c.StatusID) ? m.Statuses[c.StatusID] : String.Format("Unknown ({0})", c.StatusID), ChannelName = m.Channels.ContainsKey(c.ChannelID) ? m.Channels[c.ChannelID] : String.Format("Unknown ({0})", c.ChannelID) }); } } return(View(m)); }
public PartialViewResult FindCreatives(string searchText) { Models.CreativeListModel m = new Models.CreativeListModel(); using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } Oltp.CreativeDataTable creatives = client.Service.Creative_Get(acc_id, searchText.Trim() + "*", true); foreach (Oltp.CreativeRow creative in creatives) { if (creative.Title.Trim().Length > 0) { m.Creatives.Add(creative); } } } return(PartialView("Table", m)); }
/// <summary> /// /// </summary> private void Page_dialog_ApplyingChanges(object sender, CancelRoutedEventArgs e) { bool isNew = (Page_dialog.Content as Oltp.PageRow).RowState == DataRowState.Added; // When adding a new page, make sure it is unique if (isNew) { Oltp.PageDataTable tbl; using (OltpLogicClient proxy = new OltpLogicClient()) { tbl = proxy.Service.Page_Get(this.Window.CurrentAccount.ID, _urlField.Text, true, -1); } if (tbl.Rows.Count > 0) { MessageBoxError("Page already exists.", null); e.Cancel = true; return; } } Dialog_ApplyingChanges <Oltp.PageDataTable, Oltp.PageRow>( _pages, Page_dialog, typeof(IOltpLogic).GetMethod("Page_Save"), e); if (e.Cancel) { return; } // Update with new page GK if (isNew && _reservationTable != null) { foreach (Oltp.GatewayReservationRow row in _reservationTable.Rows) { row.PageGK = (Page_dialog.Content as Oltp.PageRow).GK; } } Oltp.GatewayReservationDataTable changes = (Oltp.GatewayReservationDataTable)_reservationTable.GetChanges(); if (changes != null) { try { using (OltpLogicClient proxy = new OltpLogicClient()) { proxy.Service.GatewayReservation_Save(changes); _reservationTable.AcceptChanges(); } } catch (Exception ex) { MessageBoxError("Page was saved but gateway reservations were not.", ex); e.Cancel = true; } } }
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)); }
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)); }
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)); }
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)); }
public ActionResult EditMultipleCreatives(string creativesGK, FormCollection coll) { List <long> CreativesGK = creativesGK.Split(',').Select(s => s.Length > 0 ? long.Parse(s) : 0).ToList(); using (var client = new OltpLogicClient(session_id)) { Oltp.CreativeDataTable Creatives = new Oltp.CreativeDataTable(); foreach (long creativeGK in CreativesGK) { Creatives.Merge(client.Service.Creative_GetSingle(creativeGK)); } foreach (string key in coll.Keys) { if (key.Contains("creativeSegmentValueEdit_")) { if (coll[key] == "1") { string segment_id = key.Split('_')[1]; int segmentID = int.Parse(segment_id); int segmentValue = int.Parse(coll["creativeSegmentValue_" + segment_id]); if (segmentValue != -100) { switch (segmentID) { case 1: Creatives.ToList().ForEach(x => x.Segment1 = segmentValue); break; case 2: Creatives.ToList().ForEach(x => x.Segment2 = segmentValue); break; case 3: Creatives.ToList().ForEach(x => x.Segment3 = segmentValue); break; case 4: Creatives.ToList().ForEach(x => x.Segment4 = segmentValue); break; case 5: Creatives.ToList().ForEach(x => x.Segment5 = segmentValue); break; default: break; } } } } } client.Service.Creative_Save(Creatives); } return(Content("OK")); }
private string GetReferenceData(Oltp.GatewayRow tracker, OltpLogicClient client) { string referenceData = ""; if (tracker.AdgroupGK < 1) { return(""); } Oltp.AdgroupDataTable adg = client.Service.Adgroup_GetSingle(tracker.AdgroupGK); if (adg.Rows.Count < 1) { return(""); } Oltp.AdgroupRow adgroup = adg[0]; Oltp.CampaignDataTable cmpn = client.Service.Campaign_GetSingle(adgroup.CampaignGK); if (cmpn.Rows.Count > 0) { referenceData += "<span>" + (cmpn.Rows[0] as Oltp.CampaignRow).Name + "</span> > "; } referenceData += "<span>" + adgroup.Name + "</span> > "; if (!tracker.IsReferenceTypeNull()) { if (tracker.ReferenceType == Oltp.GatewayReferenceType.Creative) { Oltp.CreativeDataTable c = client.Service.Creative_GetSingle(tracker.ReferenceID); if (c.Rows.Count > 0) { referenceData += "Creative: <span>" + (c[0] as Oltp.CreativeRow).Title + "</span>"; } } else { Oltp.KeywordDataTable k = client.Service.Keyword_GetSingle(tracker.ReferenceID); if (k.Rows.Count > 0) { referenceData += "Keyword: <span>" + (k[0] as Oltp.KeywordRow).Keyword + "</span>"; } } } return(referenceData); }
public PartialViewResult FindKeywords(string searchText) { List <Oltp.KeywordRow> L = new List <Oltp.KeywordRow>(); using (var client = new OltpLogicClient(session_id)) { string str = searchText.Trim().Length > 0 ? searchText.Trim() + "%" : null; Oltp.KeywordDataTable keywords = client.Service.Keyword_Get(acc_id, true, str, true); foreach (Oltp.KeywordRow keyword in keywords) { L.Add(keyword); } } return(PartialView("Table", L)); }
public ActionResult EditTracker(string identifier, FormCollection coll) { Oltp.GatewayDataTable trackers; using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } trackers = client.Service.Gateway_GetByIdentifier(acc_id, identifier); trackers[0].Name = coll["TrackerName"]; trackers[0].ChannelID = int.Parse(coll["Channel"]); trackers[0].DestinationURL = coll["DestinationURL"]; trackers[0].PageGK = long.Parse(coll["LandingPage"]); foreach (string key in coll.Keys) { if (key.Contains("trackerSegmentValue_")) { string segment_id = key.Split('_')[1]; int segmentID = int.Parse(segment_id); int segmentValue = int.Parse(coll[key]); switch (segmentID) { case 1: trackers[0].Segment1 = segmentValue; break; case 2: trackers[0].Segment2 = segmentValue; break; case 3: trackers[0].Segment3 = segmentValue; break; case 4: trackers[0].Segment4 = segmentValue; break; case 5: trackers[0].Segment5 = segmentValue; break; default: break; } } } client.Service.Gateway_Save(trackers); } return(Content("OK")); }
public PartialViewResult FindCreatives(string searchText) { Models.CreativeListModel m = new Models.CreativeListModel(); using (var client = new OltpLogicClient(session_id)) { Oltp.CreativeDataTable creatives = client.Service.Creative_Get(acc_id, searchText + "%", true); foreach (Oltp.CreativeRow creative in creatives) { m.Creatives.Add(creative); } } return(PartialView("Table", m)); }
public ActionResult EditCreative(long creativeGK, FormCollection coll) { Oltp.CreativeDataTable creatives; using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } creatives = client.Service.Creative_GetSingle(creativeGK); } foreach (string key in coll.Keys) { if (key.Contains("creativeSegmentValue_")) { string segment_id = key.Split('_')[1]; int segmentID = int.Parse(segment_id); int segmentValue = int.Parse(coll[key]); switch (segmentID) { case 1: creatives[0].Segment1 = segmentValue; break; case 2: creatives[0].Segment2 = segmentValue; break; case 3: creatives[0].Segment3 = segmentValue; break; case 4: creatives[0].Segment4 = segmentValue; break; case 5: creatives[0].Segment5 = segmentValue; break; default: break; } } } System.Data.DataTable t = creatives.GetChanges(); using (var client = OltpLogicClient.Open(session_id)) { client.Service.Creative_Save(creatives); } return(Content("OK")); }
public PartialViewResult Find(FormCollection colls) { Models.CampaignListModel m = new Models.CampaignListModel(); using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } m.Statuses = client.Service.CampaignStatus_Get().ToDictionary(x => x.ID, x => x.Name); m.Channels = client.Service.Channel_Get().ToDictionary(h => h.ID, h => h.DisplayName); int? channelID = colls["Channel"] == "0" ? null : (int?)int.Parse(colls["Channel"]); int? statusID = colls["Status"] == "0" ? null : (int?)int.Parse(colls["Status"]); string textToSearch = colls["searchText"].Trim().Equals("") ? null : colls["searchText"].Trim() + "*"; bool filterByAdgroup = colls["typeOfSearch"] == "adgroup"; Oltp.CampaignDataTable t = client.Service.Campaign_Get(acc_id, channelID, statusID, textToSearch, filterByAdgroup); foreach (Oltp.CampaignRow c in t) { m.Campaigns.Add(new Models.CampaignRowModel() { CampaignGK = c.GK, CampaignName = c.Name, Status = m.Statuses[c.StatusID], ChannelName = m.Channels[c.ChannelID] }); } DataTable targets = client.Service.CampaignTargets_Get(acc_id, null); Dictionary <long, Models.CampaignRowModel> dic = m.Campaigns.ToDictionary(q => q.CampaignGK, q => q); foreach (DataRow r in targets.Rows) { long campaignGK = (long)(int)r["CampaignGK"]; if (dic.ContainsKey(campaignGK)) { dic[campaignGK].CPA1 = r["CPA_new_users"] == DBNull.Value ? null : (double?)r["CPA_new_users"]; dic[campaignGK].CPA2 = r["CPA_new_activations"] == DBNull.Value ? null : (double?)r["CPA_new_activations"]; } } } return(PartialView("Table", m.Campaigns)); }
public PartialViewResult GetAdgroupsForCampaign(long campaignGK) { List <Models.AdgroupRowModel> L = new List <Models.AdgroupRowModel>(); using (var client = new OltpLogicClient(session_id)) { Oltp.AdgroupDataTable t = client.Service.Adgroup_Get(campaignGK, null); foreach (Oltp.AdgroupRow a in t) { L.Add(new Models.AdgroupRowModel() { AdgroupGK = a.GK, AdgroupName = a.Name }); } } return(PartialView("TableAdgroups", L)); }
public ActionResult Index(int account, string session) { AppState.AccountID = account; AppState.SessionID = session == "" ? null : ""; acc_id = AppState.AccountID; session_id = AppState.SessionID; Models.CampaignListModel m = new Models.CampaignListModel(); using (var client = new OltpLogicClient(session_id)) { //Oltp.CampaignDataTable t = client.Service.Campaign_Get(acc_id, null, null, null, false); m.Statuses = client.Service.CampaignStatus_Get().ToDictionary(x => x.ID, x => x.Name); m.Channels = client.Service.Channel_Get().ToDictionary(h => h.ID, h => h.DisplayName); //foreach(Oltp.CampaignRow c in t) // m.Campaigns.Add(new Models.CampaignRowModel() { CampaignGK = c.GK, CampaignName = c.Name, Status = m.Statuses[c.StatusID], ChannelName = m.Channels[c.ChannelID] }); } return(View(m)); }
public PartialViewResult FindKeywords(string searchText) { List <Oltp.KeywordRow> L = new List <Oltp.KeywordRow>(); using (OltpLogicClient client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } string str = searchText.Trim().Length > 0 ? searchText.Trim() + "*" : null; Oltp.KeywordDataTable keywords = client.Service.Keyword_Get(acc_id, true, str, true); foreach (Oltp.KeywordRow keyword in keywords) { L.Add(keyword); } } return(PartialView("Table", L)); }
/// <summary> /// Open the dialog /// </summary> private void Page_dialog_Open(object sender, RoutedEventArgs e) { // Set dataItem as current item ListViewItem currentItem = _listTable.GetParentListViewItem(e.OriginalSource as FrameworkElement); Oltp.PageRow row = currentItem.Content as Oltp.PageRow; // Show the dialog Page_dialog.Title = "Editing Page"; // Disable editing page value //_urlField.IsReadOnly = true; Page_dialog.BeginEdit( Dialog_MakeEditVersion <Oltp.PageDataTable, Oltp.PageRow>(_pages, row), row ); using (OltpLogicClient proxy = new OltpLogicClient()) { _reservationTable = proxy.Service.GatewayReservation_GetByPage(Window.CurrentAccount.ID, row.GK); } _reservationItems = new ObservableCollection <DataRow>(); foreach (DataRow r in _reservationTable.Rows) { _reservationItems.Add(r); } _reservationListView.ListView.ItemsSource = _reservationItems; // When opening, select it only if no more than one is already selected if (_listTable._listView.SelectedItems.Count < 2) { _listTable._listView.SelectedItems.Clear(); currentItem.IsSelected = true; } }
public PartialViewResult GetAdgroupsForCampaign(long campaignGK) { List <Models.AdgroupRowModel> L = new List <Models.AdgroupRowModel>(); using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } Oltp.AdgroupDataTable t = client.Service.Adgroup_Get(campaignGK, null); foreach (Oltp.AdgroupRow a in t) { L.Add(new Models.AdgroupRowModel() { AdgroupGK = a.GK, AdgroupName = a.Name }); } } return(PartialView("TableAdgroups", L)); }
public ActionResult EditAdgroup(long adgroupGK, FormCollection coll) { Oltp.AdgroupDataTable adgroups; using (var client = OltpLogicClient.Open(session_id)) { if (client == null) { return(PartialView("~/Views/Shared/_SessionExpiredView.cshtml")); } adgroups = client.Service.Adgroup_GetSingle(adgroupGK); foreach (string key in coll.Keys) { if (key.Contains("adgroupSegmentValue_")) { string segment_id = key.Split('_')[1]; int segmentID = int.Parse(segment_id); int segmentValue = int.Parse(coll[key]); switch (segmentID) { case 1: adgroups[0].Segment1 = segmentValue; break; case 2: adgroups[0].Segment2 = segmentValue; break; case 3: adgroups[0].Segment3 = segmentValue; break; case 4: adgroups[0].Segment4 = segmentValue; break; case 5: adgroups[0].Segment5 = segmentValue; break; default: break; } } } client.Service.Adgroup_Save(adgroups, false); Oltp.AdgroupCreativeDataTable adgroupcreatives = client.Service.AdgroupCreative_Get(adgroupGK); foreach (Oltp.AdgroupCreativeRow r in adgroupcreatives) { foreach (string key in coll.Keys) { if (key.Contains("adgroupcreative" + r.AdgroupCreativeGK + "_SegmentValue_")) { string segment_id = key.Split('_')[2]; int segmentID = int.Parse(segment_id); int segmentValue = int.Parse(coll[key]); switch (segmentID) { case 1: r.Segment1 = segmentValue; break; case 2: r.Segment2 = segmentValue; break; case 3: r.Segment3 = segmentValue; break; case 4: r.Segment4 = segmentValue; break; case 5: r.Segment5 = segmentValue; break; case 999: r.PageGK = segmentValue; break; default: break; } } } } client.Service.AdgroupCreative_Save(adgroupcreatives); } return(Content("OK")); }
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)); }