public void GetJsonTypeDescriptionTests() { var obj1 = int.MaxValue; Debug.WriteLine($"obj1 - {obj1.GetJsonTypeDescription()}"); var obj2 = new DateTime(2015, 12, 31); Debug.WriteLine($"obj2 - {obj2.GetJsonTypeDescription()}"); var obj3 = new ReferenceDataItem { Code = "A", Description = "This is a description" }; Debug.WriteLine($"obj3 - {obj3.GetJsonTypeDescription()}"); var obj4 = new List <ReferenceDataItem> { new ReferenceDataItem { Code = "A", Description = "This is a description 1" }, new ReferenceDataItem { Code = "B", Description = "This is a description 2" } }; Debug.WriteLine($"obj4 - {obj4.GetJsonTypeDescription()}"); }
public void GetJsonTypeDescriptionTests() { var obj1 = int.MaxValue; Debug.WriteLine("obj1 - " + obj1.GetJsonTypeDescription()); var obj2 = new DateTime(2000, 12, 31); Debug.WriteLine("obj2 - " + obj2.GetJsonTypeDescription()); var obj3 = new ReferenceDataItem { Code = "xyz", Description = "123" }; Debug.WriteLine("obj3 - " + obj3.GetJsonTypeDescription()); IEnumerable <IReferenceDataSource> obj4 = new List <IReferenceDataSource> { new SqlReferenceDataSource(), //new XmlReferenceDataSource() }; Debug.WriteLine("obj4 - " + obj4.GetJsonTypeDescription()); }
public static DeploymentEnvironment ToEnvironment(this ReferenceDataItem environment) { return(new DeploymentEnvironment { EnvironmentId = environment.Id, Name = environment.Name, }); }
public static Project ToProject(this ReferenceDataItem project) { return(new Project { ProjectId = project.Id, Name = project.Name, }); }
protected CheckedReferences <ProjectGroupResource> CheckProjectGroup(ReferenceDataItem projectGroup) { Log.Debug("Checking that the Project Group exist"); var dependencies = new CheckedReferences <ProjectGroupResource>(); var group = Repository.ProjectGroups.FindByName(projectGroup.Name); dependencies.Register(projectGroup.Name, projectGroup.Id, group); return(dependencies); }
string CheckProjectGroup(ReferenceDataItem projectGroup) { Log.Debug("Checking that the Project Group exist"); var group = Repository.ProjectGroups.FindByName(projectGroup.Name); if (group == null) { throw new CommandException("Project Group " + projectGroup.Name + " does not exist"); } return(group.Id); }
internal IDictionary <String, String> AllAirportsList() { ReferenceDataRetrieveReq retrieveReq = new ReferenceDataRetrieveReq(); ReferenceDataRetrieveRsp retrieveRsp; IDictionary <String, String> airportsList = new Dictionary <String, String>(); retrieveReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; retrieveReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); retrieveReq.TypeCode = "CityAirport"; retrieveReq.ReferenceDataSearchModifiers = new ReferenceDataSearchModifiers() { MaxResults = "20000", StartFromResult = "0", ProviderCode = "1G" }; ReferenceDataRetrievePortTypeClient client = new ReferenceDataRetrievePortTypeClient("ReferenceDataRetrievePort", WsdlService.UTIL_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); retrieveRsp = client.service(retrieveReq); if (retrieveRsp != null) { IEnumerator dataItems = retrieveRsp.ReferenceDataItem.GetEnumerator(); int count = 0; while (dataItems.MoveNext() && count < 50)//We have added 50 Airports in the List, You can add all if you want, Just remove the count { ReferenceDataItem item = (ReferenceDataItem)dataItems.Current; airportsList.Add(item.Code, item.Name); count++; } } return(airportsList); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
public void GetJsonTypeDescription_ReferenceDataItem() { //-- Arrange ReferenceDataItem obj = new ReferenceDataItem { Code = "abc", Description = "Alpha Bravo Charlie" }; //-- Act Debug.WriteLine("obj - " + obj.GetJsonTypeDescription()); //-- Assert }
public void ToJsonStringTest_ReferenceDataItem() { //-- Arrange ReferenceDataItem obj = new ReferenceDataItem { Code = "abc", Description = "Alpha Bravo Charlie" }; //-- Act Debug.WriteLine("obj - " + obj.ToJsonString()); //-- Assert }
private static void CreateReferenceDataItem(string value) { using var uow = new NHUnitOfWork(); uow.OpenSession(_currentReadTenantIds); uow.BeginTransaction(); Console.WriteLine($"Creating ReferenceDataItem with Value: {value} using Tenant ID: {_currentWriteTenantId}"); var referenceDataItem = new ReferenceDataItem { Value = value }; uow.Session.SaveOrUpdate(referenceDataItem); uow.Commit(); }
public IActionResult Post([FromBody] ReferenceDataItem entity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } using (var _repository = _unitOfWork.GetRepository <EntityModel.ReferenceDataItem>()) { _repository.Insert( new ReferenceDataItem { ID = entity.ID, Path = entity.Path, Key = entity.Key, Value = entity.Value }); } _unitOfWork.SaveChanges(); return(Created(entity)); }
public void ToJsonStringTests() { var obj = int.MaxValue; Debug.WriteLine("obj1 - " + obj.ToJsonString()); var obj2 = new DateTime(2000, 12, 31); Debug.WriteLine("obj2 - " + obj2.ToJsonString()); var obj3 = new ReferenceDataItem { Code = "xyz", Description = "123" }; Debug.WriteLine("obj3 - " + obj3.ToJsonString()); IEnumerable <IReferenceDataSource> obj4 = new List <IReferenceDataSource> { new SqlReferenceDataSource() }; Debug.WriteLine("obj4 - " + obj4.ToJsonString()); }
protected async Task <LifecycleResource> CheckProjectLifecycle(ReferenceDataItem lifecycle) { var existingLifecycles = await Repository.Lifecycles.FindAll().ConfigureAwait(false); if (existingLifecycles.Count == 0) { return(null); } LifecycleResource existingLifecycle = null; if (lifecycle != null) { Log.Debug("Checking that lifecycle {Lifecycle:l} exists", lifecycle.Name); existingLifecycle = existingLifecycles.Find(lc => lc.Name == lifecycle.Name); if (existingLifecycle == null) { Log.Debug("Lifecycle {Lifecycle:l} does not exist, default lifecycle will be used instead", lifecycle.Name); } } return(existingLifecycle ?? existingLifecycles.FirstOrDefault()); }
LifecycleResource CheckProjectLifecycle(ReferenceDataItem lifecycle) { var existingLifecycles = Repository.Lifecycles.FindAll(); if (existingLifecycles.Count == 0) { return(null); } LifecycleResource existingLifecycle = null; if (lifecycle != null) { Log.DebugFormat("Checking that lifecycle {0} exists", lifecycle.Name); existingLifecycle = existingLifecycles.Find(lc => lc.Name == lifecycle.Name); if (existingLifecycle == null) { Log.DebugFormat("Lifecycle {0} does not exist, default lifecycle will be used instead", lifecycle.Name); } } return(existingLifecycle ?? existingLifecycles.FirstOrDefault()); }
public bool Equals(ReferenceDataItem other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Code, Code) && Equals(other.Description, Description); }