/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, RoutedEventArgs e) { this.DataVerify(); if (this.IsVerify) { PfmAccountsMDL accMdl = new PfmAccountsMDL(); accMdl.AccAddTime = DateTime.Now; accMdl.MbrId = TypeHelper.TypeToInt32(this.cboxMember.SelectedValue, 0); accMdl.AccStatus = TypeHelper.TypeToTinyInt(this.cboxStatus.SelectedValue, 0); accMdl.AccName = this.txtName.Text; accMdl.AccCode = string.IsNullOrEmpty(this.txtCode.Text) ? null : this.txtCode.Text; accMdl.AccCard = string.IsNullOrEmpty(this.txtCard.Text) ? null : this.txtCard.Text; accMdl.AccPurpose = string.IsNullOrEmpty(this.txtPurpose.Text) ? null : this.txtPurpose.Text; accMdl.AccDescription = string.IsNullOrEmpty(this.txtDescription.Text) ? null : this.txtDescription.Text; PfmAccountsBLL.Insert(accMdl); MessageBoxResult boxResult = MessageBox.Show("新数据添加成功!是否继续添加?", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { this.InitializeData(); } else { if (ModuleExtend != null) { this.ModuleExtend(false, Library.Transit.NameItems.Accounts); } } } }
/// <summary> /// 初始化数据 /// </summary> private void InitializeData() { if (this.svDetailed.Visibility == Visibility.Visible) { this.DetailedBack(); } EntityListener.PfmAccountsListener.Instance.Receive(PfmAccountsBLL.ISelectPaging(pager.PageSize, pager.PageCurrent, out _dataTotal)); }
/// <summary> /// 删除账务账目数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mitmDelete_Click(object sender, RoutedEventArgs e) { if (AccountEntity != null && AccountEntity.AccId > 0) { MessageBoxResult boxResult = MessageBox.Show(string.Format("您确定要删除数据【{0}】所包含的信息吗?", AccountEntity.AccName), "询问:", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { PfmAccountsBLL.Delete(AccountEntity.AccId); MessageBox.Show("数据删除成功!", "提示:", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); this.InitializePaging(); } } }
/// <summary> /// 取得账务账目名称 /// </summary> /// <param name="accId">账目编号</param> /// <returns></returns> public static string GetName(int accId) { return(PfmAccountsBLL.Select(accId).AccName); }
/// <summary> /// 初始化数据盒子 /// </summary> private void InitBoxOfComboBox() { //收支类型 this.cboxType.SelectedValuePath = "Value"; this.cboxType.DisplayMemberPath = "Key"; this.cboxType.DataContext = DictionaryTsit.IncomingsOrOutgoings; //账务成员 IList <PfmMemberMDL> mbrList = PfmMemberBLL.ISelect(); if (mbrList.Count > 0) { this.cboxMember.SelectedValuePath = "MbrId"; this.cboxMember.DisplayMemberPath = "MbrName"; this.cboxMember.DataContext = mbrList; } else { this.cboxMember.SelectedValuePath = "Value"; this.cboxMember.DisplayMemberPath = "Key"; this.cboxMember.DataContext = DictionaryTsit.DefSelect; } //账务账目 IList <PfmAccountsMDL> accList = PfmAccountsBLL.ISelect(); if (accList.Count > 0) { this.cboxAccounts.SelectedValuePath = "AccId"; this.cboxAccounts.DisplayMemberPath = "AccName"; this.cboxAccounts.DataContext = accList; } else { this.cboxAccounts.SelectedValuePath = "Value"; this.cboxAccounts.DisplayMemberPath = "Key"; this.cboxAccounts.DataContext = DictionaryTsit.DefSelect; } //收支类别 IList <PfmIaeCategoryMDL> catList = PfmIaeCategoryBLL.RecursiveI(" ", " "); if (catList.Count > 0) { this.cboxCategory.SelectedValuePath = "CatId"; this.cboxCategory.DisplayMemberPath = "CatName"; this.cboxCategory.DataContext = catList; } else { this.cboxCategory.SelectedValuePath = "Value"; this.cboxCategory.DisplayMemberPath = "Key"; this.cboxCategory.DataContext = DictionaryTsit.DefSelect; } //收支项目·名称 IList <PfmIaeItemsMDL> itemName = PfmIaeItemsBLL.ISelect("item_type = 1 and item_status > 0"); if (itemName.Count > 0) { this.cboxName.SelectedValuePath = "ItemName"; this.cboxName.DisplayMemberPath = "ItemName"; this.cboxName.DataContext = itemName; } else { this.cboxName.SelectedValuePath = "Value"; this.cboxName.DisplayMemberPath = "Key"; this.cboxName.DataContext = DictionaryTsit.DefSelect; } //收支项目·地址 IList <PfmIaeItemsMDL> addrName = PfmIaeItemsBLL.ISelect("item_type = 2 and item_status > 0"); if (addrName.Count > 0) { this.cboxAddress.SelectedValuePath = "ItemName"; this.cboxAddress.DisplayMemberPath = "ItemName"; this.cboxAddress.DataContext = addrName; } else { this.cboxAddress.SelectedValuePath = "Value"; this.cboxAddress.DisplayMemberPath = "Key"; this.cboxAddress.DataContext = DictionaryTsit.DefSelect; } //收支项目·描述 IList <PfmIaeItemsMDL> descName = PfmIaeItemsBLL.ISelect("item_type = 3 and item_status > 0"); if (descName.Count > 0) { this.cboxDescription.SelectedValuePath = "ItemName"; this.cboxDescription.DisplayMemberPath = "ItemName"; this.cboxDescription.DataContext = descName; } else { this.cboxDescription.SelectedValuePath = "Value"; this.cboxDescription.DisplayMemberPath = "Key"; this.cboxDescription.DataContext = DictionaryTsit.DefSelect; } }