private void AddUpdatePieceDialog_Load(object sender, EventArgs e) { this.empPiece = (Piece)this.Tag; this.idDisplay.Text = this.empPiece.ID.ToString("d4"); this.nameETextBox.Text = this.empPiece.Name; this.hireDateETextBox.Text = this.empPiece.HireDate.ToString("MM/dd/yyyy"); this.rateETextBox.Text = "0.00"; this.qtyETextBox.Text = "0"; }
// END hourly add event // Piece Add Event private void pieceToolStripMenuItem_Click(object sender, EventArgs e) { int listIndex = 0; Piece empPiece; empPiece = new Piece(); AddUpdatePieceDialog addDialog = new AddUpdatePieceDialog(); empPiece.ID = empList.AssignID(); addDialog.Text = "Add Piece Employee"; addDialog.Tag = empPiece; if (addDialog.ShowDialog(this) == DialogResult.OK) { listIndex = ~this.empList.BinarySearch(empPiece, listOrder); this.empList.InsertAt(listIndex, empPiece); this.RefreshClientAreaControls(listIndex); } addDialog.Dispose(); }
//copy Method public void Copy(Piece sourcePiece) { base.Copy(sourcePiece); this.quantity = sourcePiece.quantity; this.rate = sourcePiece.rate; }
public static Piece Parse(string stringValue) { string[] words; Piece piece = new Piece(); words = StringMethods.ParseCsvString(stringValue.Trim()); piece.ID = Int32.Parse(words[1]); piece.Name = words[2]; piece.HireDate = Date.Parse(words[3]); piece.Rate = Double.Parse(words[4]); piece.Quantity = Int32.Parse(words[5]); return piece; }
//Copy constr public Piece(Piece sourcePiece) : base(sourcePiece) { this.Rate = sourcePiece.rate; this.Quantity = sourcePiece.quantity; }