protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.IsNavigationInitiator && e.NavigationMode == NavigationMode.Back) { return; } if (this.NavigationContext.QueryString.ContainsKey(NavigateParamKey_AssetObjectID)) { this.Resources["pageTitle"] = "编辑资金帐户"; _asset = App.ViewModel.GetAssetAccount(Convert.ToInt32(this.NavigationContext.QueryString[NavigateParamKey_AssetObjectID])); if (_asset.BankCardInfos != null && _asset.BankCardInfos.Count != 0) { _bankcardInfo = _asset.BankCardInfos[0]; } else { _bankcardInfo = new BankCardInfoModel(); } } else { _asset = new AssetAcountModel(); _bankcardInfo = new BankCardInfoModel(); _asset.AssetAccountType = Model.EmAssetAccountType.Common; } this.DataContext = _asset; this.panelBankCard.DataContext = _bankcardInfo; this.listpickerAssetType.DataContext = App.StaticModel; BindUI(); }
public void DeleteAssetAccount(AssetAcountModel asset) { this.AssetAccountItems.Remove(asset); if (asset.IsBankCard && asset.BankCardInfos != null && asset.BankCardInfos.Count > 0) { _hkDB.TableBankCardInfo.DeleteOnSubmit(asset.BankCardInfos[0]); } _hkDB.TableAssetAccount.DeleteOnSubmit(asset); _hkDB.SubmitChanges(); }
public void InsertAssetAccount(AssetAcountModel asset) { _hkDB.TableAssetAccount.InsertOnSubmit(asset); if (asset.IsBankCard && asset.BankCardInfos != null && asset.BankCardInfos.Count > 0) { _hkDB.TableBankCardInfo.InsertOnSubmit(asset.BankCardInfos[0]); } _hkDB.SubmitChanges(); this.AssetAccountItems.Add(asset); }