private void button1_Click(object sender, EventArgs e) { var service = new SalesManService(); var viewModel = service.GetSellingBySalesMan((int)listBox1.SelectedValue); dataGridView1.DataSource = viewModel.Item; }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("姓名不能為空白"); } else { SalesManViewModel sales = new SalesManViewModel() { Name = textBox1.Text }; SalesManService service = new SalesManService(); var result = service.Create(sales); if (result.IsSuccessful) { MessageBox.Show("業務員加入成功"); } else { var path = result.WriteLog(); MessageBox.Show($"發生錯誤,請參考{path}"); } } textBox1.Text = ""; }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("銷售人員姓名不可為空白"); } else { SalesManViewModel viewModel = new SalesManViewModel(); viewModel.Name = textBox1.Text; SalesManService service = new SalesManService(); if (service.IsNameExist(viewModel)) { MessageBox.Show("這個姓名已存在"); } else { var result = service.Create(viewModel); if (result.IsSuccessful) { MessageBox.Show("銷售人員加入成功"); } else { var path = result.WriteLog(); MessageBox.Show($"發生錯誤,請參考 {path}"); } } } }
private void BindSalesManListBox() { var service = new SalesManService(); var viewModel = service.GetSaleMan(); listBox2.DataSource = viewModel.Items; listBox2.DisplayMember = "Name"; listBox2.ValueMember = "JobNumber"; }
private void QuerySellingBySalesForm_Load(object sender, EventArgs e) { var service = new SalesManService(); var viewModel = service.GetSalesMen(); listBox1.DataSource = viewModel.Item; listBox1.DisplayMember = "Name"; listBox1.ValueMember = "JobNumber"; }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("欄位不得為空"); } else { SalesManViewModel viewmodel = new SalesManViewModel(); viewmodel.Name = textBox1.Text.Trim(); SalesManService service = new SalesManService(); var result = service.Create(viewmodel); if (result.IsSuccessful) { MessageBox.Show("Success"); } else { var path = result.WriteLog(); MessageBox.Show($"Wrong, 參考 {path}"); } } }
public SalesManController() { Service = new SalesManService(); }