public virtual void save() { var dao = new DAO(); if (dataState == eDataState.DS_NO_CHANGE && isDirty) { dataState = eDataState.DS_EDIT; } switch (dataState) { case eDataState.DS_ADD: object keyValue = insert(); //TODO: put keys as output parameters if ((keyValue is int && ((int)keyValue) > 0) || !(keyValue is int)) { foreach (String key in keys) { fieldMap[key] = keyValue; } // We are assuming 1 key for now -- need to think about this for multiple keys } OnRecordInserted(null); dataState = eDataState.DS_NO_CHANGE; //Change the data state to edit so we don't try to insert it again break; case eDataState.DS_EDIT: update(); OnRecordUpdated(null); break; case eDataState.DS_DELETE: delete(); OnRecordDeleted(null); break; case eDataState.DS_NO_CHANGE: /* Do Nothing */ break; } }
public void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { currentState = eDataState.raw; } if (Input.GetKeyDown(KeyCode.Alpha2)) { currentState = eDataState.normalized; } if (Input.GetKeyDown(KeyCode.Alpha3)) { currentState = eDataState.logten; } if (Input.GetKeyDown(KeyCode.Space)) { SaveJson(); } if (Input.GetKeyDown(KeyCode.LeftShift)) { LoadJson(); } }
public virtual void save() { var dao = new DAO(); if (dataState == eDataState.DS_NO_CHANGE && isDirty) dataState = eDataState.DS_EDIT; switch (dataState) { case eDataState.DS_ADD: object keyValue = insert(); //TODO: put keys as output parameters if (( keyValue is int && ( (int) keyValue ) > 0 ) || !( keyValue is int )) { foreach (String key in keys) fieldMap[key] = keyValue; // We are assuming 1 key for now -- need to think about this for multiple keys } OnRecordInserted( null ); dataState = eDataState.DS_NO_CHANGE; //Change the data state to edit so we don't try to insert it again break; case eDataState.DS_EDIT: update(); OnRecordUpdated( null ); break; case eDataState.DS_DELETE: delete(); OnRecordDeleted( null ); break; case eDataState.DS_NO_CHANGE: /* Do Nothing */ break; } }