Пример #1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["typeId"]))
     {
         int.TryParse(this.Page.Request.QueryString["typeId"], out this.typeId);
     }
     this.btnEditProductType.Click += new System.EventHandler(this.btnEditProductType_Click);
     if (!this.Page.IsPostBack)
     {
         this.chlistBrand.DataBind();
         ProductTypeInfo productType = ProductTypeHelper.GetProductType(this.typeId);
         if (productType == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.txtTypeName.Text = productType.TypeName;
         this.txtRemark.Text   = productType.Remark;
         foreach (System.Web.UI.WebControls.ListItem listItem in this.chlistBrand.Items)
         {
             if (productType.Brands.Contains(int.Parse(listItem.Value)))
             {
                 listItem.Selected = true;
             }
         }
     }
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Page.Request.QueryString["typeId"]))
     {
         int.TryParse(Page.Request.QueryString["typeId"], out typeId);
     }
     btnEditProductType.Click += new EventHandler(btnEditProductType_Click);
     if (!Page.IsPostBack)
     {
         chlistBrand.DataBind();
         ProductTypeInfo productType = ProductTypeHelper.GetProductType(typeId);
         if (productType == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             txtTypeName.Text = productType.TypeName;
             txtRemark.Text   = productType.Remark;
             foreach (ListItem item in chlistBrand.Items)
             {
                 if (productType.Brands.Contains(int.Parse(item.Value)))
                 {
                     item.Selected = true;
                 }
             }
         }
     }
 }
