private void AddUpdateDialog_Load(object sender, System.EventArgs e) { this.empCom = (Commission) this.Tag; this.idDisplay.Text = this.empCom.ID.ToString("d4"); this.nameETextBox.Text = this.empCom.Name; this.hireDateETextBox.Text = this.empCom.HireDate.ToString("MM/dd/yyyy"); this.salaryETextBox.Text = "0.00"; this.rateETextBox.Text = "0.00"; this.qtyETextBox.Text = "0"; }
/************************************************* * Add item click events * *************************************************/ //Commision Add Event private void commissionToolStripMenuItem_Click(object sender, EventArgs e) { int listIndex = 0; Commission empCom; AddUpdateCommissionDialog addDialog = new AddUpdateCommissionDialog(); empCom = new Commission(); empCom.ID = empList.AssignID(); addDialog.Text = "Add Commission Employee"; addDialog.Tag = empCom; if (addDialog.ShowDialog(this) == DialogResult.OK) { listIndex = ~this.empList.BinarySearch(empCom, listOrder); this.empList.InsertAt(listIndex, empCom); this.RefreshClientAreaControls(listIndex); } addDialog.Dispose(); }
//Copy constr public Commission(Commission sourceCommission) : base(sourceCommission) { this.Rate = sourceCommission.rate; this.Quantity = sourceCommission.quantity; this.Salary = sourceCommission.salary; }
//copy Method public void Copy(Commission sourceCommission) { base.Copy(sourceCommission); this.quantity = sourceCommission.quantity; this.salary = sourceCommission.salary; this.rate = sourceCommission.rate; }
public static Commission Parse(string stringValue) { string[] words; Commission commission = new Commission(); words = StringMethods.ParseCsvString(stringValue.Trim()); commission.ID = Int32.Parse(words[1]); commission.Name = words[2]; commission.HireDate = Date.Parse(words[3]); commission.Salary = Double.Parse(words[4]); commission.Rate = Double.Parse(words[5]); commission.Quantity = Int32.Parse(words[6]); return commission; }