using ButcherFactory.BO.LocalBL;
|
|
using ButcherFactory.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using WinFormControl;
|
|
|
|
namespace ButcherFactory.SegmentStockUp_
|
|
{
|
|
public partial class SelectCustomerDialog : Form
|
|
{
|
|
public Tuple<string, long> Result;
|
|
public SelectCustomerDialog()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
Color customerColor = Color.FromArgb(144, 98, 222);
|
|
private void searchBox_Click(object sender, EventArgs e)
|
|
{
|
|
var keyBoard = new VirtualKeyPad();
|
|
if (keyBoard.ShowDialog() == true)
|
|
{
|
|
searchBox.Text = keyBoard.Result.Trim();
|
|
flowLayoutPanel1.Controls.Clear();
|
|
if (string.IsNullOrEmpty(searchBox.Text))
|
|
return;
|
|
var customers = DialogBL.GetCustomerList(searchBox.Text);
|
|
foreach (var item in customers)
|
|
{
|
|
var btn = new ColorButton() { Width = 100, Height = 60, Text = item.StringExt1.ToString(), Tag = item.LongExt1, BackColor = customerColor, Font = new Font("宋体", 10), Margin = new Padding(12) };
|
|
btn.Click += CustomerClick;
|
|
flowLayoutPanel1.Controls.Add(btn);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void CustomerClick(object sender, EventArgs e)
|
|
{
|
|
var btn = sender as ColorButton;
|
|
Result = new Tuple<string, long>(btn.Text, Convert.ToInt64(btn.Tag));
|
|
AfterChange();
|
|
}
|
|
|
|
private void clearBtn_Click(object sender, EventArgs e)
|
|
{
|
|
Result = null;
|
|
AfterChange();
|
|
}
|
|
|
|
void AfterChange()
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
private void closeBtn_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|