/// <summary> /// This method updates an expenditureAuthorization from db /// </summary> /// <param name="originalExpenditureAuthorization"></param> /// <param name="expenditureAuthorization"></param> private void UpdateExpenditureAuthorization(ExpenditureAuthorization originalExpenditureAuthorization, ExpenditureAuthorization expenditureAuthorization) { originalExpenditureAuthorization.CopyPropertiesFrom(expenditureAuthorization); DbContext.SubmitChanges(); }
/// <summary> /// This method inserts a new expenditureAuthorization in db /// </summary> /// <param name="ExpenditureAuthorization"></param> private void InsertExpenditureAuthorization(ExpenditureAuthorization expenditureAuthorization) { DbContext.ExpenditureAuthorizations.InsertOnSubmit(expenditureAuthorization); DbContext.SubmitChanges(); }
/// <summary> /// This method saves the expenditureAuthorization, for insert or update /// </summary> /// <param name="expenditureAuthorization"></param> public void SaveExpenditureAuthorization(ExpenditureAuthorization expenditureAuthorization) { // //Insert // if (expenditureAuthorization.ExpenditureAuthorizationId == 0) { InsertExpenditureAuthorization(expenditureAuthorization); return; } // // Update // var originalExpenditureAuthorization = GetExpenditureAuthorization(expenditureAuthorization.ExpenditureAuthorizationId); UpdateExpenditureAuthorization(originalExpenditureAuthorization, expenditureAuthorization); }
/// <summary> /// This method updates the "IsDenied" information in specified expenditureAuthorization from db /// </summary> /// <param name="expenditureAuthorization">Connected expenditureAuthorization object to db </param> /// <param name="status">true for denied or false for authorized</param> public void SetAuthorizationStatusInExpenditure(ExpenditureAuthorization expenditureAuthorization, bool status) { expenditureAuthorization.IsDenied = status; DbContext.SubmitChanges(); }