public CustomIssueTicketAndShowMessageButtons getButtons(string bankId, string branchId, string screenId) { try { var authHeader = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; var svcCredentials = System.Text.ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(authHeader.Substring(6))).Split(':'); string bankName = svcCredentials[2]; BALButton bALButton = new BALButton(); CustomIssueTicketAndShowMessageButtons lstButtons = bALButton.selectIssueTicketAndShowMessageButtonsByBankName(bankName, Convert.ToInt32(branchId), Convert.ToInt32(screenId)); if (lstButtons == null) { ExceptionsWriter.saveEventsAndExceptions(new FaultException("Database Error"), "Exceptions not handled", EventLogEntryType.Error); } return(lstButtons); } catch (Exception ex) { ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error); return(null); } }
public IHttpActionResult get(int branchId, int screenId) { try { BALButton bALButton = new BALButton(); var identity = (ClaimsPrincipal)Thread.CurrentPrincipal; int bankId = Convert.ToInt32(identity.Claims.Where(c => c.Type == "BankId").Select(c => c.Value).SingleOrDefault()); CustomIssueTicketAndShowMessageButtons lstButtons = bALButton.selectIssueTicketAndShowMessageButtons(bankId, branchId, screenId); if (lstButtons == null) { return(Content(HttpStatusCode.InternalServerError, "Database Error")); } if (lstButtons.issueTicketButtons.Count == 0 && lstButtons.showMessageButtons.Count == 0) { return(Content(HttpStatusCode.NotFound, "Items not found")); } return(Ok(lstButtons)); } catch (Exception ex) { ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error); return(InternalServerError(ex)); } }