public UpdateTimeResponse UpdateTimeSetting(UpdateTimeRequest request) { var response = new UpdateTimeResponse { ResponseStatus = ResponseStatus.Success }; var settingsProvider = new SettingsProvider(); try { if (request.ActionType == ActionType.Update) { response.isSuccessful = settingsProvider.UpdateTime(request); } else { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = "Not update action"; } } catch (Exception ex) { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = ex.Message; } return(response); }
public bool UpdateTime(UpdateTimeRequest request) { var conn = GetConnection(ConnectionNames.CSPSqlDatabase); var commandWrapper = GetStoredProcCommand("dbo.Update_Time", conn); AddInParameter(commandWrapper, "@TimeDescription", DbType.String, request.Time.TimeDescription); AddInParameter(commandWrapper, "@TimeId", DbType.Int16, request.Time.TimeId); AddInParameter(commandWrapper, "@Value", DbType.Int16, request.Time.Value); AddInParameter(commandWrapper, "@ERROR", DbType.String, 1000); AddInParameter(commandWrapper, "@ERROR_CODE", DbType.String, 4); try { conn.Open(); int results = commandWrapper.ExecuteNonQuery(); var isProcedureSucced = Convert.ToBoolean(results); MakeDboLog(request.ToString(), isProcedureSucced.ToString(), "dbo.Update_Time"); var errorObject = GetParameterValue(commandWrapper, "@ERROR"); var errorCodeObject = GetParameterValue(commandWrapper, "@ERROR_CODE"); return(Convert.ToBoolean(results)); } finally { commandWrapper.Dispose(); conn.Close(); } }
public UpdateTimeRequest GetUpdateTimeRequest(Time time) { var request = new UpdateTimeRequest() { Time = time, ActionType = Requests.ActionType.Update }; return(request); }