コード例 #1
0
 public void Save(HubViewModel hubViewModel)
 {
     Hub hub = new Hub(hubViewModel.Id);
     hub.Name = hubViewModel.Name;
     hub.CostCentreCode = hubViewModel.CostCentreCode;
     hub.Region = _regionRepository.GetById(hubViewModel.RegionId);
     hub.VatRegistrationNo = hubViewModel.VatRegistrationNo;
     hub.Longitude = hubViewModel.Longitude;
     hub.Region = _regionRepository.GetById(hubViewModel.RegionId);
     hub.Latitude = hubViewModel.Latitude;
     hub._Status = EntityStatus.Active;
     hub.ParentCostCentre = new CostCentreRef {Id = hubViewModel.ParentCostCentreId};
     hub.CostCentreType = CostCentreType.Hub;
     _hubRepository.Save(hub);
 }
コード例 #2
0
 private HubViewModel Map(Hub hub)
 {
     HubViewModel hubVM = new HubViewModel();
     hubVM.Id = hub.Id;
     hubVM.CostCentreCode = hub.CostCentreCode;
     hubVM.RegionId = hub.Region.Id;
     hubVM.RegionName = hub.Region.Name;
     hubVM.Name = hub.Name;
     hubVM.VatRegistrationNo = hub.VatRegistrationNo;
     hubVM.Longitude = hub.Longitude;
     hubVM.Latitude = hub.Latitude;
     hubVM.ParentCostCentreId = hub.ParentCostCentre.Id;
     hubVM.IsActive = (int) hub._Status;
     hubVM.CanEditHubRegion = _masterDataUsage.CanEditHubOrDistributrRegion(hub);
     return hubVM;
 }
コード例 #3
0
 public HubDTO Map(Hub hub)
 {
     if (hub == null) return null;
     var hubDto = Mapper.Map<Hub, HubDTO>(hub);
     return hubDto;
 }
コード例 #4
0
ファイル: MasterDataUsage.cs プロジェクト: asanyaga/BuildTest
 public bool CheckHubIsUsed(Hub hub, EntityStatus intendedStatus)
 {
     if (intendedStatus == EntityStatus.Inactive)
     {
         if (_ctx.tblCostCentre.Any(n => n.ParentCostCentreId == hub.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
     }
     else if (intendedStatus == EntityStatus.Deleted)
     {
         if (_ctx.tblCostCentre.Any(n => n.ParentCostCentreId == hub.Id &&
             (n.IM_Status == (int)EntityStatus.Active || n.IM_Status == (int)EntityStatus.Inactive)))
             return true;
     }
     return false;
 }
コード例 #5
0
 protected Guid AddHub(string code, string name, Guid regionId, string varNo, CostCentreRef parentCC)
 {
     Hub hub = new Hub(Guid.NewGuid())
                   {
                       CostCentreCode = code,
                       CostCentreType = CostCentreType.Hub,
                       Name = name,
                       Region = _regionRepository.GetById(regionId),
                       VatRegistrationNo = varNo,
                       _Status = EntityStatus.Active,
                       ParentCostCentre = parentCC
                   };
     return _costCentreRepository.Save(hub);
 }
コード例 #6
0
 private void AssertCostCernter(Hub hubX, Hub hubY)
 {
     Assert.NotNull(hubX.Id);
     Assert.AreEqual(hubX.CostCentreType, hubY.CostCentreType);
     Assert.AreEqual(hubX.Name, hubY.Name);
 }