Created
January 12, 2015 14:58
-
-
Save stdray/784e2507a62f02669d69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Nemerle; | |
using Nemerle.Collections; | |
using Nemerle.Text; | |
using Nemerle.Utility; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using NBox.Data; | |
[assembly: Schemas( | |
@"C:\prj\Marketing Portal\ETL\Adapters integration\Schemes\Entities\PlanGraph.xsd", | |
@"C:\prj\Marketing Portal\ETL\Adapters integration\Schemes\Entities\PlanGraphPosition.xsd", | |
@"C:\Users\karpov\SkyDrive\Work\plan_zakupok\exportSchemes\fcsExport.xsd" | |
)] | |
namespace NBox.Data.XsdProvider.Tests | |
{ | |
using Spark.Marketing.Ru.XMLSchema.Plans; | |
using Spark.Marketing.Ru.XMLSchema.SharedCore; | |
using Spark.Marketing.Ru.XMLSchema.SharedSystem; | |
using ZakupkiV1 = Zakupki.Gov.Ru.Oos.Types.V1; | |
module Common | |
{ | |
public date(dateTime : DateTime) : DateType | |
{ | |
def offset = DateTimeOffset(dateTime); | |
DateType() set | |
{ | |
Date = offset.ToString("yyyy-MM-dd HH:mm:ss"); | |
TimeZone = offset.ToString("zzz") | |
} | |
} | |
public str[T](obj : T) : string | |
{ | |
obj.ToString(); | |
} | |
} | |
//открываем хелперы | |
using Common; | |
using NBox.Data.Combinators; | |
class Mapper | |
{ | |
static Map(src : ZakupkiV1.zfcs_tenderPlanType) : PlanGraphType | |
{ | |
entity() <- | |
{ | |
PublishInfo <- | |
{ | |
Date = date(src.commonInfo.publishDate); | |
ModificationInfo = src.printForm.url; | |
Version = str(src.commonInfo.versionNumber); | |
} | |
MainInfo <- | |
{ | |
Description = src.commonInfo.description; | |
DatesInfo <- | |
{ | |
ConfirmDate = date(src.commonInfo.confirmDate); | |
CreationDate = date(src.commonInfo.createDate); | |
} | |
Year = str(src.commonInfo.year); | |
Description = src.commonInfo.description; | |
} | |
IdentityInfo <- | |
{ | |
PlanGraphIdentity = src.commonInfo.planNumber; | |
} | |
Customer <- | |
{ | |
Person <- | |
{ | |
GeneralInfo <- | |
{ | |
INN = src.customerInfo.customer.INN; | |
KPP = src.customerInfo.customer.KPP; | |
PhysicalAddress = src.customerInfo.customer.factAddress; | |
PostalAddress = src.customerInfo.customer.postAddress; | |
RussianFullName = src.customerInfo.customer.fullName; | |
RussianShortName = src.customerInfo.customer.shortName; | |
} | |
} | |
PersonContacts = array | |
[ | |
entity() <- | |
{ | |
ContactInfo <- | |
{ | |
ContactFio = src.responsibleContactInfo.lastName | |
+ " " + src.responsibleContactInfo.firstName | |
+ " " + src.responsibleContactInfo.middleName; | |
Email = src.responsibleContactInfo.email; | |
Fax = array[ src.responsibleContactInfo.fax ]; | |
Phone = array [ src.responsibleContactInfo.phone ]; | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment