public void ToRegistreingType1_NoErrors(decimal pnr) { using (var dataContext = new DPRDataContext(ConnectionString)) { var pInfo = PersonInfo.GetPersonInfo(dataContext, pnr); pInfo.ToRelationListeType(GetUuid, dataContext); } }
public override void ProcessPerson(string pnr) { using (var dataContext = new DPRDataContext(OtherConnectionString)) { { var db = PersonInfo.GetPersonInfo(dataContext, decimal.Parse(pnr)); var ret = db.ToRegisteringType1(cpr2uuidFunc, dataContext); } } }
public void GetPersonInfo_Normal_EqualsPersonInfoExpression(decimal pnr) { LogText("sarted"); using (var dataContext = new DPRDataContext(OtherConnectionString)) { // UUID mapping var map = new Dictionary <string, Guid>(); Func <string, Guid> func = (string cpr) => { if (!map.ContainsKey(cpr)) { map[cpr] = Guid.NewGuid(); } return(map[cpr]); }; var simplifiedPersonInfo = PersonInfo.GetPersonInfo(dataContext, pnr); LogText("GetPersonInfo()"); Assert.NotNull(simplifiedPersonInfo, "simplifiedPersonInfo"); LogText("Assert"); var simplifiedPersonRegistration = simplifiedPersonInfo.ToRegisteringType1(func, dataContext); LogText("Converted"); Assert.NotNull(simplifiedPersonRegistration, "simplifiedPersonRegistration"); LogText("Assert"); var simplifiedXml = CprBroker.Utilities.Strings.SerializeObject(simplifiedPersonRegistration); LogText("Serialization"); WriteObject(pnr.ToDecimalString(), simplifiedXml); LogText("WriteToFile"); var expressionPersonInfo = PersonInfo.PersonInfoExpression.Compile()(dataContext).Where(pi => pi.PersonTotal.PNR == pnr).FirstOrDefault(); LogText("Expression retrieval"); if (expressionPersonInfo != null) { var expressionPersonRegistration = expressionPersonInfo.ToRegisteringType1(func, dataContext); LogText("Conversion"); Assert.NotNull(expressionPersonRegistration, "expressionPersonRegistration"); LogText("Assert"); var expressionXml = CprBroker.Utilities.Strings.SerializeObject(expressionPersonRegistration); LogText("Serialization"); WriteObject(pnr.ToDecimalString() + "-expr", expressionXml); LogText("WriteToFile"); Assert.AreEqual(expressionXml, simplifiedXml); LogText("Assert"); } } LogText("Done"); }
public override void ProcessPerson(string pnr) { var decimalPnr = decimal.Parse(pnr); using (DPRDataContext dataContext = new DPRDataContext(OtherConnectionString)) { var expressionPersonInfo = PersonInfo.GetPersonInfo(dataContext, decimalPnr); // UUID mapping var map = new Dictionary <string, Guid>(); Func <string, Guid> func = (string cpr) => { if (!map.ContainsKey(cpr)) { map[cpr] = Guid.NewGuid(); } return(map[cpr]); }; var xmlObj = expressionPersonInfo.ToRegisteringType1(func, dataContext); WriteObject(pnr, xmlObj); } }
public override void ProcessPerson(string pnr) { DateTime startTime = DateTime.Now; decimal decimalPnr = decimal.Parse(pnr); using (DPRDataContext dataContext = new DPRDataContext(OtherConnectionString)) { PersonInfo personInfo = null; if (UseSimple) { Log("Simple"); personInfo = PersonInfo.GetPersonInfo(dataContext, decimalPnr); SimpleTime += DateTime.Now - startTime; } else { Log("Expression"); personInfo = PersonInfo.PersonInfoExpression.Compile()(dataContext).Where(pi => pi.PersonTotal.PNR == decimalPnr).FirstOrDefault(); ExpressionTime += DateTime.Now - startTime; } } UseSimple = !UseSimple; }
public void PersonInfoExpressionEqualsGetPersonInfo( [ValueSource("AllCprNumbers")] decimal cprNumber) { var prov = new DprDatabaseDataProviderStub(); var dataContext = new DPRDataContext(ConnectionString()); DateTime effectDate = DateTime.Today; var expressionDb = ( from personInfo in PersonInfo.PersonInfoExpression.Compile()(dataContext) where personInfo.PersonTotal.PNR == cprNumber select personInfo ).First(); var expressionObj = expressionDb.ToRegisteringType1(UuidMap.CprStringToUuid, dataContext); var expressionXml = CprBroker.Utilities.Strings.SerializeObject(expressionObj); var methodDb = PersonInfo.GetPersonInfo(dataContext, cprNumber); var methodObj = methodDb.ToRegisteringType1(UuidMap.CprStringToUuid, dataContext); var methodXml = CprBroker.Utilities.Strings.SerializeObject(methodObj); Assert.AreEqual(expressionXml, methodXml); }
public override void ProcessPerson(string pnr) { BrokerContext.Current = brokerContext; try { CprBroker.Engine.Local.Admin.LogFormattedSuccess("Converting person <{0}> from DPR", pnr); using (var dprDataContext = new DPRDataContext(OtherConnectionString)) { var pId = new PersonIdentifier() { CprNumber = pnr, UUID = UuidCache.GetUuid(pnr) }; var personInfo = PersonInfo.GetPersonInfo(dprDataContext, decimal.Parse(pnr)); var reg = personInfo.ToRegisteringType1(UuidCache.GetUuid, dprDataContext); UpdateDatabase.UpdatePersonRegistration(pId, reg); } } catch (Exception ex) { Admin.LogException(ex); throw ex; } }