/// <summary> /// OrderView restore /// </summary> /// <param name="itemView"></param> public void Restore(OrderView original) { this.id = original.id; this.orderDate = original.orderDate; this.status = original.status; this.user = original.user; this.shippingAddress = original.shippingAddress; this.billingAddress = original.billingAddress; this.sameAddress = original.sameAddress; this.orderItemSet = original.orderItemSet; this.serialNumber = original.serialNumber; this.amount = original.amount; }
/// <summary> /// Clone /// </summary> /// <param name="itemView"></param> public OrderView(OrderView orderView) { this.id = orderView.id; this.orderDate = orderView.orderDate; this.status = orderView.status; this.user = orderView.user; this.shippingAddress = orderView.shippingAddress; this.billingAddress = orderView.billingAddress; this.sameAddress = orderView.sameAddress; this.orderItemSet = orderView.orderItemSet; this.serialNumber = orderView.serialNumber; this.amount = orderView.amount; }
/// <summary> /// 'Cancel' button is clicked /// </summary> public void CancelEdit() { Restore(cache); cache = null; }
/// <summary> /// 'Edit' button is clicked /// Due to binding, all UI changed will be mapped to the object, so we need make a copy of object before edit in case user wants to cancel the editing /// </summary> public void BeginEdit() { cache = new OrderView(this); }