public StorageViewModel MapToViewModel(Storage storage) { StorageViewModel storageVM = new StorageViewModel(); storageVM.unit = new StorageUnitViewModel(); storageVM.unit.division = new DivisionViewModel(); storageVM._id = storage.Id; storageVM.UId = storage.UId; storageVM._deleted = storage._IsDeleted; storageVM._active = storage.Active; storageVM._createdDate = storage._CreatedUtc; storageVM._createdBy = storage._CreatedBy; storageVM._createAgent = storage._CreatedAgent; storageVM._updatedDate = storage._LastModifiedUtc; storageVM._updatedBy = storage._LastModifiedBy; storageVM._updateAgent = storage._LastModifiedAgent; storageVM.code = storage.Code; storageVM.name = storage.Name; storageVM.description = storage.Description; storageVM.unit._id = storage.UnitId; storageVM.unit.name = storage.UnitName; storageVM.unit.division.Name = storage.DivisionName; return(storageVM); }
private void LoadInventoriesData() { List <InventoryViewModel> mInventories = HomeFragment.mInventoriesByProduct; StorageViewModel SelectedStorage = HomeStoragesFragment.mSelectedStorageClass; LocationViewModel mSelectedStorage = MainActivity.StaticActiveLocationClass; ProductViewModel mSelectedProduct = HomeFragment.mHomeSelectedProduct; mFilteredInventories = new List <InventoryViewModel>(); for (int i = 0; i < mInventories.Count; i++) { if (mInventories[i].StorageId == SelectedStorage.Id) { mFilteredInventories.Add(mInventories[i]); } } if (mFilteredInventories != null) { this.mHomeInventoriesAdapter = new HomeInventoryRecycleAdapter(mFilteredInventories, mSelectedProduct, this.Activity); this.mHomeInventoriesAdapter.ItemClick += OnStorageClicked; this.mListViewStorages.SetAdapter(this.mHomeInventoriesAdapter); } }
public ActionResult Edit(Storage storage) { this.ModelState.Clear(); this.TryValidateModel(storage.Address.Country); this.TryValidateModel(storage.Address); this.TryValidateModel(storage); if (!ModelState.IsValid) { var model = new StorageViewModel { Countries = this._countryService.GetCountries() }; model.Storage = storage; return(this.View(model)); } if (this._storageService.GetStorage(storage.Id) == null) { this._storageService.AddStorage(storage); this._storageService.SaveStorage(); } else { this._storageService.UpdateStorage(storage); this._storageService.SaveStorage(); } return(this.RedirectToAction("Index")); }
private void OpenDetails(StorageViewModel model, bool isNew = false) { // keep old storage data var oldStorageGroupId = model.StorageGroupId; var oldCurrencyId = model.CurrencyId; // open storage details this.OpenDetailsWindow(new StorageDetailsView(_service, model, isNew, _storageGroups.Cast <StorageGroupModel>(), _currencies), () => { // update view if (isNew) { // insert new storage into view AddStorageIntoView(model); } else if (oldStorageGroupId != model.StorageGroupId) { // remove from old group _storageGroupPanel[oldStorageGroupId].Children.Remove(_storageView[model.Id]); // add into new group _storageGroupPanel[model.StorageGroupId].Children.Add(_storageView[model.Id]); RefreshStoragesSequence(model.StorageGroupId); } else if (oldCurrencyId != model.CurrencyId) { RefreshStoragesSequence(model.StorageGroupId); } NotifyDataChanged(); }); }
public static JawMoveInfo Create(TaskType type, StorageViewModel storage) { return(new JawMoveInfo() { Floor = storage.Floor, Row = storage.Column / (Common.STOR_COL_COUNT / 2 + 1) + 1, Col = (storage.Column - 1) % (Common.STOR_COL_COUNT / 2) + 1, Type = type }); }
public ActionResult AddStorage() { var rp = new StorageRepo(new StorageMssql()); var cvm = new StorageViewModel((Computer)Session["CurrentBuild"], rp.GetAll()); return(View(cvm)); }
public Storage MapToModel(StorageViewModel storageVM) { Storage storage = new Storage(); storage.Id = storageVM._id; storage.UId = storageVM.UId; storage._IsDeleted = storageVM._deleted; storage.Active = storageVM._active; storage._CreatedUtc = storageVM._createdDate; storage._CreatedBy = storageVM._createdBy; storage._CreatedAgent = storageVM._createAgent; storage._LastModifiedUtc = storageVM._updatedDate; storage._LastModifiedBy = storageVM._updatedBy; storage._LastModifiedAgent = storageVM._updateAgent; storage.Code = storageVM.code; storage.Name = storageVM.name; storage.Description = storageVM.description; if (!Equals(storageVM.unit, null)) { storage.UnitId = storageVM.unit._id; storage.UnitName = storageVM.unit.name; storage.DivisionName = storageVM.unit.division.Name; } else { storage.UnitId = null; storage.UnitName = null; storage.DivisionName = null; } return(storage); }
public async Task <IActionResult> AddOrRemove(StorageViewModel model) { try { if (model.ComponentId == Guid.Empty) { throw new InvalidOperationException("Először válasszon ki egy terméket!"); } if (model.IsAdd) { await _storageService.AddAsync(model.ComponentId, model.Piece); } else { await _storageService.RemoveAsync(model.ComponentId, model.Piece); } return(RedirectToAction(nameof(Index))); } catch (InvalidOperationException e) { model.Errors = new List <string>() { e.Message }; return(RedirectToAction(nameof(Index), model)); } }
public StorageViewModel Get(string name) { StorageDto storageDto = storageAppService.Get(name); StorageViewModel storageViewModel = this.mapper.Map <StorageViewModel>(storageDto); return(storageViewModel); }
public IHttpActionResult PostStorage(StorageViewModel storage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _storageRepository.Add(storage.ToModel()); } catch (DbUpdateException) { if (StorageExist(storage.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = storage.Id }, storage)); }
public async Task <IHttpActionResult> PutStorage(Guid id, StorageViewModel storage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != storage.Id) { return(BadRequest()); } storage.Id = id; try { await _storageRepository.EditAsync(storage.ToModel()); } catch (DbUpdateConcurrencyException) { if (!StorageExist(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void MButtonAdd_Click(object sender, EventArgs e) { mProgressBar.Visibility = Android.Views.ViewStates.Visible; StorageViewModel newStorage = new StorageViewModel() { Name = mStorageName.Text, Area = mStorageArea.Text, Description = mStorageDescription.Text, LocationId = mSelectedLocationId, CreatedUserId = mAuthorizedId.ToString(), AddedUserId = mAuthorizedId.ToString() }; new Thread(new ThreadStart(async delegate { UpgradeProgress(); var isAdded = mStorageDataService.Add(newStorage.ToModel()); if (isAdded) { LoginPageActivity.mGlobalStorages = await mStorageDataService.GetAll(); this.Activity.RunOnUiThread(() => Toast.MakeText(this.Activity, "Storage Added", ToastLength.Long).Show()); mProgressBar.Visibility = Android.Views.ViewStates.Invisible; ReplaceFragment(new StoragesFragment(), "Manage Storages"); } else { this.Activity.RunOnUiThread(() => Toast.MakeText(this.Activity, "Failed", ToastLength.Long).Show()); } })).Start(); }
private void LoadRecyclerAdapter(StorageViewModel store, CategoryViewModel cat) { //int i = 0; //while (mInventories[i] != null) //{ // if (store!=null && mInventories[i].StorageId==store.Id) // { // int productCounter = -1; // if (cat!=null && mProducts[productCounter].CategoryId==cat.Id) // { // this.mInventoryAdapter = new InventoryRecycleAdapter(this.mInventories, this.mProducts, this); // this.mInventoryAdapter.ItemClick += OnInventoryClick; // this.mListViewInventory.SetAdapter(this.mInventoryAdapter); // } // productCounter++; // } // else // { // this.mInventoryAdapter = new InventoryRecycleAdapter(this.mInventories, this.mProducts, this); // this.mInventoryAdapter.ItemClick += OnInventoryClick; // this.mListViewInventory.SetAdapter(this.mInventoryAdapter); // } // i++; //} }
public ActionResult Storage(int computerId) { var cr = new ComputerRepo(new ComputerMssql()); var mr = new StorageRepo(new StorageMssql()); var svm = new StorageViewModel(cr.GetById(computerId), mr.GetAll()); return(View(svm)); }
private void OnStorageClicked(object sender, int e) { mSelectedStorage = e; mSelectedStorageClass = mStorages[e]; //mTextSelectedLocation.Text = mLocations[e].Name; MainActivity.StaticStorageClass = mStorages[e]; ReplaceFragment(new InventoriesFragment(), mStorages[e].Name.ToString()); }
public MainStorage(string section) { try { InitializeComponent(); DataContext = new StorageViewModel(section); } catch { } }
/// <summary> /// 实时界面数据刷新 /// </summary> private void Page_Frush() { stockBase.StockList.Clear(); foreach (var model in StorageViewModel.GetStockList()) { stockBase.StockList.Add(model); } this.StockDataGrid.ItemsSource = stockBase.StockList; }
public StorageView(StorageViewModel viewModel) { InitializeComponent(); DataContext = ViewModel = viewModel; ViewModel.Close += (sender, eventArgs) => { DialogResult = eventArgs.IsAccepted; Close(); }; }
private void SpinnerStorage_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; mStorage = mStorages[e.Position]; string toast = string.Format("{0} selected", mStorage.Name); Toast.MakeText(this, toast, ToastLength.Long).Show(); //LoadRecyclerAdapter(mStorage,mCategory); }
//Konstruktor widoku public StorageView() { //Utworzenie nowego obiektu klasy StorageViewModel storageViewModel = new StorageViewModel(); //Inicjalizacja zawartości okna InitializeComponent(); //Zbindowanie zawartości tabeli do widoku viewmodelu this.DataGrid.ItemsSource = storageViewModel.ItemsView; //Przypisanie filtru do metody UserFilter storageViewModel.ItemsView.Filter = UserFilter; }
public IHttpActionResult GetStorage(Guid id) { StorageViewModel storage = new StorageViewModel(_storageRepository.GetSingle(e => e.Id == id)); if (storage == null) { return(NotFound()); } return(Ok(storage)); }
// GET: /<controller>/ public ViewResult Index() { var storageViewModel = new StorageViewModel { pieRepository = _pieRepository, storageRepository = (StorageRepository)_storageRepository }; return(View(storageViewModel)); }
public StorageControl(int id) { InitializeComponent(); this.Storage = Current.Storages.FirstOrDefault(o => o.Id == id); this.DataContext = this.Storage; this.Col = this.Storage.Column; this.Floor = this.Storage.Floor; this.lbShowInfo.FontSize = Common.PROJ_NO == "0079" ? 12 : 8; }
public IActionResult Post([FromBody] StorageViewModel model) { try { var ent = _service.CreateFromViewModel(model); return(new OkObjectResult(_service.mapper.Map <StorageViewModel>(ent))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private void OnStorageClicked(object sender, int e) { mSelectedStorage = e; mSelectedStorageClass = mStorages[e]; //mTextSelectedLocation.Text = mLocations[e].Name; LoginPageActivity.StaticStorageClass = mStorages[e]; FragmentTransaction transaction = FragmentManager.BeginTransaction(); DialogStorageOptions StorageDialog = new DialogStorageOptions(); StorageDialog.Show(transaction, "dialogue fragment"); StorageDialog.OnStorageOptionsPicked += StorageOptions_OnComplete; }
public ActionResult Index() { try { List <StorageViewModel> storageViewModels2 = new List <StorageViewModel>(); PagingParameterModel pagingParameterModel = new PagingParameterModel(); pagingParameterModel.pageNumber = 1; pagingParameterModel._pageSize = 1; pagingParameterModel.Id = 0; pagingParameterModel.PageSize = 100; var StorageList = webServices.Post(pagingParameterModel, "Storage/All"); if (StorageList.StatusCode == System.Net.HttpStatusCode.Accepted) { storageViewModels = (new JavaScriptSerializer().Deserialize <List <StorageViewModel> >(StorageList.Data.ToString())); if (storageViewModels.Count > 0) { StorageViewModel storageViewModelObj = new StorageViewModel(); foreach (var item in storageViewModels) { if (item.Action == true) { storageViewModelObj.Id = item.Id; storageViewModelObj.StockIn = item.StockIn; storageViewModelObj.From = item.Source.ToLower() == "site" ? item.SiteName : item.TrafficPlateNumber; storageViewModelObj.Source = item.Source; storageViewModelObj.UserName = item.UserName; } else { storageViewModelObj.StockOut = item.StockOut; storageViewModelObj.To = item.Source.ToLower() == "site" ? item.SiteName : item.TrafficPlateNumber; storageViewModelObj.ToSource = item.Source; storageViewModels2.Add(storageViewModelObj); storageViewModelObj = new StorageViewModel(); } } } return(View(storageViewModels2)); } return(View(storageViewModels)); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Post([FromBody] StorageViewModel model) { return(await this.HttpPost( model, async() => { Storage entity = await this.Mapper.MapNewAsync <StorageViewModel, Storage>(model); ServiceResult <Storage> result = await this.storageService.CreateStorageAsync(entity); return await this.HttpPostResult <Storage, StorageViewModel>(this.Get, result); })); }
public static StorageViewModel GetPrintingGreigeStorage(HttpClientTestService client) { Dictionary <string, object> filter = new Dictionary <string, object> { { "name", "Gudang Greige Printing" } }; var response = client.GetAsync($@"{APIEndpoint.Core}master/storages?filter=" + JsonConvert.SerializeObject(filter)).Result.Content.ReadAsStringAsync(); Dictionary <string, object> result = JsonConvert.DeserializeObject <Dictionary <string, object> >(response.Result); List <StorageViewModel> list = JsonConvert.DeserializeObject <List <StorageViewModel> >(result["data"].ToString()); StorageViewModel storage = list.First(); return(storage); }
public async Task <IActionResult> Index(StorageViewModel model = null) { if (model == null) { model = new StorageViewModel(); } model.Items = await _storageService.GetAllAsync(); model.Components = await _componentService.GetAllAsync(); model.IsAdd = false; return(View(model)); }
public IActionResult Put(long id, [FromBody] StorageViewModel value) { try { var ent = _service.GetById(id); _service.ViewModel = value; ent = _service.Update(ent); return(new OkObjectResult(_service.mapper.Map <StorageViewModel>(ent))); } catch (Exception ex) { return(new BadRequestObjectResult(ex.Message)); } }