public TicketsList SelectItems() { TicketsList list = new TicketsList(); using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand(selectCommandStr, connection)) { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Tickets item = new Tickets(); item.ID = Convert.ToInt32(reader["ID"]); item.MovieName = Convert.ToString(reader["MovieName"]); item.Date = Convert.ToDateTime(reader["Date"]); item.Duration = Convert.ToString(reader["Duration"]); item.Price = Convert.ToDecimal(reader["Price"]); item.Quantity = Convert.ToInt32(reader["Quantity"]); list.Add(item); } } } return(list); }
public ActionResult ExpertIndex(SortViewModel sortModel) { if (!isLoggedIn()) { return(RedirectToAction("Login", "Account")); } if (!isExpert()) { return(RedirectToAction("UserIndex")); } IEnumerable <Ticket> modelTickets; IEnumerable <Ticket> tickets = _dbContext.Ticket.ToList(); ApplicationUser user = getUser(); modelTickets = from ticket in tickets from attached in _dbContext.AttachedUsers.ToList() where ticket.ID == attached.TicketID && user.Id == attached.UserID select ticket; TicketsList model = new TicketsList(); model.Tickets = sort(sortModel, modelTickets); model.IsMe = false; return(View(model)); }
public ActionResult UserIndex() { if (!isLoggedIn()) { return(RedirectToAction("Login", "Account")); } IEnumerable <Ticket> modelTickets; IEnumerable <Ticket> tickets = _dbContext.Ticket.ToList(); ApplicationUser user = getUser(); modelTickets = from ticket in tickets where ticket.CreatedBy == user.Id select ticket; TicketsList model = new TicketsList(); model.Tickets = modelTickets; model.IsMe = true; return(View(model)); }
private IEnumerable <TicketsList> CreateTicketsList(IList <IWebElement> grid) { List <TicketsList> list = new List <TicketsList>(); foreach (var row in grid) { DateTime _date; Assert.True( DateTime.TryParseExact(row.FindElement(By.CssSelector(TicketsListDate)).Text, "dd.MM.yyyy, HH:mm", null, DateTimeStyles.None, out _date), "Unable to parse ticket date"); var dic = new TicketsList { Title = row.FindElement(By.CssSelector(TicketsListTitle)).Text, LastMessage = row.FindElement(By.CssSelector(TicketsListMessage)).Text, From = row.FindElement(By.CssSelector(TicketsListFrom)).Text, Date = _date }; list.Add(dic); } return(list); }