예제 #1
0
 public void AfterCreate()
 {
     if (DigitalInfo == null)
     {
         DigitalInfo = new MediaDigitalInfo();
     }
     DigitalInfo.AfterCreate();
 }
예제 #2
0
        public void Dispose()
        {
            DataChanged = null;
            DataSource  = null;

            DigitalInfo.Dispose();
            DigitalInfo = null;

            Summary.Dispose();
            Summary = null;

            ContractSettings = null;

            Programs.ForEach(p => p.Dispose());
            Programs.Clear();

            Parent = null;
        }
예제 #3
0
        public void AfterCreate()
        {
            if (DigitalInfo == null)
            {
                DigitalInfo = new MediaDigitalInfo();
            }
            DigitalInfo.AfterCreate();

            if (Summary == null)
            {
                Summary = new SectionSummary(this);
            }
            Summary.AfterCreate();

            if (ContractSettings == null)
            {
                ContractSettings = new ContractSettings();
            }
        }
        private Product GetProduct(SymmetryInfo info)
        {


            if (info.SecurityType.ToLowerInvariant() == "bonds")
            {
                var pr = Env.Current.Trade.GetProductByDescription(info.Security);
                if (pr != null) return pr;
                if (!Utilities.IsNullOrEmpty(info.Cusip))
                {
                    pr = Env.Current.Trade.GetProductByCode(Product.CusipProductCode, info.Cusip);
                    if (pr != null) return pr;
                }
                var ccys = new List<string> { info.Currency };
                var allBonds = Env.Current.Trade.LoadBondProducts(null, null, null, 0, ccys, -1, info.Coupon,
                                                                  info.Coupon, null, null, SimpleDate.Today, false,
                                                                  false, null, null);
                if (allBonds != null)
                {
                    foreach (var v in allBonds)
                    {
                        var bd = v as Bond;
                        if (bd == null) continue;
                        if (Math.Abs(bd.FixedRate - info.Coupon) < Utilities.Epsilon && bd.MaturityDate == info.Maturity)
                        {
                           if (!StatusDisabled.Equals(bd.Status)) return bd;
                        }
                    }
                }

                throw new Exception("Bonds " + info.Security + " not retrieved");
            }
            if (info.SecurityType.ToLower() == "currency")
            {
                return null;
            }
            if (info.SecurityType == "Caps/Floors")
            {

            }
            if (info.SecurityType.ToLower() == "currency swaps")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "interest rate swaps")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "swaptions")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "fras")
            {
                return null;
            }
            //Fx Vol Swap
            if (info.SecurityType.ToLower() == "flexible deal" && info.Security.Contains("VOLSWAP"))
            {
                //GBP/USD VOLSWAP 5.925 04 Dec 2014 (02 Sep 2014-02 Dec 2014)
                //USD/JPY VOLSWAP 8.05 17 Nov 2014 (12 Sep 2014-13 Nov 2014)
                var volswap = new VolSwap();
                var desc = info.Security.Split(' ');
                var cpl = desc[0].Split('/');
                var cp = Env.Current.Trade.GetCurrencyPair(cpl[0], cpl[1]);
                volswap.Underlier = cp;
                volswap.UnderlierId = cp.Id;
                volswap.EndDate = info.Maturity;
                volswap.Notional = Math.Abs(info.CurrentDayPosition/100);
                volswap.IsBuy = info.CurrentDayPosition > 0;
                volswap.PaymentCurrency = info.Currency;
                if (desc.Length > 2)
                {
                    double strike;
                    if (double.TryParse(desc[2], out strike))
                        volswap.Strike = strike;
                }
                return volswap;
            }
            //FX Option
            if (info.SecurityType.ToLower() == "simple option" || info.SecurityType.ToLower() == "simple barrier"
                || info.SecurityType.ToLower() == "touch rebate" || info.SecurityType.ToLower() == "flexible deal"
                || info.SecurityType.ToLower() == "double barrier")
            {
                // EUR/USD 1.3204 CALL (26 Nov 2014)
                var fxoption = info.SecurityType.ToLower() == "flexible deal" ?
                    new FxFva { FvaExpiryDate = info.Maturity } : new FXOption { ExpiryDate = info.Maturity };
                var desc = info.Security.Split(' ');
                var cpl = desc[0].Split('/');
                fxoption.Primary = cpl[0];
                fxoption.Quoting = cpl[1];
                if (!(fxoption is FxFva))
                    fxoption.OptionStrike = Convert.ToDouble(desc[1], CultureInfo.InvariantCulture);
                fxoption.PrimaryAmount = Math.Abs(info.CurrentDayPosition);
                fxoption.QuotingAmount = fxoption.PrimaryAmount * fxoption.OptionStrike;
                if (info.Security.Contains("CALL ")) fxoption.OptionType = OptionType.Call;
                else if (info.Security.Contains("PUT ")) fxoption.OptionType = OptionType.Put;
                else fxoption.OptionType = OptionType.None;
                if (info.CurrentDayPosition > 0)
                {
                    fxoption.IsBuy = true;
                    fxoption.QuotingAmount = -fxoption.QuotingAmount;
                }
                else
                {
                    fxoption.IsBuy = false;
                    fxoption.PrimaryAmount = -fxoption.PrimaryAmount;
                }
                fxoption.ExerciseType = OptionExerciseType.European;

                if (info.SecurityType.ToLower() == "flexible deal")
                {
                    // EUR/USD FVA 0 25 Feb 2015 (21 Nov 2014-23 Feb 2015)
                    var fva = fxoption as FxFva;
                    if (fva != null)
                        fva.Volatility = Convert.ToDouble(desc[2], CultureInfo.InvariantCulture) / 100;
                }
                else if (info.SecurityType.ToLower() == "simple barrier")
                {
                    // USD/CNY 6.16 PUT 16 Dec 2014 DO 6.07
                    // USD/SGD 1.265 CALL 24 Sep 2014 UI 1.2725
                    fxoption.ExerciseType = OptionExerciseType.Barrier;
                    var binfo = new BarrierInfo();
                    fxoption.OptionInfo = binfo;
                    var len = desc.Length;
                    var barrierType = desc[len - 2];
                    var barrierStrike = desc[len - 1];
                    if (barrierType.StartsWith("D"))
                    {
                        if (barrierType.EndsWith("I"))
                            binfo.LowerBarrierType = OptionBarrierType.KnockIn;
                        else
                            binfo.LowerBarrierType = OptionBarrierType.KnockOut;
                        binfo.LowerBarrierStrike = double.Parse(barrierStrike);
                    }
                    else
                    {
                        if (barrierType.EndsWith("I"))
                            binfo.BarrierType = OptionBarrierType.KnockIn;
                        else
                            binfo.BarrierType = OptionBarrierType.KnockOut;
                        binfo.BarrierStrike = double.Parse(barrierStrike);
                    }

                }
                else if (info.SecurityType.ToLower() == "double barrier")
                {
                    // USD/JPY 105 CALL 18 Dec 2014 KO 108 101
                    fxoption.ExerciseType = OptionExerciseType.Barrier;
                    var binfo = new BarrierInfo();
                    fxoption.OptionInfo = binfo;
                    var len = desc.Length;
                    var barrierType = desc[len - 3];
                    var barrierStrike1 = desc[len - 1];
                    var barrierStrike2 = desc[len - 2];
                    if (barrierType.Equals("KO"))
                    {
                        binfo.BarrierType = OptionBarrierType.KnockIn;
                        binfo.LowerBarrierType = OptionBarrierType.KnockIn;
                    }
                    else
                    {
                        binfo.BarrierType = OptionBarrierType.KnockOut;
                        binfo.LowerBarrierType = OptionBarrierType.KnockOut;
                    }
                    double strike1, strike2;
                    if (double.TryParse(barrierStrike1, out strike1))
                        binfo.BarrierStrike = strike1;
                    if (double.TryParse(barrierStrike2, out strike2))
                        binfo.LowerBarrierStrike = strike2;
                    if (binfo.BarrierStrike < binfo.LowerBarrierStrike)
                    {
                        var temp = binfo.BarrierStrike;
                        binfo.BarrierStrike = binfo.LowerBarrierStrike;
                        binfo.LowerBarrierStrike = temp;
                    }
                }
                else if (info.SecurityType.ToLower() == "touch rebate")
                {
                    // USD/MXN 13.45  10 Sep 2014 UO 13.45
                    // USD/CAD 1.105  12 Sep 2014 KI 1.105 1.082
                    // GBP/USD 1.59  04 Nov 2014 DO 1.59
                    // for touch, please only compare strikes
                    fxoption.ExerciseType = OptionExerciseType.Touch;
                    var tinfo = new DigitalInfo();
                    fxoption.OptionInfo = tinfo;
                    var len = desc.Length;
                    double strike1, strike2;
                    if (double.TryParse(desc[len - 2], out strike1))
                        tinfo.BarrierStrike = strike1;
                    if (double.TryParse(desc[len - 1], out strike2))
                        tinfo.LowerBarrierStrike = strike2;
                    if (tinfo.BarrierStrike < tinfo.LowerBarrierStrike)
                    {
                        var temp = tinfo.BarrierStrike;
                        tinfo.BarrierStrike = tinfo.LowerBarrierStrike;
                        tinfo.LowerBarrierStrike = temp;
                    }
                }
                return fxoption;
            }
            if (info.SecurityType.ToLower().Contains("futures") || info.SecurityType.ToLower().Contains("future options"))
            {
                var pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim());
                if (pr != null) return pr;
                if (!info.SecurityType.ToLower().Equals("equity futures"))
                    pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Comdty");
                if (pr != null) return pr;
                if (!info.SecurityType.ToLower().Equals("equity futures"))
                    pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Curncy");
                if (pr != null) return pr;
                pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Index");
                if (pr != null) return pr;
                pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Equity");
                if (pr != null) return pr;
                throw new Exception("Futures " + info.SecurityType + " " + info.Security + " not retrieved");
            }


            if (info.SecurityType.ToLower() == "spot-forward")
            {
                var fx = new FX();
                var splits = info.Security.Substring(0, 7).Split('/');
                string ccy1 = splits[0];
                string ccy2 = splits[1];
                var cp = Env.Current.Trade.GetCurrencyPair(ccy1, ccy2);
                if (cp == null) return null;
                fx.Primary = cp.Primary;
                fx.Quoting = cp.Quoting;
                var settleDate = info.Maturity;
                fx.PrimarySettleDate = settleDate;
                fx.QuotingSettleDate = settleDate;

                /*
                var ccy2Obj = Env.Current.StaticData.GetCurrency(ccy2);
                if (ccy2Obj != null && ccy2Obj.IsNonDeliverable)
                {
                    var ndf = new NDF
                        {
                            Primary = cp.Primary,
                            Quoting = cp.Quoting,
                            PrimarySettleDate = settleDate,
                            QuotingSettleDate = settleDate
                        };
                    return ndf;
                }*/

                return fx;

            }
            throw new Exception("Reconciliation not supported for Product" + info.SecurityType.ToLower());
        }
