private void ClearCustomer()
 {
     selectedCust = null;
     FieldPhone.Text = "";
     FieldFName.Text = "";
     FieldMName.Text = "";
     FieldLName.Text = "";
     FieldAddress.Text = "";
     FieldMemo.Text = "";
     ListCustPhone.SelectedIndex = -1;
     ListCustPhone.AutoRefresh = true;
     ListCustName.AutoRefresh = true;
 }
        public TakeOutForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            selectedCust = null;
            takeOrderMode = false;
        }
        private void BtnCustSearch_Click(object sender, System.EventArgs e)
        {
            if (FieldPhone.Text == "" && FieldFName.Text == "" &&
                FieldMName.Text == "" && FieldLName.Text == "")
            {
                MessageBox.Show("Please fill phone number, first name, middle name, or last name.",
                    "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            CustomerService.CustomerService service = new CustomerService.CustomerService();
            custList = service.SearchCustomers(FieldPhone.Text, FieldFName.Text, FieldMName.Text, FieldLName.Text);
            if (custList != null && custList.Length == 1)
            {
                selectedCust = custList[0];
                UpdateCustomerField();
            }
            UpdateCustomerList();
        }
        private void BtnSave_Click(object sender, System.EventArgs e)
        {
            if (FieldFName.Text == "")
            {
                MessageBox.Show("Please fill first name.", "Information",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CustomerService.CustomerInformation custInfo;
            if (selectedCust != null)
                custInfo = selectedCust;
            else
            {
                custInfo = new CustomerService.CustomerInformation();
                custInfo.CustID = 0;
            }
            custInfo.Telephone = FieldPhone.Text;
            custInfo.FirstName = FieldFName.Text;
            custInfo.MiddleName = FieldMName.Text;
            custInfo.LastName = FieldLName.Text;
            custInfo.Address = FieldAddress.Text;
            custInfo.Description = FieldMemo.Text;

            CustomerService.CustomerService service = new CustomerService.CustomerService();
            string result = service.SetCustomer(custInfo);
            if (result != null)
            {
                MessageBox.Show(result);
                return;
            }
            BtnCustSearch_Click(null, null);
        }
 private void ListCustPhone_ItemClick(object sender, smartRestaurant.Controls.ItemsListEventArgs e)
 {
     if (e.Item.Value is CustomerService.CustomerInformation)
     {
         selectedCust = (CustomerService.CustomerInformation)e.Item.Value;
         UpdateCustomerField();
     }
 }
 private void BtnCustList_Click(object sender, System.EventArgs e)
 {
     CustomerService.CustomerService service = new CustomerService.CustomerService();
     custList = service.GetCustomers();
     if (selectedCust != null)
     {
         for (int i = 0;i < custList.Length;i++)
             if (custList[i].CustID == selectedCust.CustID)
             {
                 selectedCust = custList[i];
                 break;
             }
     }
     UpdateCustomerList();
 }
示例#7
0
 /// <remarks/>
 public System.IAsyncResult BeginSetCustomer(CustomerInformation custInfo, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("SetCustomer", new object[] {
                 custInfo}, callback, asyncState);
 }
示例#8
0
 public string SetCustomer(CustomerInformation custInfo)
 {
     object[] results = this.Invoke("SetCustomer", new object[] {
                 custInfo});
     return ((string)(results[0]));
 }
 // Methods
 public SearchCustomerForm()
 {
     this.InitializeComponent();
     this.selectedCust = null;
 }
示例#10
0
 private void ListCustPhone_ItemClick(object sender, ItemsListEventArgs e)
 {
     if (e.Item.Value is CustomerInformation)
     {
         this.selectedCust = (CustomerInformation) e.Item.Value;
         this.UpdateCustomerField();
     }
 }
示例#11
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (this.FieldFName.Text == "")
     {
         MessageBox.Show("Please fill first name.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         CustomerInformation selectedCust;
         if (this.selectedCust != null)
         {
             selectedCust = this.selectedCust;
         }
         else
         {
             selectedCust = new CustomerInformation();
             selectedCust.CustID = 0;
         }
         selectedCust.Telephone = this.FieldPhone.Text;
         selectedCust.FirstName = this.FieldFName.Text;
         selectedCust.MiddleName = this.FieldMName.Text;
         selectedCust.LastName = this.FieldLName.Text;
         selectedCust.Address = this.FieldAddress.Text;
         selectedCust.Description = this.FieldMemo.Text;
         string text = new smartRestaurant.CustomerService.CustomerService().SetCustomer(selectedCust);
         if (text != null)
         {
             MessageBox.Show(text);
         }
         else
         {
             this.BtnCustSearch_Click(null, null);
         }
     }
 }
示例#12
0
 private void BtnCustSearch_Click(object sender, EventArgs e)
 {
     if (((this.FieldPhone.Text == "") && (this.FieldFName.Text == "")) && ((this.FieldMName.Text == "") && (this.FieldLName.Text == "")))
     {
         MessageBox.Show("Please fill phone number, first name, middle name, or last name.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         this.custList = new smartRestaurant.CustomerService.CustomerService().SearchCustomers(this.FieldPhone.Text, this.FieldFName.Text, this.FieldMName.Text, this.FieldLName.Text);
         if ((this.custList != null) && (this.custList.Length == 1))
         {
             this.selectedCust = this.custList[0];
             this.UpdateCustomerField();
         }
         this.UpdateCustomerList();
     }
 }
示例#13
0
 private void BtnCustList_Click(object sender, EventArgs e)
 {
     this.custList = new smartRestaurant.CustomerService.CustomerService().GetCustomers();
     if (this.selectedCust != null)
     {
         for (int i = 0; i < this.custList.Length; i++)
         {
             if (this.custList[i].CustID == this.selectedCust.CustID)
             {
                 this.selectedCust = this.custList[i];
                 break;
             }
         }
     }
     this.UpdateCustomerList();
 }
示例#14
0
 private void ClearCustomer()
 {
     this.roadIgnoreFlag = true;
     this.selectedCust = null;
     this.FieldPhone.Text = string.Empty;
     this.FieldFName.Text = string.Empty;
     this.FieldMName.Text = string.Empty;
     this.FieldLName.Text = string.Empty;
     this.FieldAddress.Text = string.Empty;
     this.memo = string.Empty;
     this.FieldRoad.Text = string.Empty;
     this.FieldOtherRoad.Text = string.Empty;
     this.FieldArea.Text = string.Empty;
     this.ListCustPhone.SelectedIndex = -1;
     this.ListCustPhone.AutoRefresh = true;
     this.ListCustName.AutoRefresh = true;
     this.roadIgnoreFlag = false;
 }
示例#15
0
 // Methods
 public TakeOutForm()
 {
     this.InitializeComponent();
     this.selectedCust = null;
     this.takeOrderMode = false;
     this.orderListSortFlag = true;
 }