/// <summary> /// Method to load the combobox with the service list /// </summary> private void InitializeForm() { cmboBox_Services.DataSource = Enum.GetNames(typeof(HomeClass.ServiceList)); //show the name and ID on the form txtBox_Name.Text = HomeClass.GetCustName(); txtBox_CustId.Text = HomeClass.GetCustId(); }
/// <summary> /// Method to populate the text box with selected cust info. /// </summary> private void InitializeAddServiceForm() { txtBox_CustId.Text = "Cust ID " + HomeClass.GetCustId(); string custID = HomeClass.GetCustId(); txtBox_CustName.Text = HomeClass.GetCustName(); double total = 0; double amount; //headers listView_ServiceList.View = View.Details; listView_ServiceList.Columns.Add("Date", 100); listView_ServiceList.Columns.Add("Service", 100); listView_ServiceList.Columns.Add("Cost", -2); //go through the customer service list, write info based on customerID selected foreach (string transaction in HomeClass.CustomerServicesList) { string[] transactionItems = transaction.Split(','); //match the custID from selected customer with ID from the list if (transactionItems[0] == custID) { string transactionDate = transactionItems[1].ToString(); string transactionType = transactionItems[2].ToString(); string cost = transactionItems[3].ToString(); //totaling the amount due double.TryParse(cost, out amount); total = total + amount; //adding the matching transactions to the listView (box) listView_ServiceList.Items.Add(new ListViewItem(new string[] { transactionDate, transactionType, cost })); } } //show the total due txtBox_AmountDue.Text = total.ToString(); }