﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Windows;

using Memento.JMS.JMSCommon;

namespace Memento.JMS.Server
{
    /// <summary>
    /// 商品类别列表管理界面
    /// </summary>
    public class ProductTypeList : SingleTable
    {
        #region 构造函数

        /// <summary>
        /// 商品类别列表管理界面
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="orderFields"></param>
        public ProductTypeList()
            : base(TableNameHelper.BS_PRODUCTTYPE, "", "ID")
        {
        }

        #endregion

        #region 重写方法

        internal override void InitFlexGridColumns()
        {
            base.InitFlexGridColumns();

            AddColumn("Seq", "顺序", false);
            AddColumn("Code", "商品种类编号");
            AddColumn("Name", "商品种类名称");
        }

        internal override Window InitDataItemEditChildWindow(DataRow dataRow, Action<int, int> loadListData)
        {
            if(dataRow == null)
            {
                return new ProductType(loadListData);
            }

            return new ProductType(dataRow, loadListData);
        }

        internal override void AfterEdited()
        {
            base.AfterEdited();
            BaseDataCache.InitSingleBaseData(TableNameHelper.BS_PRODUCTTYPE);
        }

        #endregion
    }
}