Beispiel #1
0
 public ResultsEnum deleteCounterById(int counterId, int bankId, int branchId)
 {
     try
     {
         string storedProc = string.Empty;
         storedProc = "delete from tblCounters OUTPUT DELETED.IDENTITYCOL where id = @id and branchId = @branchId and bankId = @bankId";
         List <SqlParameter> counterParams = new List <SqlParameter>();
         counterParams.Add(new SqlParameter("@id", counterId));
         counterParams.Add(new SqlParameter("@bankId", bankId));
         counterParams.Add(new SqlParameter("@branchId", branchId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(storedProc, counterParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.notDeleted);
         }
         else
         {
             return(ResultsEnum.deleted);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notDeleted);
     }
 }
Beispiel #2
0
 public ResultsEnum updateCounter(Counter counter, int bankId)
 {
     try
     {
         string storedProc = "update tblCounters set enName = @enName,arName = @arName,active = @active,type = @type OUTPUT INSERTED.IDENTITYCOL where id = @id and bankId = @bankId";
         List <SqlParameter> counterParams = new List <SqlParameter>();
         counterParams.Add(new SqlParameter("@id", counter.id));
         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.executeScalar(storedProc, counterParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.deleted);
         }
         else
         {
             return(ResultsEnum.updated);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notUpdated);
     }
 }
