private void btnEdit_Click(object sender, EventArgs e) { clsMobilePhone phone = phoneLot.GetPhoneCurrentlyDisplayed(); if (phone is clsAndroidPhone) { // edit android phone frmAdd editAndroid = new frmAdd((clsAndroidPhone)phone); DialogResult dr = editAndroid.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { phoneLot.EditPhone(editAndroid.AndroidPhoneDetails); DisplayPhone(); } } else { // edit apple phone frmAdd ediApple = new frmAdd((clsApplePhone)phone); DialogResult dr = ediApple.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { phoneLot.EditPhone(ediApple.ApplePhoneDetails); DisplayPhone(); } } }
private void btnAdd_Click(object sender, EventArgs e) { clsAndroidPhone androidPhone = new clsAndroidPhone("", "", "Android", DateTime.Now, 0, clsMobilePhone.Condition.good); frmAdd addAndroid = new frmAdd(androidPhone); DialogResult dr = addAndroid.ShowDialog(); if (dr == DialogResult.OK) { phoneLot.AddPhone(addAndroid.AndroidPhoneDetails); DisplayPhone(); } }