private void FieldRoad_TextChanged(object sender, EventArgs e) { if (!this.roadIgnoreFlag) { this.selectedRoad = null; this.FieldOtherRoad.Text = string.Empty; this.FieldArea.Text = string.Empty; this.SearchRoad(); } }
private void FieldOtherRoad_TextChanged(object sender, EventArgs e) { if (this.FieldOtherRoad.Text != string.Empty) { this.roadIgnoreFlag = true; this.selectedRoad = null; this.FieldRoad.Text = string.Empty; this.FieldArea.Text = "N/A"; this.roadIgnoreFlag = false; } }
public override void UpdateForm() { if (AppParameter.DeliveryModeOnly) { this.BtnMain.Visible = false; this.BtnManager.Visible = ((MainForm) base.MdiParent).User.IsManager() || ((MainForm) base.MdiParent).User.IsAuditor(); this.BtnExit.Visible = true; } else { this.BtnMain.Visible = true; this.BtnManager.Visible = false; this.BtnExit.Visible = false; } if (this.tableInfo == null) { smartRestaurant.TableService.TableService service = new smartRestaurant.TableService.TableService(); TableInformation[] tableList = service.GetTableList(); while (tableList == null) { if (MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel) { ((MainForm) base.MdiParent).Exit(); } else { tableList = service.GetTableList(); } } for (int i = 0; i < tableList.Length; i++) { if (tableList[i].TableID == 0) { this.tableInfo = tableList[i]; break; } } if (this.tableInfo == null) { ((MainForm) base.MdiParent).Exit(); } } this.selectedTakeOut = null; this.selectedRoad = null; this.roadIgnoreFlag = false; this.roadLstIgnoreFlag = false; this.LblPageID.Text = "Employee ID:" + ((MainForm) base.MdiParent).UserID + " | STTO020"; this.UpdateTakeOutList(); if (this.FieldFName.Text == "") { this.BtnCustList_Click(null, null); } else { this.BtnCustSearch_Click(null, null); } this.FieldPhone.Focus(); }
private void UpdateCustomerField() { if (this.selectedCust != null) { string firstName = this.selectedCust.FirstName; if (this.selectedCust.MiddleName != string.Empty) { string str2 = firstName; firstName = str2 + " " + this.selectedCust.MiddleName + " " + this.selectedCust.LastName; } else if (this.selectedCust.LastName != string.Empty) { firstName = firstName + " " + this.selectedCust.LastName; } this.FieldPhone.Text = this.selectedCust.Telephone; this.FieldFName.Text = firstName; this.FieldMName.Text = this.selectedCust.MiddleName; this.FieldLName.Text = this.selectedCust.LastName; if (this.selectedCust.Address != null) { this.FieldAddress.Text = this.selectedCust.Address.Replace("\n", "\r\n"); } else { this.FieldAddress.Text = string.Empty; } this.memo = this.selectedCust.Description; this.UpdateMemoButton(); this.roadIgnoreFlag = true; if (this.selectedCust.RoadID == 0) { this.FieldRoad.Text = string.Empty; this.FieldOtherRoad.Text = this.selectedCust.OtherRoadName; this.FieldArea.Text = "N/A"; } else { this.selectedRoad = Customer.GetRoad(this.selectedCust.RoadID); if (this.selectedRoad != null) { this.FieldRoad.Text = this.selectedRoad.RoadName; this.FieldArea.Text = this.selectedRoad.AreaName; } else { this.FieldRoad.Text = string.Empty; this.FieldArea.Text = string.Empty; } this.FieldOtherRoad.Text = string.Empty; } this.FieldFName.Focus(); this.roadIgnoreFlag = false; } this.UpdateCustomerButton(); }
private void SearchRoad() { this.LstRoad.Items.Clear(); if (Customer.Roads == null) { this.FieldArea.Text = "N/A"; this.LstRoad.Visible = false; this.selectedRoad = null; } else { string str = this.FieldRoad.Text.ToUpper(); for (int i = 0; i < Customer.Roads.Length; i++) { if (Customer.Roads[i].RoadName.ToUpper().IndexOf(str) == 0) { RoadItem item = new RoadItem(); item.RoadID = Customer.Roads[i].RoadID; item.RoadName = Customer.Roads[i].RoadName; item.AreaName = Customer.Roads[i].AreaName; item.Object = Customer.Roads[i]; this.LstRoad.Items.Add(item); } } if (this.LstRoad.Items.Count > 0) { this.LstRoad.Width = this.FieldRoad.Width; this.LstRoad.Height = 160; this.LstRoad.Top = this.FieldRoad.Top + this.FieldRoad.Height; this.LstRoad.Left = this.FieldRoad.Left; this.LstRoad.SelectedItem = null; this.LstRoad.Visible = true; } else { this.FieldArea.Text = "N/A"; this.LstRoad.Visible = false; this.selectedRoad = null; } } }
private void LstRoad_SelectedIndexChanged(object sender, EventArgs e) { RoadItem selectedItem = (RoadItem) this.LstRoad.SelectedItem; Road road = selectedItem.Object; if (this.roadLstIgnoreFlag) { this.roadIgnoreFlag = true; this.FieldRoad.Text = road.RoadName; this.FieldRoad.SelectAll(); this.roadIgnoreFlag = false; this.roadLstIgnoreFlag = false; } else { this.roadIgnoreFlag = true; this.FieldRoad.Text = road.RoadName; this.FieldOtherRoad.Text = string.Empty; this.FieldArea.Text = road.AreaName; this.selectedRoad = road; this.roadIgnoreFlag = false; this.LstRoad.Visible = false; } }