public ResultsEnum insertCounter(Counter counter, int bankId) { try { string pquery = "sp_insertCounter"; List <SqlParameter> counterParams = new List <SqlParameter>(); counterParams.Add(new SqlParameter("@enName", counter.enName)); counterParams.Add(new SqlParameter("@arName", counter.arName)); counterParams.Add(new SqlParameter("@active", counter.active)); counterParams.Add(new SqlParameter("@type", counter.type)); counterParams.Add(new SqlParameter("@branchId", counter.branchId)); counterParams.Add(new SqlParameter("@bankId", bankId)); DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper(); int returnValue = Convert.ToInt32(dBHelper.executeScalarProc(pquery, counterParams)); if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed) { return(ResultsEnum.deleted); } else { return(ResultsEnum.inserted); } } catch (Exception ex) { ExceptionsWriter.saveExceptionToLogFile(ex); return(ResultsEnum.notInserted); } }
public ResultsEnum deleteCountersByBranchId(int branchId, int bankId) { try { string storedProc = string.Empty; storedProc = "sp_Delete_Allocate_Counter"; List <SqlParameter> branchParams = new List <SqlParameter>(); branchParams.Add(new SqlParameter("@branchId", branchId)); branchParams.Add(new SqlParameter("@bankId", bankId)); DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper(); int returnValue = Convert.ToInt32(dBHelper.executeScalarProc(storedProc, branchParams)); if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed) { return(ResultsEnum.notDeleted); } else { return(ResultsEnum.deleted); } } catch (Exception ex) { ExceptionsWriter.saveExceptionToLogFile(ex); return(ResultsEnum.notDeleted); } }
public sqlResultsEnum deleteCountersByBranchId(int branchId, int bankId) { try { string storedProc = string.Empty; storedProc = "sp_Delete_Allocate_Counter"; List <SqlParameter> branchParams = new List <SqlParameter>(); branchParams.Add(new SqlParameter("@branchId", branchId)); branchParams.Add(new SqlParameter("@bankId", bankId)); DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper(); int returnValue = Convert.ToInt32(dBHelper.executeScalarProc(storedProc, branchParams)); if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed) { return(sqlResultsEnum.failed); } else { return(sqlResultsEnum.success); } } catch (Exception ex) { ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error); return(sqlResultsEnum.failed); } }
public ResultsEnum insertAllocateCounterService(int serviceId, int counterId, int bankId) { try { string storedProc = "sp_insertAllocateCounterService"; List <SqlParameter> allocateParams = new List <SqlParameter>(); allocateParams.Add(new SqlParameter("@id", counterId)); allocateParams.Add(new SqlParameter("@serviceId", serviceId)); allocateParams.Add(new SqlParameter("@bankId", bankId)); DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper(); int returnValue = Convert.ToInt32(dBHelper.executeScalarProc(storedProc, allocateParams)); if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed) { return(ResultsEnum.deleted); } else { return(ResultsEnum.inserted); } } catch (Exception ex) { ExceptionsWriter.saveExceptionToLogFile(ex); return(ResultsEnum.notInserted); } }
public sqlResultsEnum deleteAllocateCounterServiceByCounterId(int counterId, int bankId) { try { string storedProc = string.Empty; storedProc = "sp_deleteAllocateCounterServiceByCounterId"; List <SqlParameter> counterParams = new List <SqlParameter>(); counterParams.Add(new SqlParameter("@counterId", counterId)); counterParams.Add(new SqlParameter("@bankId", bankId)); DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper(); int returnValue = Convert.ToInt32(dBHelper.executeScalarProc(storedProc, counterParams)); return((sqlResultsEnum)returnValue); } catch (Exception ex) { ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error); return(sqlResultsEnum.failed); } }