本文整理汇总了C#中Party.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Party.SetProperty方法的具体用法?C# Party.SetProperty怎么用?C# Party.SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Party
的用法示例。
在下文中一共展示了Party.SetProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBook
public static void CreateBook(string parent, string bookName, string strategy, string portfolio)
{
try
{
var exist = Env.Current.StaticData.GetPartyByCode(bookName);
if (exist != null)
{
throw new Exception(String.Format("Book {0} already exists!", bookName));
}
else
{
var entity = Env.Current.StaticData.GetPartyByCode(parent);
if (entity == null)
{
throw new Exception("Cannot find entity" + entity);
}
var newStrategy = new Party { Code = bookName, Name = bookName, ParentId = entity.Id, Role = Party.Book, Description = "Legacy strategy" };
newStrategy.SetProperty("Portfolio", portfolio);
newStrategy.SetProperty("Strategy", strategy);
Env.Current.StaticData.SaveParty(newStrategy);
ScriptBase.Logger.InfoFormat("Created book {0} in pfolio {1}.", bookName, portfolio);
}
}
catch (Exception ex)
{
ScriptBase.Logger.Error(ex);
}
}
示例2: SetBookPortfolio
internal static void SetBookPortfolio(Party book, string portfolio)
{
if (book.GetProperty(BookProp2) != null || portfolio == null) return;
var temp = Env.Current.StaticData.GetDomain(BookPortfolio);
var portfolios = temp != null ? temp.Values : null;
book.SetProperty(BookProp2, portfolio);
if (portfolios == null || !portfolios.Contains(portfolio))
Logger.Warn("Trade Import book portfolio " + portfolio +" not recgonized");
book.Action = UpdateAction;
Env.Current.StaticData.SaveAndLoadParty(book);
}
示例3: LoadParty
internal static Party LoadParty(PartyInfo info, StringBuilder sb)
{
var party = Env.Current.StaticData.GetPartyByCode(info.Code) ??
Env.Current.StaticData.GetPartyByProperty(Party.CounterParty, PartyMlpCode, info.Code);
if (party == null)
{
party = new Party
{
Code = info.Code,
RoleList = info.RoleList,
Name = info.Name
};
party.SetProperty(PartyCode2, info.Code2);
party.SetProperty(PartyLabel, info.Label);
party.SetProperty(PartyDisplay, info.Display);
party.SetProperty(PartyMlpCode, info.Code);
return party;
}
{
var display = party.GetProperty(PartyDisplay);
var code2 = party.GetProperty(PartyCode2);
var label = party.GetProperty(PartyLabel);
var mlpCode = party.GetProperty(PartyMlpCode);
var name = party.Name;
var changed = false;
if (info.Code != null && (mlpCode == null || !mlpCode.Equals(info.Code)))
{
party.SetProperty(PartyMlpCode, info.Code);
changed = true;
}
if (info.Name != null && (name == null || !name.Equals(info.Name)))
{
party.Name = info.Name;
changed = true;
}
if (info.Display != null && (display == null || !display.Equals(info.Display)))
{
party.SetProperty(PartyDisplay, info.Display);
changed = true;
}
if (info.Code2 != null && (code2 == null || !code2.Equals(info.Code2)))
{
party.SetProperty(PartyCode2, info.Code2);
changed = true;
}
if (info.Label != null && (label == null || !label.Equals(info.Label)))
{
party.SetProperty(PartyLabel, info.Label);
changed = true;
}
foreach (var r in info.RoleList)
{
if (!party.RoleList.Contains(r))
{
party.RoleList = info.RoleList;
changed = true;
break;
}
}
if (changed)
{
party.Action = UpdateAction;
return party;
}
}
return null;
}
示例4: SetBookProperties
private void SetBookProperties(Party book)
{
foreach (var p in BookProperties)
{
book.SetProperty(p.Name, p.Value);
}
}