예제 #5
0
        private void FillOptionInfo(TradeInfo info, FXOption fxo, OptionInfo optionInfo)
        {
            if (info.SecurityType.Equals(FxoInfo.SimpleFXO))
            {
                // european digital and european
                if (info.OptionStyle.Equals("D"))
                {
                    var dinfo = optionInfo as DigitalInfo;
                    if (dinfo == null)
                    {
                        dinfo = new DigitalInfo();
                        fxo.OptionInfo = dinfo;
                        dinfo.Option = fxo;
                    }
                    fxo.ExerciseType = OptionExerciseType.Digital;
                    dinfo.ExerciseType = OptionExerciseType.European;
                    dinfo.StartDate = info.Maturity;
                    dinfo.EndDate = info.Maturity;
                    if (fxo.OptionType == OptionType.Call)
                    {
                        dinfo.BarrierStrike = fxo.OptionStrike;
                        dinfo.BarrierType = OptionBarrierType.Touch;
                        dinfo.LowerBarrierStrike = 0;
                        dinfo.LowerBarrierType = OptionBarrierType.None;
                    }
                    else
                    {
                        dinfo.LowerBarrierStrike = fxo.OptionStrike;
                        dinfo.LowerBarrierType = OptionBarrierType.Touch;
                        dinfo.BarrierStrike = 0;
                        dinfo.BarrierType = OptionBarrierType.None;
                    }
                    // pay off, currency, and payout style: deferred or...
                }
                else
                    fxo.ExerciseType = OptionExerciseType.European;
                    // settle currency
            }
            /*
            else if (info.SecurityType.Equals(TradeInfo.BarrierFXO))
            {
                // barrier
                var binfo = optionInfo as BarrierInfo;
                if (binfo == null)
                {
                    binfo = new BarrierInfo();
                    fxo.OptionInfo = binfo;
                    binfo.Option = fxo;
                }
                binfo.ExerciseType = OptionExerciseType.European;
                // start/end date
                // barrier type and strike

            }
            else if (info.SecurityType.Equals(TradeInfo.TouchFXO))
            {
                // touch
                var tinfo = optionInfo as DigitalInfo;
                if (tinfo == null)
                {
                    tinfo = new DigitalInfo();
                    fxo.OptionInfo = tinfo;
                    tinfo.Option = fxo;
                }
                tinfo.ExerciseType = OptionExerciseType.American;
                // barrier strike and type
                // rebate amount
            }*/
        }
