public ActionResult _Buy(TicketInformation ticketInformation, int id) { if (ModelState.IsValid) { var ticketsAvailable = db.Events.Where(e => e.Id == id).Select(e => e.Quantity).FirstOrDefault(); if (ticketsAvailable > 0 && ticketsAvailable >= ticketInformation.Quantity) { Ticket tickets = new Ticket(); tickets.UserId = User.Identity.GetUserId(); tickets.EventId = id; tickets.Quantity = ticketInformation.Quantity; tickets.Time = DateTime.Now.ToString(); var model = db.Events.Find(id); model.Quantity = ticketsAvailable - ticketInformation.Quantity; db.Tickets.Add(tickets); db.SaveChanges(); } else { Console.Write("Not enough tickets available"); } db.TicketsInformation.Add(ticketInformation); db.SaveChanges(); } return(RedirectToAction("Index", db.TicketsInformation.ToList())); }
public async Task <bool> OrderTicket(TicketInformation ticketInformation) { _logger.Log(LogLevel.Information, "OrderTicket"); bool isSuccess = await _ticketService.OrderTicket(ticketInformation); return(isSuccess); }
public async Task <bool> OrderTicket(TicketInformation ticketInformation) { var client = _httpClientFactory.CreateClient(); HttpResponseMessage response = await client.PostAsync( $"{_ticketServiceConfiguration.Endpoint}/PurchaseTicket", new StringContent(string.Empty)); return(response.IsSuccessStatusCode); }
public RebaseResult RebaseTicket(TicketInformation ticket) { var rebaseResult = new RebaseResult(); var pullRequest = GetPullRequestById(ticket.PullRequestId); if (pullRequest.id != null) { return(AttemptRebase(pullRequest.source.branch.name, pullRequest.destination.branch.name)); } Log.Debug("Pull request for ticket: {Key} could not be found.", ticket.JiraKey); rebaseResult.Status = RebaseStatus.FailedToFindPullRequest; return(rebaseResult); }
private void BtnLogin_Click(object sender, EventArgs e) { ////////////// try { connectionstring = (@"Data Source=isys4363.walton.uark.edu;Initial Catalog=TicketingSystem;User ID=isys4363a;Password=GohogsUA20"); var cmd1 = "SELECT * FROM Login WHERE UserID= '" + txtUsername.Text.Trim() + "' and Password = '******' and UserType = '" + User_Type_cmbox.SelectedItem.ToString() + "'"; //Data Source=essql1.walton.uark.edu;Initial Catalog=PROJECTS2050;User ID=PROJECTS2050;Password=MV05sts$ //SqlDataAdapter SDA = new SqlDataAdapter(Authentication, connection); } catch { MessageBox.Show("Please fill out all fields"); } //DataTable Logintbl = new DataTable(); //SDA.Fill(Logintbl); connectionstring = (@"Data Source=isys4363.walton.uark.edu;Initial Catalog=TicketingSystem;User ID=isys4363a;Password=GohogsUA20"); var cmd = "SELECT * FROM Login WHERE UserID= '" + txtUsername.Text.Trim() + "' and Password = '******' and UserType = '" + User_Type_cmbox.SelectedItem.ToString() + "'"; connection = new SqlConnection(connectionstring); connection.Open(); var dataadapter = new SqlDataAdapter(cmd, connection); var ds = new DataSet(); dataadapter.Fill(ds); connection.Close(); DataTable dt = new DataTable(); if ((ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0) && (txtUsername.Text != "") && (txtPassword.Text != "") && (User_Type_cmbox.SelectedIndex > -1)) { Form Admin = new TicketInformation(); Form Supervisor = new TicketQueue(); Form User = new Submit_Ticket(); MessageBox.Show("Login Successful"); this.Hide(); if (User_Type_cmbox.SelectedIndex == 0)//Admin { Admin.Show(); } else { if (User_Type_cmbox.SelectedIndex == 1)//STAFF { LoginIDInfo2 = LoginIDtxt.Text; User.Show(); } else { if (User_Type_cmbox.SelectedIndex == 2)//STUDENT { LoginIDInfo2 = LoginIDtxt.Text; User.Show(); } else { if (User_Type_cmbox.SelectedIndex == 3)//Supervisor { Supervisor.Show(); } else { MessageBox.Show("Please Choose Status"); } } } } } else { MessageBox.Show("Authentication not complete.", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error); } }