StoreViewModel Map(Store store) { StoreViewModel storeViewModel = new StoreViewModel(); storeViewModel.Id = store.Id; storeViewModel.Code = store.CostCentreCode; storeViewModel.Name = store.Name; storeViewModel.VatRegistrationNo = store.VatRegistrationNo; storeViewModel.Longitude = store.Longitude; storeViewModel.Latitude = store.Latitude; storeViewModel.ParentCostCentreId = store.ParentCostCentre.Id; storeViewModel.ParentCostCentreName = _hubRepository.GetById(store.ParentCostCentre.Id).Name; storeViewModel.IsActive = (int)store._Status; return storeViewModel; }
private void SelectWarehouse() { using (var container = NestedContainer) { var selected = Using<IAgriItemsLookUp>(container).SelectWarehouse(); SelectedWarehouse = selected; if (selected == null) { SelectedWarehouse = new Store(Guid.Empty) { Name = "--Select Warehouse---" }; } } }
public void Save(StoreViewModel storeViewModel) { Guid Id = Guid.NewGuid(); if(storeViewModel.Id != null) { Id = storeViewModel.Id; } Store store = new Store(Id); store.Name = storeViewModel.Name; store.CostCentreCode = storeViewModel.Code; store.VatRegistrationNo = storeViewModel.VatRegistrationNo; store.Longitude = storeViewModel.Longitude; store.Latitude = storeViewModel.Latitude; store._Status = EntityStatus.Active; store.ParentCostCentre = new CostCentreRef { Id = storeViewModel.ParentCostCentreId };// _producerRepository.GetById(); store.CostCentreType = CostCentreType.Store; _storeRepository.Save(store); }
private void Load() { SelectedWarehouse = new Store(Guid.Empty) { Name = "--Select Warehouse---" }; LineItem.Clear(); using (var c = NestedContainer) { var Items = Using<ISourcingInventoryRepository>(c).GetAll(); foreach (SourcingInventory item in Items) { LineItem.Add(new InventoryLevelLineItemViewModel { Balance=item.Balance, Commodity=item.Commodity, CommodityGrade=item.Grade, Warehouse=item.Warehouse } ); } } }
private void StoreChanged() { using (var container = NestedContainer) { var selected = Using<IAgriItemsLookUp>(container).SelectStore(); SelectedStore = selected; if (selected == null) { SelectedStore = new Store(Guid.Empty) { Name = "--Select Store---" }; SelectedStoreName = "--Select Store---"; } else { SelectedStoreName = SelectedStore.Name; } } }
public StoreDTO Map(Store store) { if (store == null) return null; var storeDto = Mapper.Map<Store, StoreDTO>(store); return storeDto; }
public async Task<ResponseBool> StoreAddAsync(Store store) { ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" }; string url = string.Format("api/distributorservices/storeadd"); var httpClient = setupHttpClient(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { var response = await httpClient.PostAsJsonAsync(url, store); _response = await response.Content.ReadAsAsync<ResponseBool>(); } catch (Exception ex) { _log.Error("Failed to update store.\nCause:", ex); } return _response; }
private void StoreChanged() { using (var container = NestedContainer) { var selected = Using<IAgriItemsLookUp>(container).SelectStore(); SelectedStore = selected; if (selected == null) { SelectedStore = new Store(Guid.Empty) { Name = "--Select Store---" }; SelectedStoreName = "--Select Store---"; var query = new QueryCommoditySupplierInventory(); if (SelectedCommoditySupplier.Id != Guid.Empty) { query.CommoditySupplierId = SelectedCommoditySupplier.Id; } QueryCommoditySupplierInventoryLevel = query; IsSet = true; LoadCommoditySupplierInventoryList(IsSet); } else { SelectedStoreName = SelectedStore.Name; var query = new QueryCommoditySupplierInventory(); query.StoreId = selected.Id; if (SelectedCommoditySupplier.Id != Guid.Empty) { query.CommoditySupplierId = SelectedCommoditySupplier.Id; } QueryCommoditySupplierInventoryLevel = query; IsSet = true; LoadCommoditySupplierInventoryList(IsSet); } } }
private void ClearFilters() { IsSet = false; LoadCommoditySupplierInventoryList(IsSet); SelectedCommoditySupplier = new CommoditySupplier(Guid.Empty) { Name = "--Select Commodity Supplier---" }; SelectedCommoditySupplierName = "--Select Commdity Supplier---"; SelectedStore = new Store(Guid.Empty) { Name = "--Select Store---" }; SelectedStoreName = "--Select Store---"; UpdatePagenationControl(); }
public bool CheckStoreIsUsed(Store store, EntityStatus intendedStatus) { if (_ctx.tblSourcingDocument.Any(n => n.DocumentRecipientCostCentreId == store.Id)) return true; return false; }
protected Guid AddStore(string code, string name, CostCentreRef parent, string vatId) { Store store = new Store(Guid.NewGuid()) { CostCentreCode = code, Name = name, _Status = EntityStatus.Active, CostCentreType = CostCentreType.Store, ParentCostCentre = parent, VatRegistrationNo = vatId, }; return _costCentreRepository.Save(store); }
private VMStoreItem Map(Store store, int i) { VMStoreItem mapped = new VMStoreItem() { Store = store, RowNumber = i, }; if (store._Status == EntityStatus.Active) mapped.HlkDeactivateContent = "Deactivate"; else if (store._Status == EntityStatus.Inactive) mapped.HlkDeactivateContent = "Activate"; return mapped; }
private void ClearViewModel() { SelectedCommodity = null; SelectedFarmer = null; SelectedGrade = null; Notes = null; SelectedStore =new Store(Guid.Empty) { Name = "--Select Store---" }; SelectedStoreName = SelectedStore.Name; Weight = 0m; }
public HttpResponseMessage StoreAdd(Store store) { var response = new ResponseBool { Success = false }; try { _storeRepository.Save(store); response.Success = true; response.ErrorInfo = "Store successfully added."; } catch (DomainValidationException dve) { string errorMsg = dve.ValidationResults.Results.Aggregate("Error: Invalid store fields.\n", (current, msg) => current + ("\t- " + msg.ErrorMessage + "\n")); response.ErrorInfo = errorMsg; _log.Error(errorMsg, dve); } catch (Exception ex) //any other { response.ErrorInfo = "Error: An error occurred when saving the entity.\n" + ex.ToString(); _log.Error("Error: An error occurred when saving the entity.", ex); } return Request.CreateResponse(HttpStatusCode.OK, response); }