예제 #6
0
        public void PopulateReplacementsList()
        {
            var key   = string.Empty;
            var value = string.Empty;
            var temp  = new List <string>();

            ReplacementsList.Clear();

            key   = "Flightdates";
            value = FlightDates;
            if (!ReplacementsList.Keys.Contains(key))
            {
                ReplacementsList.Add(key, value);
            }
            key   = "Advertiser  -  Decisionmaker";
            value = String.Format("{0}  -  {1}", Advertiser, DecisionMaker);
            if (!ReplacementsList.Keys.Contains(key))
            {
                ReplacementsList.Add(key, value);
            }
            key   = "Flightdates - Advertiser - Decisionmaker";
            value = String.Format("{0} - {1} - {2}", FlightDates, Advertiser, DecisionMaker);
            if (!ReplacementsList.Keys.Contains(key))
            {
                ReplacementsList.Add(key, value);
            }

            if (!String.IsNullOrEmpty(Quarter))
            {
                key   = "Program";
                value = String.Format(ShowProgram ?
                                      "Program  ({0})" :
                                      "Day-Time  ({0})",
                                      Quarter);
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            else if (!ShowProgram)
            {
                key   = "Program";
                value = "Day-Time";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (!ShowLength && SpotsPerSlide < 24)
            {
                key   = "Lgth";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if ((!ShowDay || !ShowProgram) && SpotsPerSlide < 20)
            {
                key   = "Day";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if ((!ShowTime || !ShowProgram) && SpotsPerSlide < 20)
            {
                key   = "Time";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (!ShowRates)
            {
                key   = "Rate";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (!ShowTotalSpots)
            {
                key   = "Total     Spots";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (!ShowCost)
            {
                key   = "Total    Cost";
                value = "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (SpotsPerSlide < 15)
            {
                key   = "Rtg";
                value = ShowRating ? RtgHeaderTitle : "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }
            if (SpotsPerSlide < 14)
            {
                key   = "Total    Points";
                value = ShowGRP ? GRPHeaderTitle : "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
                key   = "CPP";
                value = ShowCPP ? CPPHeaderTitle : "Delete Column";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }

            if (!(ShowSpots || ShowTotalSpots || ShowCPP || ShowGRP || ShowCost))
            {
                key   = "Total";
                value = "Delete Row";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }

            key   = "tspot";
            value = TotalSpot;
            if (!ReplacementsList.Keys.Contains(key))
            {
                ReplacementsList.Add(key, value);
            }
            key   = "tcost";
            value = TotalCost;
            if (!ReplacementsList.Keys.Contains(key))
            {
                ReplacementsList.Add(key, value);
            }
            if (SpotsPerSlide < 14)
            {
                key   = "totalpts";
                value = TotalGRP;
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
                key   = "cppavg";
                value = TotalCPP;
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }

            var totalCount = Totals.Count;

            for (var i = 0; i < 3; i++)
            {
                var firsrtTagIndex = i * 2;
                var secondTagIndex = firsrtTagIndex + 1;
                key = String.Format("[info{0}] [info{1}]", firsrtTagIndex + 1, secondTagIndex + 1);

                var firsrtDataIndex = i * 4;
                var secondDataIndex = firsrtDataIndex + 1;
                var thirdDataIndex  = firsrtDataIndex + 2;
                var forthDataIndex  = firsrtDataIndex + 3;

                temp.Clear();
                if (firsrtDataIndex < totalCount)
                {
                    temp.Add(String.Format("[{0} {1}]", Totals.ElementAt(firsrtDataIndex).Key, Totals.ElementAt(firsrtDataIndex).Value));
                }
                if (secondDataIndex < totalCount)
                {
                    temp.Add(String.Format("[{0} {1}]", Totals.ElementAt(secondDataIndex).Key, Totals.ElementAt(secondDataIndex).Value));
                }
                if (thirdDataIndex < totalCount)
                {
                    temp.Add(String.Format("[{0} {1}]", Totals.ElementAt(thirdDataIndex).Key, Totals.ElementAt(thirdDataIndex).Value));
                }
                if (forthDataIndex < totalCount)
                {
                    temp.Add(String.Format("[{0} {1}]", Totals.ElementAt(forthDataIndex).Key, Totals.ElementAt(forthDataIndex).Value));
                }
                value = temp.Any() ? String.Join("    ", temp) : "Delete Row";
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }

            {
                key = "[info1]   [info2]    [info3]    [info4]    [info5]    [info6]    [info7]    [info8]";
                temp.Clear();
                if (Totals.Any())
                {
                    temp.Add(String.Join("    ", Totals.Select(pair => String.Format("[{0} {1}]", pair.Key, pair.Value))));
                }
                if (!String.IsNullOrEmpty(DigitalInfo.SummaryInfo))
                {
                    temp.Add(DigitalInfo.SummaryInfo);
                }
                value = String.Join(String.Format("{0}", (char)13), temp);
                if (!ReplacementsList.Keys.Contains(key))
                {
                    ReplacementsList.Add(key, value);
                }
            }

            var totalSpotsCount = TotalSpots.Count;

            for (var i = 0; i < SpotsPerSlide; i++)
            {
                key = string.Format("MO {0}", (i + 1).ToString("00"));
                if (i < totalSpotsCount && ShowSpots)
                {
                    if (_parent.UseGenericDateColumns)
                    {
                        value = string.Format("{0}{2}{1}", _parent.SpotType == SpotType.Week ? "wk" : "mo", (i + 1), (char)13);
                    }
                    else if (_parent.SpotType == SpotType.Week)
                    {
                        value = TotalSpots[i].Month + (char)13 + TotalSpots[i].Day;
                    }
                    else if (_parent.SpotType == SpotType.Month)
                    {
                        value = TotalSpots[i].Month;
                    }
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }

                    key   = string.Format("t{0}", i + 1);
                    value = TotalSpots[i].Value;
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }
                }
                else
                {
                    value = "Delete Column";
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }
                }
                Application.DoEvents();
            }

            var progarmsCount = Programs.Count;

            for (var i = 0; i < ProgramsPerSlide; i++)
            {
                key = String.Format("[Station{0}] Program{0}", i + 1);
                if (i < progarmsCount)
                {
                    var program = Programs[i];
                    temp.Clear();
                    if (ShowStation)
                    {
                        temp.Add(ShowStationInBrackets ? String.Format("[{0}]", program.Station) : String.Format("{0} ", program.Station));
                    }
                    temp.Add(ShowProgram ?
                             program.Name :
                             String.Format("{0} {1}", program.Days, program.Time));
                    value = String.Join(" ", temp);
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }

                    key   = String.Format("{0}", (i + 1).ToString("00"));
                    value = program.LineID;
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }

                    if (SpotsPerSlide >= 24)
                    {
                        key = String.Format("len{0}     day{0}     time{0}     rtg{0}     pts{0}     cpp{0}", i + 1);
                        temp.Clear();
                        if (ShowLength)
                        {
                            temp.Add(String.Format("{0}", program.Length));
                        }
                        if (ShowDay && ShowProgram)
                        {
                            temp.Add(String.Format("{0}", program.Days));
                        }
                        if (ShowTime && ShowProgram)
                        {
                            temp.Add(String.Format("{0}", program.Time));
                        }
                        if (ShowRating)
                        {
                            temp.Add(String.Format("{0}: {1}", RtgHeaderTitle.Replace(((char)13).ToString(), " "), program.Rating));
                        }
                        if (ShowGRP)
                        {
                            temp.Add(String.Format("{0}: {1}", GRPHeaderTitle, program.GRP));
                        }
                        if (ShowCPP)
                        {
                            temp.Add(String.Format("{0}: {1}", CPPHeaderTitle, program.CPP));
                        }
                        value = String.Format("   {0}", String.Join("  ", temp));
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                    }
                    if (SpotsPerSlide < 24)
                    {
                        key   = String.Format("len{0}", (i + 1));
                        value = ShowLength ? program.Length : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }

                        if (SpotsPerSlide >= 20)
                        {
                            key = String.Format("day{0}     time{0}     rtg{0}     pts{0}     cpp{0}", i + 1);
                            temp.Clear();
                            if (ShowDay && ShowProgram)
                            {
                                temp.Add(String.Format("{0}", program.Days));
                            }
                            if (ShowTime && ShowProgram)
                            {
                                temp.Add(String.Format("{0}", program.Time));
                            }
                            if (ShowRating)
                            {
                                temp.Add(String.Format("{0}: {1}", RtgHeaderTitle.Replace(((char)13).ToString(), " "), program.Rating));
                            }
                            if (ShowGRP)
                            {
                                temp.Add(String.Format("{0}: {1}", GRPHeaderTitle, program.GRP));
                            }
                            if (ShowCPP)
                            {
                                temp.Add(String.Format("{0}: {1}", CPPHeaderTitle, program.CPP));
                            }
                            value = String.Format("   {0}", String.Join("  ", temp));
                            if (!ReplacementsList.Keys.Contains(key))
                            {
                                ReplacementsList.Add(key, value);
                            }
                        }
                    }
                    if (SpotsPerSlide < 20)
                    {
                        key   = String.Format("day{0}", (i + 1));
                        value = ShowDay && ShowProgram ? program.Days : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                        key   = String.Format("time{0}", (i + 1));
                        value = ShowTime && ShowProgram ? program.Time : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }

                        if (SpotsPerSlide >= 15)
                        {
                            key = String.Format("rtg{0}     pts{0}     cpp{0}", i + 1);
                            temp.Clear();
                            if (ShowRating)
                            {
                                temp.Add(String.Format("{0}: {1}", RtgHeaderTitle.Replace(((char)13).ToString(), " "), program.Rating));
                            }
                            if (ShowGRP)
                            {
                                temp.Add(String.Format("{0}: {1}", GRPHeaderTitle, program.GRP));
                            }
                            if (ShowCPP)
                            {
                                temp.Add(String.Format("{0}: {1}", CPPHeaderTitle, program.CPP));
                            }
                            value = String.Format("   {0}", String.Join("  ", temp));
                            if (!ReplacementsList.Keys.Contains(key))
                            {
                                ReplacementsList.Add(key, value);
                            }
                        }
                    }
                    if (SpotsPerSlide < 15)
                    {
                        key   = String.Format("rtg{0}", (i + 1));
                        value = ShowRating ? program.Rating : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }

                        if (SpotsPerSlide >= 14)
                        {
                            key = String.Format("pts{0}     cpp{0}", i + 1);
                            temp.Clear();
                            if (ShowGRP)
                            {
                                temp.Add(String.Format("{0}: {1}", GRPHeaderTitle, program.GRP));
                            }
                            if (ShowCPP)
                            {
                                temp.Add(String.Format("{0}: {1}", CPPHeaderTitle, program.CPP));
                            }
                            value = String.Format("   {0}", String.Join("  ", temp));
                            if (!ReplacementsList.Keys.Contains(key))
                            {
                                ReplacementsList.Add(key, value);
                            }
                        }
                    }
                    if (SpotsPerSlide < 14)
                    {
                        key   = String.Format("pts{0}", (i + 1));
                        value = ShowGRP ? program.GRP : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                        key   = String.Format("cpp{0}", (i + 1));
                        value = ShowCPP ? program.CPP : String.Empty;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                    }
                    if (ShowRates)
                    {
                        key   = String.Format("rt{0}", (i + 1));
                        value = program.Rate;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                    }
                    if (ShowTotalSpots)
                    {
                        key   = String.Format("sp{0}", (i + 1));
                        value = program.TotalSpots;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                    }
                    if (ShowCost)
                    {
                        key   = String.Format("cs{0}", (i + 1));
                        value = program.TotalRate;
                        if (!ReplacementsList.Keys.Contains(key))
                        {
                            ReplacementsList.Add(key, value);
                        }
                    }
                    if (ShowSpots)
                    {
                        var spotsCount = program.Spots.Count;
                        for (int j = 0; j < SpotsPerSlide; j++)
                        {
                            if (j < spotsCount)
                            {
                                var spotSuffix = "a";
                                switch (j)
                                {
                                case 0:
                                    spotSuffix = "a";
                                    break;

                                case 1:
                                    spotSuffix = "b";
                                    break;

                                case 2:
                                    spotSuffix = "c";
                                    break;

                                case 3:
                                    spotSuffix = "d";
                                    break;

                                case 4:
                                    spotSuffix = "e";
                                    break;

                                case 5:
                                    spotSuffix = "f";
                                    break;

                                case 6:
                                    spotSuffix = "g";
                                    break;

                                case 7:
                                    spotSuffix = "h";
                                    break;

                                case 8:
                                    spotSuffix = "i";
                                    break;

                                case 9:
                                    spotSuffix = "j";
                                    break;

                                case 10:
                                    spotSuffix = "k";
                                    break;

                                case 11:
                                    spotSuffix = "l";
                                    break;

                                case 12:
                                    spotSuffix = "m";
                                    break;

                                case 13:
                                    spotSuffix = "n";
                                    break;

                                case 14:
                                    spotSuffix = "o";
                                    break;

                                case 15:
                                    spotSuffix = "p";
                                    break;

                                case 16:
                                    spotSuffix = "q";
                                    break;

                                case 17:
                                    spotSuffix = "r";
                                    break;

                                case 18:
                                    spotSuffix = "s";
                                    break;

                                case 19:
                                    spotSuffix = "t";
                                    break;

                                case 20:
                                    spotSuffix = "u";
                                    break;

                                case 21:
                                    spotSuffix = "v";
                                    break;

                                case 22:
                                    spotSuffix = "w";
                                    break;

                                case 23:
                                    spotSuffix = "x";
                                    break;

                                case 24:
                                    spotSuffix = "y";
                                    break;

                                case 25:
                                    spotSuffix = "z";
                                    break;
                                }
                                key   = string.Format("{0}{1}", (i + 1), spotSuffix);
                                value = program.Spots[j];
                                if (!ReplacementsList.Keys.Contains(key))
                                {
                                    ReplacementsList.Add(key, value);
                                }
                                Application.DoEvents();
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    Application.DoEvents();
                }
                else
                {
                    value = "Delete Row";
                    if (!ReplacementsList.Keys.Contains(key))
                    {
                        ReplacementsList.Add(key, value);
                    }
                }
            }

            DigitalInfo.PopulateReplacementsList();
            foreach (var digitalInfoReplacementRecord in DigitalInfo.ReplacementsList)
            {
                if (!ReplacementsList.ContainsKey(digitalInfoReplacementRecord.Key))
                {
                    ReplacementsList.Add(digitalInfoReplacementRecord.Key, digitalInfoReplacementRecord.Value);
                }
            }
        }
예제 #7
0
 public void CopyDigitalToOptionsSet(OptionSet targetOptionsSet)
 {
     targetOptionsSet.DigitalInfo = DigitalInfo.Clone <MediaDigitalInfo, MediaDigitalInfo>();
 }
예제 #8
0
 public void CopyDigitalToSnapshot(Snapshot.Snapshot targetSnapshot)
 {
     targetSnapshot.DigitalInfo = DigitalInfo.Clone <MediaDigitalInfo, MediaDigitalInfo>();
 }