Beispiel #3
0
 public ResultsEnum updateBranch(Branch branch)
 {
     try
     {
         string storedProc = "update tblBranches set enName = @enName,arName = @arName,active = @active OUTPUT INSERTED.IDENTITYCOL where id = @id and bankId = @bankId";
         List <SqlParameter> branchParams = new List <SqlParameter>();
         branchParams.Add(new SqlParameter("@id", branch.id));
         branchParams.Add(new SqlParameter("@enName", branch.enName));
         branchParams.Add(new SqlParameter("@arName", branch.arName));
         branchParams.Add(new SqlParameter("@active", branch.active));
         branchParams.Add(new SqlParameter("@bankId", branch.bankId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(storedProc, branchParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.notFound);
         }
         else
         {
             return(ResultsEnum.updated);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(ResultsEnum.notUpdated);
     }
 }
Beispiel #4
0
 public sqlResultsEnum deleteBranchById(int branchId, int bankId)
 {
     try
     {
         string storedProc = string.Empty;
         storedProc = "delete from tblBranches OUTPUT DELETED.IDENTITYCOL where id = @id and bankId = @bankId";
         List <SqlParameter> branchParams = new List <SqlParameter>();
         branchParams.Add(new SqlParameter("@id", branchId));
         branchParams.Add(new SqlParameter("@bankId", bankId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(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);
     }
 }
Beispiel #5
0
 public ResultsEnum updateService(Service service)
 {
     try
     {
         string storedProc = "update tblservice set enName = @enName,arName = @arName,active = @active,maxNumOfTickets = @maxNumOfTickets OUTPUT INSERTED.IDENTITYCOL where id = @id and bankId = @bankId";
         List <SqlParameter> serviceParams = new List <SqlParameter>();
         serviceParams.Add(new SqlParameter("@id", service.id));
         serviceParams.Add(new SqlParameter("@enName", service.enName));
         serviceParams.Add(new SqlParameter("@arName", service.arName));
         serviceParams.Add(new SqlParameter("@active", service.active));
         serviceParams.Add(new SqlParameter("@maxNumOfTickets", service.maxNumOfTickets));
         serviceParams.Add(new SqlParameter("@bankId", service.bankId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(storedProc, serviceParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.deleted);
         }
         else
         {
             return(ResultsEnum.updated);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notUpdated);
     }
 }
Beispiel #6
0
 public ResultsEnum insertBranch(Branch branch)
 {
     try
     {
         string storedProc = "insert into tblBranches OUTPUT INSERTED.IDENTITYCOL  values (@enName,@arName,@active,@bankId)";
         List <SqlParameter> branchParams = new List <SqlParameter>();
         branchParams.Add(new SqlParameter("@enName", branch.enName));
         branchParams.Add(new SqlParameter("@arName", branch.arName));
         branchParams.Add(new SqlParameter("@active", branch.active));
         branchParams.Add(new SqlParameter("@bankId", branch.bankId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(storedProc, branchParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.deleted);
         }
         else
         {
             return(ResultsEnum.inserted);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notInserted);
     }
 }
Beispiel #7
0
 public ResultsEnum insertService(Service service)
 {
     try
     {
         string pquery = "insert into tblService OUTPUT INSERTED.IDENTITYCOL  values (@enName,@arName,@bankId,@active,@maxNumOfTickets)";
         List <SqlParameter> serviceParams = new List <SqlParameter>();
         serviceParams.Add(new SqlParameter("@enName", service.enName));
         serviceParams.Add(new SqlParameter("@arName", service.arName));
         serviceParams.Add(new SqlParameter("@bankId", service.bankId));
         serviceParams.Add(new SqlParameter("@active", service.active));
         serviceParams.Add(new SqlParameter("@maxNumOfTickets", service.maxNumOfTickets));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         int returnValue = Convert.ToInt32(dBHelper.executeScalar(pquery, serviceParams));
         if ((sqlResultsEnum)returnValue == sqlResultsEnum.failed)
         {
             return(ResultsEnum.deleted);
         }
         else
         {
             return(ResultsEnum.inserted);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notInserted);
     }
 }
Beispiel #8
0
 public void updateActiveScreen(int pScreenId)
 {
     try
     {
         string pquery = "update tblScreens set isActive = 0 where id != @id";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@id", pScreenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         dBHelper.executeScalar(pquery, screenParams);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
     }
 }
Beispiel #9
0
 public void updateActiveScreen(int pScreenId)
 {
     try
     {
         string pquery = "update tblScreens set isActive = 0 where id != @id";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@id", pScreenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         dBHelper.executeScalar(pquery, screenParams);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
     }
 }
Beispiel #10
0
 public BusinessObjects.Models.Bank insertBank(BusinessObjects.Models.Bank pBank)
 {
     try
     {
         string pquery = "insert into tblBanks OUTPUT INSERTED.IDENTITYCOL  values (@name)";
         List <SqlParameter> bankParams = new List <SqlParameter>();
         bankParams.Add(new SqlParameter("@name", pBank.name));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         pBank.id = Convert.ToInt32(dBHelper.executeScalar(pquery, bankParams));
         return(pBank);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(null);
     }
 }
Beispiel #11
0
 public bool checkIfButtonIsDeleted(int pButtonId, BusinessObjects.Models.btnType btnType)
 {
     try
     {
         string pquery = String.Format("select * from tbl{0}Button where id = @id", btnType.ToString());
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@id", pButtonId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         var rowEffected = dBHelper.executeScalar(pquery, screenParams);
         return(rowEffected != null ? true : false);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(false);
     }
 }
Beispiel #12
0
 public bool checkIfScreenIsDeleted(int pScreenId)
 {
     try
     {
         string pquery = "select * from tblScreens where id = @id";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@id", pScreenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         var rowEffected = dBHelper.executeScalar(pquery, screenParams);
         return(rowEffected == null ? true : false);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(false);
     }
 }
Beispiel #13
0
 public bool checkIfScreenIsBusy(int pScreenId)
 {
     try
     {
         string pquery = "select * from tblScreens where id = @id and isBusy = 1";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@id", pScreenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         var rowEffected = dBHelper.executeScalar(pquery, screenParams);
         return(rowEffected == null ? false : true);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(false);
     }
 }
Beispiel #14
0
 public ResultsEnum deleteAllocateCounterServiceByCounterId(int counterId, int bankId)
 {
     try
     {
         string storedProc = string.Empty;
         storedProc = "delete from tblAllocateCounterService OUTPUT DELETED.IDENTITYCOL where counterId = @counterId and bankId = @bankId";
         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.executeScalar(storedProc, counterParams));
         return(ResultsEnum.deleted);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(ResultsEnum.notDeleted);
     }
 }
Beispiel #15
0
 public BusinessObjects.Models.IssueTicketButton insertIssueTicketButton(BusinessObjects.Models.IssueTicketButton pButton)
 {
     try
     {
         string pquery = "insert into tblIssueTicketButton OUTPUT INSERTED.IDENTITYCOL  values (@enName,@arName,@serviceId,@screenId,0)";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@enName", pButton.enName));
         screenParams.Add(new SqlParameter("@arName", pButton.arName));
         screenParams.Add(new SqlParameter("@serviceId", pButton.serviceId));
         screenParams.Add(new SqlParameter("@screenId", pButton.screenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         pButton.id = Convert.ToInt32(dBHelper.executeScalar(pquery, screenParams));
         return(pButton);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(null);
     }
 }
Beispiel #16
0
 public BusinessObjects.Models.ShowMessageButton insertShowMessageButton(BusinessObjects.Models.ShowMessageButton pButton)
 {
     try
     {
         string pquery = "insert into tblShowMessageButton OUTPUT INSERTED.IDENTITYCOL  values (@enName,@arName,@messageEN,@messageAR,@screenId,0)";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@enName", pButton.enName));
         screenParams.Add(new SqlParameter("@arName", pButton.arName));
         screenParams.Add(new SqlParameter("@messageEN", pButton.messageEN));
         screenParams.Add(new SqlParameter("@messageAR", pButton.messageAR));
         screenParams.Add(new SqlParameter("@screenId", pButton.screenId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         pButton.id = Convert.ToInt32(dBHelper.executeScalar(pquery, screenParams));
         return(pButton);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(null);
     }
 }
Beispiel #17
0
 public BusinessObjects.Models.Screen insertScreen(BusinessObjects.Models.Screen pScreen)
 {
     try
     {
         string pquery = "insert into tblScreens OUTPUT INSERTED.IDENTITYCOL  values (@name,@isActive,@bankId,0)";
         List <SqlParameter> screenParams = new List <SqlParameter>();
         screenParams.Add(new SqlParameter("@name", pScreen.name));
         screenParams.Add(new SqlParameter("@isActive", pScreen.isActive));
         screenParams.Add(new SqlParameter("@bankId", pScreen.bankId));
         DALDBHelper.DALDBHelper dBHelper = new DALDBHelper.DALDBHelper();
         pScreen.id = Convert.ToInt32(dBHelper.executeScalar(pquery, screenParams));
         if (pScreen.isActive)
         {
             updateActiveScreen(pScreen.id);
         }
         return(pScreen);
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(null);
     }
 }