﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LJH.Inventory.WebApiClient;
using LJH.Inventory.BusinessModel;
using LJH.Inventory.BusinessModel.SearchCondition;

namespace LJH.Inventory.UI.Controls
{
    public partial class 加工人员ComboBox : ComboBox
    {
        #region 构造函数
        public 加工人员ComboBox()
        {
            InitializeComponent();
        }

        public 加工人员ComboBox(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
        #endregion

        #region 公共方法
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init_加工人员()
        {
            var pots = new List<SheetType>() { SheetType.加工单, SheetType.防火门加工单, SheetType.卷帘门加工单, SheetType.入户门加工单 };
            var ops = new PurchaseOrderBLL(LJH.Inventory.BusinessModel.AppSettings.Current.ConnStr).获取所有加工人员(new PurchaseOrderSearchCondition() { SheetTypes = pots });
            this.Items.Clear();
            if (ops != null && ops.Count > 0)
            {
                this.Items.Add(string.Empty);
                foreach (var op in ops)
                {
                    if (!string.IsNullOrEmpty(op)) this.Items.Add(op);
                }
            }
        }

        public void Init_采购人员()
        {
            var pots = new List<SheetType>() { SheetType.物料采购单 };
            var ops = new PurchaseOrderBLL(LJH.Inventory.BusinessModel.AppSettings.Current.ConnStr).获取所有加工人员(new PurchaseOrderSearchCondition() { SheetTypes = pots });
            this.Items.Clear();
            if (ops != null && ops.Count > 0)
            {
                this.Items.Add(string.Empty);
                foreach (var op in ops)
                {
                    if (!string.IsNullOrEmpty(op)) this.Items.Add(op);
                }
            }
        }
        #endregion
    }
}