Пример #3
0
        private string GetProductCSVForHishop(string imagePath, System.Collections.Generic.List <ExportToLocal.ProductDetail> list)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string format = "\r\n-1\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"\t\"{6}\"\t\"{7}\"\t\"{8}\"\t\"{9}\"\t\"{10}\"\t\"{11}\"\t\"{12}\"\t\"{13}\"\t\"{14}\"\t\"{15}\"\t\"{16}\"\t\"{17}\"\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t\"{22}\"\t\"{23}\"\t\"{24}\"\t\"{25}\"\t\"{26}\"";

            stringBuilder.Append("\"id\"\t\"所属分类\"\t\"商品类型\"\t\"商品名称\"\t\"商家编码\"\t\"简单描述\"\t\"计量单位\"\t");
            stringBuilder.Append("\"详细描述\"\t\"详细页标题\"\t\"详细页描述\"\t\"详细页搜索关键字\"\t\"销售状态\"\t");
            stringBuilder.Append("\"图片\"\t\"图片2\"\t\"图片3\"\t\"图片4\"\t\"图片5\"\t");
            stringBuilder.Append("\"市场价\"\t\"品牌\"\t\"是否有规格\"\t");
            stringBuilder.Append("\"规格属性\"\t\"货号\"\t\"重量\"\t\"库存\"\t成本价\"\t\"一口价\"\t");
            stringBuilder.Append("\"商品属性\"\t\"商品标签\"");
            foreach (ExportToLocal.ProductDetail current in list)
            {
                string text = "{" + System.Guid.NewGuid().ToString() + "}.htm";
                string path = System.IO.Path.Combine(imagePath, text);
                using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path, false, System.Text.Encoding.GetEncoding("gb2312")))
                {
                    if (!string.IsNullOrEmpty(current.pi.Description))
                    {
                        string description = current.pi.Description;
                        streamWriter.Write(description);
                    }
                }
                string text2;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl1) && !current.pi.ImageUrl1.StartsWith("http://"))
                {
                    text2 = current.pi.ImageUrl1;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text2)))
                    {
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(base.Server.MapPath("~" + text2));
                        text2 = fileInfo.Name.ToLower();
                        fileInfo.CopyTo(System.IO.Path.Combine(imagePath, text2), true);
                    }
                }
                else
                {
                    text2 = "";
                }
                string text3;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl2) && !current.pi.ImageUrl2.StartsWith("http://"))
                {
                    text3 = current.pi.ImageUrl2;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text3)))
                    {
                        System.IO.FileInfo fileInfo2 = new System.IO.FileInfo(base.Server.MapPath("~" + text3));
                        text3 = fileInfo2.Name.ToLower();
                        fileInfo2.CopyTo(System.IO.Path.Combine(imagePath, text3), true);
                    }
                }
                else
                {
                    text3 = "";
                }
                string text4;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl3) && !current.pi.ImageUrl3.StartsWith("http://"))
                {
                    text4 = current.pi.ImageUrl3;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text4)))
                    {
                        System.IO.FileInfo fileInfo3 = new System.IO.FileInfo(base.Server.MapPath("~" + text4));
                        text4 = fileInfo3.Name.ToLower();
                        fileInfo3.CopyTo(System.IO.Path.Combine(imagePath, text4), true);
                    }
                }
                else
                {
                    text4 = "";
                }
                string text5;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl4) && !current.pi.ImageUrl4.StartsWith("http://"))
                {
                    text5 = current.pi.ImageUrl4;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text5)))
                    {
                        System.IO.FileInfo fileInfo4 = new System.IO.FileInfo(base.Server.MapPath("~" + text5));
                        text5 = fileInfo4.Name.ToLower();
                        fileInfo4.CopyTo(System.IO.Path.Combine(imagePath, text5), true);
                    }
                }
                else
                {
                    text5 = "";
                }
                string text6;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl5) && !current.pi.ImageUrl5.StartsWith("http://"))
                {
                    text6 = current.pi.ImageUrl5;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text6)))
                    {
                        System.IO.FileInfo fileInfo5 = new System.IO.FileInfo(base.Server.MapPath("~" + text6));
                        text6 = fileInfo5.Name.ToLower();
                        fileInfo5.CopyTo(System.IO.Path.Combine(imagePath, text6), true);
                    }
                }
                else
                {
                    text6 = "";
                }
                string text7     = "";
                string text8     = "";
                string text9     = "";
                string text10    = "";
                string text11    = "";
                string text12    = "";
                string text13    = "";
                string text14    = "";
                string text15    = "";
                string arg_43B_0 = current.pi.SkuId;
                foreach (SKUItem current2 in current.pi.Skus.Values)
                {
                    text8  = text8 + current2.SKU + ";";
                    text9  = text9 + ((this.ConvertNull(current2.Weight) == "") ? "0" : this.ConvertNull(current2.Weight)) + ";";
                    text10 = text10 + current2.Stock + ";";
                    text11 = text11 + ((this.ConvertNull(current2.CostPrice) == "") ? "0" : this.ConvertNull(current2.CostPrice)) + ";";
                    text12 = text12 + current2.SalePrice + ";";
                }
                if (text11 == "")
                {
                    text11 = "0";
                }
                if (text10 == "")
                {
                    text10 = "0";
                }
                if (!this.chkExportImages.Checked)
                {
                    text3 = (text2 = (text4 = (text5 = (text6 = ""))));
                }
                if (current.pi.TypeId.HasValue)
                {
                    int arg_5C7_0 = current.pi.TypeId.Value;
                    foreach (System.Collections.Generic.KeyValuePair <int, System.Collections.Generic.IList <int> > current3 in current.attrs)
                    {
                        string attributeName = ProductTypeHelper.GetAttribute(current3.Key).AttributeName;
                        foreach (int current4 in current3.Value)
                        {
                            string valueStr = ProductTypeHelper.GetAttributeValueInfo(current4).ValueStr;
                            string text16   = text13;
                            text13 = string.Concat(new string[]
                            {
                                text16,
                                attributeName,
                                ":",
                                valueStr,
                                ","
                            });
                        }
                    }
                    System.Data.DataTable tags = CatalogHelper.GetTags();
                    foreach (int current5 in current.tagIds)
                    {
                        foreach (System.Data.DataRow dataRow in tags.Rows)
                        {
                            if (dataRow["TagId"].Equals(current5))
                            {
                                text14 = text14 + dataRow["TagName"] + ",";
                                break;
                            }
                        }
                    }
                }
                switch (current.pi.SaleStatus)
                {
                case ProductSaleStatus.OnSale:
                    text15 = "出售中";
                    break;

                case ProductSaleStatus.UnSale:
                    text15 = "下架区";
                    break;

                case ProductSaleStatus.OnStock:
                    text15 = "仓库中";
                    break;
                }
                bool hasSKU = current.pi.HasSKU;
                if (hasSKU)
                {
                    foreach (SKUItem current6 in current.pi.Skus.Values)
                    {
                        foreach (System.Collections.Generic.KeyValuePair <int, int> current7 in current6.SkuItems)
                        {
                            string attributeName2 = ProductTypeHelper.GetAttribute(current7.Key).AttributeName;
                            foreach (AttributeValueInfo current8 in ProductTypeHelper.GetAttribute(current7.Key).AttributeValues)
                            {
                                if (current8.ValueId.Equals(current7.Value))
                                {
                                    string valueStr2 = current8.ValueStr;
                                    text7 = text7 + attributeName2 + ":" + valueStr2;
                                    break;
                                }
                            }
                            text7 += ",";
                        }
                        text7 = text7.Trim(new char[]
                        {
                            ','
                        }) + ";";
                    }
                }
                string       obj      = "";
                CategoryInfo category = CatalogHelper.GetCategory(current.pi.CategoryId);
                if (category != null)
                {
                    obj = category.Name;
                }
                string obj2 = "";
                if (current.pi.TypeId.HasValue)
                {
                    obj2 = ProductTypeHelper.GetProductType(current.pi.TypeId.Value).TypeName;
                }
                string obj3 = "";
                if (current.pi.BrandId.HasValue)
                {
                    obj3 = CatalogHelper.GetBrandCategory(current.pi.BrandId.Value).BrandName;
                }
                stringBuilder.AppendFormat(format, new object[]
                {
                    this.ConvertNull(obj),
                    this.ConvertNull(obj2),
                    current.pi.ProductName,
                    this.ConvertNull(current.pi.ProductCode),
                    this.ConvertNull(current.pi.ShortDescription),
                    this.ConvertNull(current.pi.Unit),
                    text,
                    this.ConvertNull(current.pi.Title),
                    this.ConvertNull(current.pi.MetaDescription),
                    this.ConvertNull(current.pi.MetaKeywords),
                    text15,
                    text2,
                    text3,
                    text4,
                    text5,
                    text6,
                    this.ConvertNull(current.pi.MarketPrice),
                    this.ConvertNull(obj3),
                    hasSKU ? "1" : "0",
                    text7.Trim(new char[]
                    {
                        ';'
                    }),
                    text8.Trim(new char[]
                    {
                        ';'
                    }),
                    text9.Trim(new char[]
                    {
                        ';'
                    }),
                    text10.Trim(new char[]
                    {
                        ';'
                    }),
                    text11.Trim(new char[]
                    {
                        ';'
                    }),
                    text12.Trim(new char[]
                    {
                        ';'
                    }),
                    text13.Trim(new char[]
                    {
                        ','
                    }),
                    text14.Trim(new char[]
                    {
                        ','
                    })
                });
            }
            return(stringBuilder.ToString());
        }
