private void UpdateState(StateFullEditable source, StateDetailModel target)
 {
     target.ID_ENT        = Entity.ID_ENT; // musi byt lockle pro edit
     target.Comments      = source.Comments;
     target.L_END_STATE   = source.L_END_STATE;
     target.L_START_STATE = source.L_START_STATE;
     target.L_VALID       = source.L_VALID;
     target.Purpous       = source.Purpous;
 }
 private void CopyState(StateDetailModel source, StateFullEditable target)
 {
     if (isEditMode)
     {
         target.NAME_ENT      = source.ENT_Entity.NAME_ENT;
         target.ID_ENT        = source.ID_ENT;
         target.Comments      = source.Comments;
         target.L_END_STATE   = source.L_END_STATE;
         target.L_START_STATE = source.L_START_STATE;
         target.L_VALID       = source.L_VALID;
         target.Purpous       = source.Purpous;
     }
 }
        public void SetState(StateDetailModel p_State)
        {
            if (p_State == null)
            {
                isEditMode = false;
                p_State    = new MES_2.Modules.SystemModule.State.StateDetailModel();
                EntityAll  = new ObservableCollection <EntityModel>(EntitiesRepository.Instance.Retrieve());
            }
            else
            {
                Entity = new EntityModel();
                Entity = MapperEntity.MapENTToMapperEntity(p_State.ENT_Entity);
            }

            EdditingState = p_State;
            if (State != null)
            {
                State.ErrorsChanged -= RaiseCanExecuteChanged;
            }
            State = new StateFullEditable();
            State.ErrorsChanged += RaiseCanExecuteChanged;
            CopyState(_edditingState, State);
        }