示例#1
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     this.DataVerify();
     if (this.IsVerify)
     {
         PfmIaeItemsMDL itemMdl = new PfmIaeItemsMDL();
         itemMdl.ItemAddTime     = DateTime.Now;
         itemMdl.ItemStatus      = TypeHelper.TypeToTinyInt(this.cboxStatus.SelectedValue, 0);
         itemMdl.ItemType        = TypeHelper.TypeToTinyInt(this.cboxType.SelectedValue, 0);
         itemMdl.ItemName        = this.txtName.Text;
         itemMdl.ItemDescription = string.IsNullOrEmpty(this.txtDescription.Text) ? null : this.txtDescription.Text;
         PfmIaeItemsBLL.Insert(itemMdl);
         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.IaeItems);
             }
         }
     }
 }
 /// <summary>
 /// 删除收支项目数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mitmDelete_Click(object sender, RoutedEventArgs e)
 {
     if (IaeItemsEntity != null && IaeItemsEntity.ItemId > 0)
     {
         MessageBoxResult boxResult = MessageBox.Show(string.Format("您确定要删除数据【{0}】所包含的信息吗?", IaeItemsEntity.ItemName), "询问:", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
         if (boxResult == MessageBoxResult.Yes)
         {
             PfmIaeItemsBLL.Delete(IaeItemsEntity.ItemId);
             MessageBox.Show("数据删除成功!", "提示:", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
             this.InitializePaging();
         }
     }
 }
 /// <summary>
 ///  初始化数据
 /// </summary>
 private void InitializeData()
 {
     EntityListener.PfmIaeItemsListener.Instance.Receive(PfmIaeItemsBLL.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;
            }
        }