/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, RoutedEventArgs e) { this.DataVerify(); if (IsVerify) { PfmMemberMDL mbrMdl = new PfmMemberMDL(); mbrMdl.MbrAddTime = DateTime.Now; mbrMdl.MbrName = this.txtName.Text; mbrMdl.MbrRelation = this.txtRelation.Text; mbrMdl.MbrDescription = this.txtDescription.Text; PfmMemberBLL.Insert(mbrMdl); 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.Member); } } } }
/// <summary> /// 删除成员数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mitmDelete_Click(object sender, RoutedEventArgs e) { if (MemberEntity != null && MemberEntity.MbrId > 0) { MessageBoxResult boxResult = MessageBox.Show(string.Format("您确定要删除数据【{0}】所包含的信息吗?", MemberEntity.MbrName), "询问:", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { PfmMemberBLL.Delete(MemberEntity.MbrId); MessageBox.Show("数据删除成功!", "提示:", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); this.InitializePaging(); } } }
/// <summary> /// 初始化数据盒子 /// </summary> private void InitBoxOfComboBox() { 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; } this.cboxStatus.SelectedValuePath = "Value"; this.cboxStatus.DisplayMemberPath = "Key"; this.cboxStatus.DataContext = DictionaryTsit.Status; }
/// <summary> /// 取得账务成员名称 /// </summary> /// <param name="mbrId">成员编号</param> /// <returns></returns> public static string GetName(int mbrId) { return(PfmMemberBLL.Select(mbrId).MbrName); }
/// <summary> /// 初始化数据 /// </summary> private void InitializeData() { EntityListener.PfmMemberListener.Instance.Receive(PfmMemberBLL.ISelectPaging(pager.PageSize, pager.PageCurrent, out _dataTotal)); }
/// <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; } }