Пример #4
0
        private string GetProductCSVForHishop(string imagePath, List <ProductDetail> list, HttpContext context)
        {
            bool          value         = base.GetBoolParam(context, "ExportImages", true).Value;
            StringBuilder stringBuilder = new StringBuilder();
            string        text          = "\r\n-1\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"\t\"{6}\"\t\"{7}\"\t\"{8}\"\t\"{9}\"\t\"{10}\"\t\"{11}\"\t\"{12}\"\t\"{13}\"\t\"{14}\"\t\"{15}\"\t\"{16}\"\t\"{17}\"\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t\"{22}\"\t\"{23}\"\t\"{24}\"\t\"{25}\"\t\"{26}\"\t\"{27}\"\t\"{28}\"\t\"{29}\"\t\"{30}\"\t\"{31}\"\t\"{32}\"\t\"{33}\"";

            stringBuilder.Append("\"id\"\t\"所属分类\"\t\"商品类型\"\t\"商品名称\"\t\"商家编码\"\t\"简单描述\"\t\"计量单位\"\t");
            stringBuilder.Append("\"详细描述\"\t\"详细页标题\"\t\"详细页描述\"\t\"详细页搜索关键字\"\t\"销售状态\"\t");
            stringBuilder.Append("\"图片\"\t\"图片2\"\t\"图片3\"\t\"图片4\"\t\"图片5\"\t");
            stringBuilder.Append("\"市场价\"\t\"品牌\"\t\"是否有规格\"\t");
            stringBuilder.Append("\"规格属性\"\t\"货号\"\t\"重量\"\t\"库存\"\t成本价\"\t\"一口价\"\t");
            stringBuilder.Append("\"商品属性\"\t\"商品标签\"");
            stringBuilder.Append("\t\"商品种类\"");
            stringBuilder.Append("\t\"是否长期有效\"");
            stringBuilder.Append("\t\"有效期开始时间\"");
            stringBuilder.Append("\t\"有效期结束时间\"");
            stringBuilder.Append("\t\"是否支持退款\"");
            stringBuilder.Append("\t\"是否过期退款\"");
            stringBuilder.Append("\t\"是否生成多份\"");
            foreach (ProductDetail item in list)
            {
                string text2 = "{" + Guid.NewGuid().ToString() + "}.htm";
                string path  = Path.Combine(imagePath, text2);
                using (StreamWriter streamWriter = new StreamWriter(path, false, Encoding.GetEncoding("gb2312")))
                {
                    if (!string.IsNullOrEmpty(item.pi.Description))
                    {
                        string description = item.pi.Description;
                        streamWriter.Write(description);
                    }
                }
                string text3;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl1) && !item.pi.ImageUrl1.StartsWith("http://") && !item.pi.ImageUrl1.StartsWith("https://"))
                {
                    text3 = item.pi.ImageUrl1;
                    if (File.Exists(context.Server.MapPath("~" + text3)))
                    {
                        FileInfo fileInfo = new FileInfo(context.Server.MapPath("~" + text3));
                        text3 = fileInfo.Name.ToLower();
                        if (value)
                        {
                            fileInfo.CopyTo(Path.Combine(imagePath, text3), true);
                        }
                    }
                }
                else
                {
                    text3 = "";
                }
                string text4;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl2) && !item.pi.ImageUrl2.StartsWith("http://") && !item.pi.ImageUrl2.StartsWith("https://"))
                {
                    text4 = item.pi.ImageUrl2;
                    if (File.Exists(context.Server.MapPath("~" + text4)))
                    {
                        FileInfo fileInfo2 = new FileInfo(context.Server.MapPath("~" + text4));
                        text4 = fileInfo2.Name.ToLower();
                        if (value)
                        {
                            fileInfo2.CopyTo(Path.Combine(imagePath, text4), true);
                        }
                    }
                }
                else
                {
                    text4 = "";
                }
                string text5;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl3) && !item.pi.ImageUrl3.StartsWith("http://") && !item.pi.ImageUrl3.StartsWith("https://"))
                {
                    text5 = item.pi.ImageUrl3;
                    if (File.Exists(context.Server.MapPath("~" + text5)))
                    {
                        FileInfo fileInfo3 = new FileInfo(context.Server.MapPath("~" + text5));
                        text5 = fileInfo3.Name.ToLower();
                        if (value)
                        {
                            fileInfo3.CopyTo(Path.Combine(imagePath, text5), true);
                        }
                    }
                }
                else
                {
                    text5 = "";
                }
                string text6;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl4) && !item.pi.ImageUrl4.StartsWith("http://") && !item.pi.ImageUrl4.StartsWith("https://"))
                {
                    text6 = item.pi.ImageUrl4;
                    if (File.Exists(context.Server.MapPath("~" + text6)))
                    {
                        FileInfo fileInfo4 = new FileInfo(context.Server.MapPath("~" + text6));
                        text6 = fileInfo4.Name.ToLower();
                        if (value)
                        {
                            fileInfo4.CopyTo(Path.Combine(imagePath, text6), true);
                        }
                    }
                }
                else
                {
                    text6 = "";
                }
                string text7;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl5) && !item.pi.ImageUrl5.StartsWith("http://") && !item.pi.ImageUrl5.StartsWith("https://"))
                {
                    text7 = item.pi.ImageUrl5;
                    if (File.Exists(context.Server.MapPath("~" + text7)))
                    {
                        FileInfo fileInfo5 = new FileInfo(context.Server.MapPath("~" + text7));
                        text7 = fileInfo5.Name.ToLower();
                        if (value)
                        {
                            fileInfo5.CopyTo(Path.Combine(imagePath, text7), true);
                        }
                    }
                }
                else
                {
                    text7 = "";
                }
                string text8  = "";
                string text9  = "";
                string text10 = "";
                string text11 = "";
                string text12 = "";
                string text13 = "";
                string text14 = "";
                string text15 = "";
                string text16 = "";
                string skuId  = item.pi.SkuId;
                foreach (SKUItem value4 in item.pi.Skus.Values)
                {
                    text9  = text9 + value4.SKU + ";";
                    text10 = text10 + ((this.ConvertNull(value4.Weight) == "") ? "0" : this.ConvertNull(value4.Weight)) + ";";
                    text11 = text11 + value4.Stock + ";";
                    text12 = text12 + ((this.ConvertNull(value4.CostPrice) == "") ? "0" : this.ConvertNull(value4.CostPrice)) + ";";
                    text13 = text13 + value4.SalePrice + ";";
                }
                if (text12 == "")
                {
                    text12 = "0";
                }
                if (text11 == "")
                {
                    text11 = "0";
                }
                if (!value)
                {
                    text3 = (text4 = (text5 = (text6 = (text7 = ""))));
                }
                int num;
                if (item.pi.TypeId.HasValue)
                {
                    int value2 = item.pi.TypeId.Value;
                    foreach (KeyValuePair <int, IList <int> > attr in item.attrs)
                    {
                        string attributeName = ProductTypeHelper.GetAttribute(attr.Key).AttributeName;
                        foreach (int item2 in attr.Value)
                        {
                            string valueStr = ProductTypeHelper.GetAttributeValueInfo(item2).ValueStr;
                            text14 = text14 + attributeName + ":" + valueStr + ",";
                        }
                    }
                    IList <TagInfo> tags = CatalogHelper.GetTags();
                    foreach (int tagId in item.tagIds)
                    {
                        foreach (TagInfo item3 in tags)
                        {
                            num = item3.TagID;
                            if (num.Equals(tagId))
                            {
                                text15 = text15 + item3.TagName + ",";
                                break;
                            }
                        }
                    }
                }
                switch (item.pi.SaleStatus)
                {
                case ProductSaleStatus.OnSale:
                    text16 = "出售中";
                    break;

                case ProductSaleStatus.UnSale:
                    text16 = "下架区";
                    break;

                case ProductSaleStatus.OnStock:
                    text16 = "仓库中";
                    break;
                }
                bool hasSKU = item.pi.HasSKU;
                if (hasSKU)
                {
                    foreach (SKUItem value5 in item.pi.Skus.Values)
                    {
                        foreach (KeyValuePair <int, int> skuItem in value5.SkuItems)
                        {
                            AttributeInfo attribute = ProductTypeHelper.GetAttribute(skuItem.Key);
                            if (attribute != null)
                            {
                                string attributeName2 = ProductTypeHelper.GetAttribute(skuItem.Key).AttributeName;
                                foreach (AttributeValueInfo attributeValue in ProductTypeHelper.GetAttribute(skuItem.Key).AttributeValues)
                                {
                                    num = attributeValue.ValueId;
                                    if (num.Equals(skuItem.Value))
                                    {
                                        string valueStr2 = attributeValue.ValueStr;
                                        text8 = text8 + attributeName2 + ":" + valueStr2;
                                        break;
                                    }
                                }
                            }
                            text8 += ",";
                        }
                        text8 = text8.Trim(',') + ";";
                    }
                }
                string       obj      = "";
                CategoryInfo category = CatalogHelper.GetCategory(item.pi.CategoryId);
                if (category != null)
                {
                    obj = category.Name;
                }
                string obj2 = "";
                if (item.pi.TypeId.HasValue)
                {
                    obj2 = ProductTypeHelper.GetProductType(item.pi.TypeId.Value).TypeName;
                }
                string obj3 = "";
                if (item.pi.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(item.pi.BrandId.Value);
                    obj3 = ((brandCategory != null) ? brandCategory.BrandName : string.Empty);
                }
                StringBuilder stringBuilder2 = stringBuilder;
                string        format         = text;
                object[]      obj4           = new object[34]
                {
                    this.ConvertNull(obj),
                    this.ConvertNull(obj2),
                    item.pi.ProductName,
                    this.ConvertNull(item.pi.ProductCode),
                    this.ConvertNull(item.pi.ShortDescription),
                    this.ConvertNull(item.pi.Unit),
                    text2,
                    this.ConvertNull(item.pi.Title),
                    this.ConvertNull(item.pi.Meta_Description),
                    this.ConvertNull(item.pi.Meta_Keywords),
                    text16,
                    text3,
                    text4,
                    text5,
                    text6,
                    text7,
                    this.ConvertNull(item.pi.MarketPrice),
                    this.ConvertNull(obj3),
                    hasSKU ? "1" : "0",
                    text8.Trim(';'),
                    text9.Trim(';'),
                    text10.Trim(';'),
                    text11.Trim(';'),
                    text12.Trim(';'),
                    text13.Trim(';'),
                    text14.Trim(','),
                    text15.Trim(','),
                    (item.pi.ProductType == 0) ? "实物商品" : "服务类商品",
                    item.pi.IsValid ? "1" : "0",
                    null,
                    null,
                    null,
                    null,
                    null
                };
                object   obj5;
                DateTime value3;
                if (!item.pi.ValidStartDate.HasValue)
                {
                    obj5 = "";
                }
                else
                {
                    value3 = item.pi.ValidStartDate.Value;
                    obj5   = value3.ToString("yyyy-MM-dd HH:mm:ss");
                }
                obj4[29] = obj5;
                object obj6;
                if (!item.pi.ValidEndDate.HasValue)
                {
                    obj6 = "";
                }
                else
                {
                    value3 = item.pi.ValidEndDate.Value;
                    obj6   = value3.ToString("yyyy-MM-dd HH:mm:ss");
                }
                obj4[30] = obj6;
                obj4[31] = (item.pi.IsRefund ? "1" : "0");
                obj4[32] = (item.pi.IsOverRefund ? "1" : "0");
                obj4[33] = (item.pi.IsGenerateMore ? "1" : "0");
                stringBuilder2.AppendFormat(format, obj4);
            }
            return(stringBuilder.ToString());
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VanillaEuropeanFxOptionPricer"/> class.  All the cashflows must be signed.
        /// </summary>
        /// <param name="paymentCalendar">The payment calendar</param>
        /// <param name="fxOptionLeg">The fxLeg.</param>
        /// <param name="baseParty">The the base party.</param>
        /// <param name="logger">The logger</param>
        /// <param name="cache">The cache</param>
        /// <param name="nameSpace">The namespace</param>
        /// <param name="fixingCalendar">The fixing calendar</param>
        public VanillaEuropeanFxOptionPricer(ILogger logger, ICoreCache cache,
                                             String nameSpace, IBusinessCalendar fixingCalendar,
                                             IBusinessCalendar paymentCalendar, FxOption fxOptionLeg, string baseParty)
        {
            OrderedPartyNames = new List <string>();
            Multiplier        = 1.0m;
            Id                   = fxOptionLeg.id;
            AnalyticsModel       = new FxOptionLegAnalytic();
            ProductType          = ProductTypeSimpleEnum.FxOption;
            HybridValuation      = true;
            BuyerPartyReference  = fxOptionLeg.buyerPartyReference.href;
            SellerPartyReference = fxOptionLeg.sellerPartyReference.href;
            BasePartyBuyer       = baseParty == BuyerPartyReference;
            FxOptionType         = FxOptionType.Put;
            ProductType          = ProductTypeSimpleEnum.FxOption;
            if (fxOptionLeg.spotRateSpecified)
            {
                SpotRate = fxOptionLeg.spotRate;
            }
            FpMLProductType = ProductTypeHelper.GetProductType(fxOptionLeg.Items, fxOptionLeg.ItemsElementName);
            //Temporary values used to build the fx and option trades.
            PutCurrencyAmount  = fxOptionLeg.putCurrencyAmount.amount;
            PutCurrency        = fxOptionLeg.callCurrencyAmount.currency.Value;
            CallCurrencyAmount = fxOptionLeg.callCurrencyAmount.amount;
            CallCurrency       = fxOptionLeg.putCurrencyAmount.currency.Value;
            FxStrike           = fxOptionLeg.strike.rate;
            StrikeQuoteBasis   = fxOptionLeg.strike.strikeQuoteBasis;
            if (IsCall())
            {
                FxOptionType = FxOptionType.Call;
            }
            SoldAs = fxOptionLeg.soldAs;
            if (fxOptionLeg.tenorPeriod != null)
            {
                QuotedTenor = fxOptionLeg.tenorPeriod.ToString();
            }
            var vanillaOption = fxOptionLeg.Item as FxEuropeanExercise;

            if (vanillaOption != null)
            {
                ExpiryDate = vanillaOption.expiryDate;
                ExpiryTimeBusinessCenter = vanillaOption.expiryTime.businessCenter.Value;
                ExpiryTime = vanillaOption.expiryTime.hourMinuteTime; //TODO Not Implemented yet!
                CutName    = vanillaOption.cutName;
                ValueDate  = vanillaOption.valueDate;
            }
            var type = HasBeenExercised ? ProductTypeSimpleEnum.FxSpot : ProductTypeSimpleEnum.FxForward;
            //Create the fxleg.
            //TODO Currently this does not handle non-deliverable forwards or a third settlement currency.
            var fxLeg = FxOption.CreateFxSingleLeg(HasBeenExercised, BuyerPartyReference, SellerPartyReference, PutCurrencyAmount, PutCurrency, CallCurrencyAmount,
                                                   CallCurrency, StrikeQuoteBasis, ValueDate, FxStrike);

            FxLeg = new FxSingleLegPricer(fxLeg, baseParty, type);
            VolatilitySurfaceName = fxOptionLeg.GetRequiredVolatilitySurfaces()[0];
            //FxOptionType;
            //Get the currency.
            PaymentCurrencies = new List <string>();
            PaymentCurrencies.AddRange(FxLeg.PaymentCurrencies);
            //Add the premia
            Premia = new List <PriceableFxOptionPremium>();
            if (fxOptionLeg.premium != null)
            {
                foreach (var premium in fxOptionLeg.premium)
                {
                    var priceablePayment = PriceableInstrumentsFactory.CreatePriceableFxOptionPremium(cache, nameSpace, null, baseParty, premium, fixingCalendar, paymentCalendar);
                    Premia.Add(priceablePayment);
                    PaymentCurrencies.AddRange(priceablePayment.PaymentCurrencies);
                }
            }
            PaymentCurrencies = PaymentCurrencies.Distinct().ToList();
            if (fxOptionLeg.cashSettlement != null)
            {
                IsCashSettled          = true;
                CashSettlementCurrency = fxOptionLeg.cashSettlement.settlementCurrency;
                //Only a single fixing date is currency implemented.
                if (fxOptionLeg.cashSettlement.fixing != null && fxOptionLeg.cashSettlement.fixing[0].fixingDateSpecified)
                {
                    FixingDate = fxOptionLeg.cashSettlement.fixing[0].fixingDate;
                    FixingQuotedCurrencyPair = fxOptionLeg.cashSettlement.fixing[0].quotedCurrencyPair;
                }
            }
            if (vanillaOption != null)
            {
                RiskMaturityDate = vanillaOption.valueDate;
            }
            logger.LogInfo("FxOption trade created :");
        }