private bool SaveServiceChanges()
 {
     //RoughIn
     if (mRoughIn == null)
     {
         mRoughIn = new LotService(db, Lot.LotServices.RoughIn, mLot.GetLotID());
     }
     if (dpRoughCalledIn.Text.Length > 0)
     {
         mRoughIn.SetCalledIn(dpRoughCalledIn.SelectedDate);
     }
     else if (!isNew)
     {
         mRoughIn.ClearField(LotService.Fields.CalledIn.ToString());
     }
     if (dpRoughPassed.Text.Length > 0)
     {
         mRoughIn.SetPassed(dpRoughPassed.SelectedDate);
     }
     else if (!isNew)
     {
         mRoughIn.ClearField(LotService.Fields.Passed.ToString());
     }
     if (dpRoughBilled.Text.Length > 0)
     {
         mRoughIn.SetBilled(dpRoughBilled.SelectedDate);
     }
     else if (!isNew)
     {
         mRoughIn.ClearField(LotService.Fields.Billed.ToString());
     }
     if (txtRoughAmount.Amount > 0)
     {
         try
         {
             mRoughIn.SetAmount(txtRoughAmount.Amount);
         }
         catch (Exception)
         {
             MessageBox.Show("Rough In Amount is formatted incorrectly. Please review. Numbers with a single decimal only.", "Formatting Error", MessageBoxButton.OK, MessageBoxImage.Error);
             return false;
         }
     }
     else if (!isNew)
     {
         mRoughIn.ClearField(LotService.Fields.Amount.ToString());
     }
     if (txtRoughNotes.Text.Length > 0)
     {
         mRoughIn.SetNotes(txtRoughNotes.Text);
     }
     else if (!isNew)
     {
         mRoughIn.ClearField(LotService.Fields.Notes.ToString());
     }
     //Service
     if (mService == null)
     {
         mService = new LotService(db, Lot.LotServices.Service, mLot.GetLotID());
     }
     if (dpServiceCalledIn.Text.Length > 0)
     {
         mService.SetCalledIn(dpServiceCalledIn.SelectedDate);
     }
     else if (!isNew)
     {
         mService.ClearField(LotService.Fields.CalledIn.ToString());
     }
     if (dpServicePassed.Text.Length > 0)
     {
         mService.SetPassed(dpServicePassed.SelectedDate);
     }
     else if (!isNew)
     {
         mService.ClearField(LotService.Fields.Passed.ToString());
     }
     if (dpServiceBilled.Text.Length > 0)
     {
         mService.SetBilled(dpServiceBilled.SelectedDate);
     }
     else if (!isNew)
     {
         mService.ClearField(LotService.Fields.Billed.ToString());
     }
     if (txtServiceAmount.Amount > 0)
     {
         try
         {
             mService.SetAmount(txtServiceAmount.Amount);
         }
         catch (Exception)
         {
             MessageBox.Show("Service Amount is formatted incorrectly. Please review. Numbers with a single decimal only.", "Formatting Error", MessageBoxButton.OK, MessageBoxImage.Error);
             return false;
         }
     }
     else if (!isNew)
     {
         mService.ClearField(LotService.Fields.Amount.ToString());
     }
     if (txtServiceNotes.Text.Length > 0)
     {
         mService.SetNotes(txtServiceNotes.Text);
     }
     else if (!isNew)
     {
         mService.ClearField(LotService.Fields.Notes.ToString());
     }
     //Final
     if (mFinal == null)
     {
         mFinal = new LotService(db, Lot.LotServices.Final, mLot.GetLotID());
     }
     if (dpFinalCalledIn.Text.Length > 0)
     {
         mFinal.SetCalledIn(dpFinalCalledIn.SelectedDate);
     }
     else if (!isNew)
     {
         mFinal.ClearField(LotService.Fields.CalledIn.ToString());
     }
     if (dpFinalPassed.Text.Length > 0)
     {
         mFinal.SetPassed(dpFinalPassed.SelectedDate);
     }
     else if (!isNew)
     {
         mFinal.ClearField(LotService.Fields.Passed.ToString());
     }
     if (dpFinalBilled.Text.Length > 0)
     {
         mFinal.SetBilled(dpFinalBilled.SelectedDate);
     }
     else if (!isNew)
     {
         mFinal.ClearField(LotService.Fields.Billed.ToString());
     }
     if (txtFinalAmount.Amount > 0)
     {
         try
         {
             mFinal.SetAmount(txtFinalAmount.Amount);
         }
         catch (Exception)
         {
             MessageBox.Show("Service Amount is formatted incorrectly. Please review. Numbers with a single decimal only.", "Formatting Error", MessageBoxButton.OK, MessageBoxImage.Error);
             return false;
         }
     }
     else if (!isNew)
     {
         mFinal.ClearField(LotService.Fields.Amount.ToString());
     }
     if (txtFinalNotes.Text.Length > 0)
     {
         mFinal.SetNotes(txtFinalNotes.Text);
     }
     else if (!isNew)
     {
         mFinal.ClearField(LotService.Fields.Notes.ToString());
     }
     return true;
 }
        private void populateFields()
        {
            txtAddress.Text = mLot.GetAddress();
            txtCity.Text = mLot.GetCity();
            txtHoodColour.Text = mLot.GetHoodColour();
            txtNotes.Text = mLot.GetNotes();
            txtPlanInfo.Text = mLot.GetPlanInfo();
            txtSPColour.Text = mLot.GetSPColour();
            txtSPType.Text = mLot.GetSPType();
            txtType.Text = mLot.GetLotType();
            txtJobTotal.Amount = mLot.GetJobTotal();

            txtBlockNumber.Text = ((mLot.GetBlockNumber() == 0) ? "" : "" + mLot.GetBlockNumber());
            txtServiceSize.Text = ((mLot.GetServiceSize() == 0) ? "" : "" + mLot.GetServiceSize());
            txtPermitNumber.Text = ((mLot.GetPermitNumber() == 0) ? "" : "" + mLot.GetPermitNumber());
            txtLotNumber.Text = ((mLot.GetLotNumber() == 0) ? "" : "" + mLot.GetLotNumber());
            txtLotSize.Text = ((mLot.GetLotSize() == 0) ? "" : "" + mLot.GetLotSize());

            dpClosedDate.Text = ((mLot.GetClosedDate().Equals(DateTime.MinValue)) ? "" : mLot.GetClosedDate().ToShortDateString());
            dpJobBC.Text = ((mLot.getJobBC().Equals(DateTime.MinValue)) ? "" : mLot.getJobBC().ToShortDateString());
            dpPermitDate.Text = ((mLot.GetPermitDate().Equals(DateTime.MinValue)) ? "" : mLot.GetPermitDate().ToShortDateString());

            cmboCompleted.SelectedIndex = mLot.IsCompleted() ? 1 : 0;

            //Load the Services
            //Rough In
            LotService service = mLot.GetLotService(db, Lot.LotServices.RoughIn);
            if (service != null)
            {
                mRoughIn = service;
                dpRoughCalledIn.Text = ((service.GetCalledIn().Equals(DateTime.MinValue)) ? "" : service.GetCalledIn().ToShortDateString());
                dpRoughPassed.Text = ((service.GetPassed().Equals(DateTime.MinValue)) ? "" : service.GetPassed().ToShortDateString());
                dpRoughBilled.Text = ((service.GetBilled().Equals(DateTime.MinValue)) ? "" : service.GetBilled().ToShortDateString());
                txtRoughAmount.Amount = service.GetAmount();
                txtRoughNotes.Text = service.GetNotes();
            }
            //Service
            service = mLot.GetLotService(db, Lot.LotServices.Service);
            if (service != null)
            {
                mService = service;
                dpServiceCalledIn.Text = ((service.GetCalledIn().Equals(DateTime.MinValue)) ? "" : service.GetCalledIn().ToShortDateString());
                dpServicePassed.Text = ((service.GetPassed().Equals(DateTime.MinValue)) ? "" : service.GetPassed().ToShortDateString());
                dpServiceBilled.Text = ((service.GetBilled().Equals(DateTime.MinValue)) ? "" : service.GetBilled().ToShortDateString());
                txtServiceAmount.Amount = service.GetAmount();
                txtServiceNotes.Text = service.GetNotes();
            }
            //Service
            service = mLot.GetLotService(db, Lot.LotServices.Final);
            if (service != null)
            {
                mFinal = service;
                dpFinalCalledIn.Text = ((service.GetCalledIn().Equals(DateTime.MinValue)) ? "" : service.GetCalledIn().ToShortDateString());
                dpFinalPassed.Text = ((service.GetPassed().Equals(DateTime.MinValue)) ? "" : service.GetPassed().ToShortDateString());
                dpFinalBilled.Text = ((service.GetBilled().Equals(DateTime.MinValue)) ? "" : service.GetBilled().ToShortDateString());
                txtFinalAmount.Amount = service.GetAmount();
                txtFinalNotes.Text = service.GetNotes();
            }
        }