private void SavePriceChanges() { CustomerAdapter = new customersTableAdapter(); customersDataTable customerDT = CustomerAdapter.GetCustomerDataByID(CustomerID); customersRow cRow = (customersRow)customerDT.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); cRow.stdHourlyPrice = _price; } if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); cRow.stdOvertime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); cRow.stdOvertime2 = _overtime2; } CustomerAdapter.Update(customerDT); CustomerAdapter.Dispose(); ActivitiesAdapter = new activitiesTableAdapter(); activitiesDataTable ActivitiesTable; activitiesRow row; foreach (TreeNode Parent in treeViewHourlyRate.Nodes) { if (Parent.Checked == true) { ActivitiesTable = ActivitiesAdapter.GetActivityPriceDataByID((int)Parent.Tag); row = (activitiesRow)ActivitiesTable.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); row.price = _price; } if (!string.IsNullOrWhiteSpace(txtNewOvertime1.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); row.overtime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewOvertime2.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); row.overtime2 = _overtime2; } ActivitiesAdapter.Update(ActivitiesTable); ActivitiesAdapter.Dispose(); } foreach (TreeNode child in Parent.Nodes) { if (child.Checked == true) { ActivitiesTable = ActivitiesAdapter.GetActivityPriceDataByID((int)child.Tag); row = (activitiesRow)ActivitiesTable.Rows[0]; if (!string.IsNullOrWhiteSpace(txtNewPrice.Text)) { float.TryParse(txtNewPrice.Text, out _price); row.price = _price; } if (!string.IsNullOrWhiteSpace(txtNewOvertime1.Text)) { float.TryParse(txtNewOvertime1.Text, out _overtime1); row.overtime1 = _overtime1; } if (!string.IsNullOrWhiteSpace(txtNewOvertime2.Text)) { float.TryParse(txtNewOvertime2.Text, out _overtime2); row.overtime2 = _overtime2; } ActivitiesAdapter.Update(ActivitiesTable); ActivitiesAdapter.Dispose(); } } } }
public customersRowChangeEvent(customersRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }