private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (IsLoaded) { WareViewModel viewModel = (WareViewModel)WareViewMainGrid.DataContext; if (!viewModel.IsDataLoaded) { System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker(); worker.DoWork += (obj, ea) => viewModel.LoadData(); worker.RunWorkerAsync(); } } }
private async void AddMateril_DialogClosing(object sender, MaterialDesignThemes.Wpf.DialogClosingEventArgs eventArgs) { if (Equals(eventArgs.Parameter, true)) { WareViewModel viewModel = (WareViewModel)WareViewMainGrid.DataContext; await viewModel.AddWareMethodAsync(); } else { WareViewModel viewModel = (WareViewModel)WareViewMainGrid.DataContext; viewModel.AddedWare.Clear(); } }
public ActionResult EditHouse(WareViewModel model) { string acc = "AC003"; WareHouseCtrl wareHouseCtrl = new WareHouseCtrl(acc, model.ID); wareHouseCtrl.Warehouses.HouseName = model.HouseName; wareHouseCtrl.Warehouses.Address = model.Address; wareHouseCtrl.Warehouses.HouseType = model.HouseType; wareHouseCtrl.Warehouses.Remark = model.Remark; wareHouseCtrl.Edit(); var json = new { wareHouseCtrl.Code, wareHouseCtrl.Msg }; return(Json(json, "text/html", JsonRequestBehavior.AllowGet)); }
public ActionResult AddHouse(WareViewModel model) { string acc = "AC003"; WareHouseCtrl wareHouseCtrl = new WareHouseCtrl(acc); wareHouseCtrl.Warehouses = new Warehouses(); wareHouseCtrl.Warehouses.Address = model.Address; wareHouseCtrl.Warehouses.HouseName = model.HouseName; wareHouseCtrl.Warehouses.HouseType = model.HouseType; wareHouseCtrl.Warehouses.Remark = model.Remark; wareHouseCtrl.Warehouses.Status = int.Parse(model.Status); wareHouseCtrl.Warehouses.CreatDate = DateTime.Now.ToString("yyyy-MM-dd"); wareHouseCtrl.Warehouses.Creator = "admin"; wareHouseCtrl.Save(); var json = new { wareHouseCtrl.Code, wareHouseCtrl.Msg }; return(Json(json, "text/html", JsonRequestBehavior.AllowGet)); }