Пример #1
0
 void LoadData()
 {
     try
     {
         List <Customer_Info> lst = c_Customer_Controller.Search_Customer(c_code, c_name);
         dgrProduct.ItemsSource = lst;
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
     }
 }
Пример #2
0
        int Insert_Customer()
        {
            try
            {
                decimal _kq = 0;

                Customer_Controller  _Customer_Controller = new Customer_Controller();
                List <Customer_Info> _lst = _Customer_Controller.Search_Customer(txtCustomer_Name.Text, txtPhone.Text);

                if (_lst.Count == 0)
                {
                    Customer_Info _Customer_Info = new Customer_Info();
                    _Customer_Info.Customer_Name = txtCustomer_Name.Text;
                    _Customer_Info.Phone         = txtPhone.Text;
                    _Customer_Info.Address       = txtAddress.Text;

                    if (!_Customer_Controller.Customer_Insert(_Customer_Info, ref _kq))
                    {
                        // Thêm mới
                        NoteBox.Show("Lỗi rồi Nắng. Thêm mới khách hàng ko thành công", "", NoteBoxLevel.Error);
                        return(-1);
                    }
                    else
                    {
                        return(Convert.ToInt32(_kq));
                    }
                }
                else if (_lst.Count == 1)
                {
                    return(_lst[0].Customer_Id);
                }

                return(Convert.ToInt32(_kq));
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(-1);
            }
        }