コード例 #1
0
        /// <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;
        }
コード例 #2
0
        /// <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;
            }
        }