Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var service   = new SalesManService();
            var viewModel = service.GetSellingBySalesMan((int)listBox1.SelectedValue);

            dataGridView1.DataSource = viewModel.Item;
        }
Пример #2
0
        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 = "";
        }
Пример #3
0
 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}");
             }
         }
     }
 }
Пример #4
0
        private void BindSalesManListBox()
        {
            var service   = new SalesManService();
            var viewModel = service.GetSaleMan();

            listBox2.DataSource    = viewModel.Items;
            listBox2.DisplayMember = "Name";
            listBox2.ValueMember   = "JobNumber";
        }
Пример #5
0
        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";
        }
Пример #6
0
        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}");
                }
            }
        }
Пример #7
0
 public SalesManController()
 {
     Service = new SalesManService();
 }