Skip to content

Instantly share code, notes, and snippets.

@stdray
Created February 25, 2015 00:32
Show Gist options
  • Select an option

  • Save stdray/3e36a0723cbe8014bebb to your computer and use it in GitHub Desktop.

Select an option

Save stdray/3e36a0723cbe8014bebb to your computer and use it in GitHub Desktop.
[Mapping]
public PlanGraphPosition(src : ZakupkiV1.zfcs_tenderPlanType, pos : ZakupkiV1.zfcs_tenderPlanPositionType) : PlanGraphPositionType
{
entity() <-
{
Conditions <-
{
Advance = pos.purchaseConditions.advance;
ContractFinanceCondition <-
{
Amount = decimal'(pos.purchaseConditions.contractFinCondition?.amount);
Procedure = pos.purchaseConditions.contractFinCondition?.procedure;
}
Graph <-
{
def graph = pos.purchaseConditions.purchaseGraph;
ContractExecutionDate = date(graph.contractExecutionTerm);
ContractExecutionStages = graph.contractExecutionStages;
Periodicity = graph.periodicity;
TenderPlacingDate = date(graph.purchasePlacingTerm);
}
Preferences =
from pref in pos.purchaseConditions.preferensesRequirement?.preferenses
select entity() <-
{
Preference <-
{
Code = str(pref.code);
Name = pref.name
}
Value = decimal'(pref.prefValue);
}
Prohibitions = pos.purchaseConditions.prohibitions;
Requirements =
from req in pos.purchaseConditions.preferensesRequirement?.requirements
select entity() <-
{
Content = req.content;
Requirement <-
{
Code = str(req.code);
Name = req.name;
}
}
TenderFinanceCondition <-
{
Amount = decimal'(pos.purchaseConditions.purchaseFinCondition?.amount);
Procedure = pos.purchaseConditions.purchaseFinCondition?.procedure;
}
}
IdentityInfo <-
{
PlanGraphIdentity = src.commonInfo.planNumber;
PlanGraphPositionIdentity = pos.commonInfo.positionNumber;
}
MainInfo <-
{
Currency = pos.commonInfo.contractCurrency.code;
Name = pos.commonInfo.contractSubjectName;
PlacingWay <-
{
Code = pos.commonInfo.placingWay.code;
Name = pos.commonInfo.placingWay.name;
}
StartPrice = decimal'(pos.commonInfo.contractMaxPrice);
}
OptionalInfo <-
{
def item = pos.commonInfo.ItemChoice;
KBKs = choice(item)
{
when(item.amountKBKs(info))
from kbk in info.KBK select kbk.code;
when(item.amountKBKsYears(info))
from kbk in info.KBK select kbk.code;
}
def item1 = pos.commonInfo.Item1Choice;
KOSGUs = choice(item1)
{
when(item1.amountKOSGUs(info))
from kosgu in info.KOSGU select kosgu.code;
when(item1.amountKOSGUsYears(info))
from kosgu in info.KOSGU select kosgu.code;
}
OKVEDs = from okved in pos.commonInfo.OKVEDs select okved.code;
Payments = decimal'(pos.commonInfo.payments);
PublicDiscussionRequired = nullable(pos.commonInfo.noPublicDiscussion);
}
Products =
from product in pos.products
select entity() <-
{
LocalIdentity = str(Guid.NewGuid());
AmountUnit = product.OKEI?.code;
Classifiers = collection
entity() <-
{
Code = product.OKPD?.code;
Name = product.OKPD?.name;
}
CurrentYearQuantity = decimal'(product.quantityCurrentYear);
InternationalName = product.internationalName;
MinRequirements = product.minRequirement;
Name = product.name;
SumPrice = decimal'(product.sumMax);
TotalQuantity = decimal'(product.quantity);
UnitPrice = decimal'(product.price);
}
PublishInfo <-
{
Date = date(pos.commonInfo.positionPublishDate);
ModificationInfo = pos.commonInfo.positionModification?.changeReason?.name;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment