private void ReportViewer_Load(object sender, EventArgs e) { if (isReportViewerLoaded) return; var reportDataSource1 = new ReportDataSource(); var dataset = new SoldTickets(); dataset.BeginInit(); reportDataSource1.Name = "SoldTicketsDataSet"; reportDataSource1.Value = dataset.BrowseTickets; _reportViewer.LocalReport.DataSources.Add(reportDataSource1); _reportViewer.LocalReport.ReportEmbeddedResource = "Administration.Report.SoldTicketsReport.rdlc"; dataset.EndInit(); var connectionString = ConnectionStringBuilder.Build( Settings.Default.server, Settings.Default.database, Settings.Default.user, Settings.Default.password); var connection = new SqlConnection(connectionString); var adapter = new BrowseTicketsTableAdapter { ClearBeforeFill = true, Connection = connection }; adapter.Fill(dataset.BrowseTickets); _reportViewer.SetDisplayMode(DisplayMode.PrintLayout); _reportViewer.RefreshReport(); isReportViewerLoaded = true; }
public bool ReserveTickets(int idHall, int idFilm, DateTime date, Point lineSeat, string mail) { var session = getSession(idFilm, date); var soldTickets = from t in datacontext.GetTable <SoldTickets>() from o in datacontext.GetTable <Orders>() where o.SessionId == session.First().ID && t.OrderId == o.ID && t.Line == lineSeat.X && t.Seat == lineSeat.Y select t; if (soldTickets.Count() == 0) { var IdCustomer = (datacontext.GetTable <Customers>() .Where(c => c.EMail == mail) .Select(c => c.ID)).First(); var order = new Orders { Customer = IdCustomer, SessionId = session.First().ID }; datacontext.GetTable <Orders>().InsertOnSubmit(order); datacontext.SubmitChanges(); var order_forID = from o in datacontext.GetTable <Orders>().AsEnumerable() where o == order select o; int idOrder = order_forID.First().ID; var reserveTicket = new SoldTickets { Line = lineSeat.X, Seat = lineSeat.Y, OrderId = idOrder, Price = 20 }; datacontext.GetTable <SoldTickets>().InsertOnSubmit(reserveTicket); datacontext.SubmitChanges(); return(true); } return(false); }
static void Main(string[] args) { ServiceClient service = new ServiceClient(); Console.WriteLine(service.State.ToString()); //Console.WriteLine(service.some().ToString()); try { int i = service.Login("peretsv", "12345"); Console.WriteLine(i.ToString()); List <Point> points = service.GetSoldPlaces(1, new DateTime(2017, 05, 31, 18, 00, 00)).ToList(); Console.WriteLine(points[0].x.ToString() + " " + points[0].y.ToString()); SoldTickets soldTicket = service.getReserveByCode(1); Console.WriteLine(soldTicket.Seat.ToString()); service.ReserveTickets(1, 1, new DateTime(2017, 05, 31, 18, 00, 00), new Point { x = 2, y = 3 }, "peretsvs"); foreach (var t in service.GetSoldPlaces(1, new DateTime(2017, 05, 31, 18, 00, 00))) { Console.WriteLine($"{t.x} {t.y}"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Some text for commiting"); Console.WriteLine("Some more text for commiting from local repo and pull with github"); Console.WriteLine(service.ReserveTickets(1, 1, new DateTime(2017, 05, 31, 18, 00, 00), new Point { x = 8, y = 9 }, "*****@*****.**").ToString()); Console.WriteLine("Some more text for check commit from gitHub"); }
private void ReportViewer_Load(object sender, EventArgs e) { if (isReportViewerLoaded) { return; } var reportDataSource1 = new ReportDataSource(); var dataset = new SoldTickets(); dataset.BeginInit(); reportDataSource1.Name = "SoldTicketsDataSet"; reportDataSource1.Value = dataset.BrowseTickets; _reportViewer.LocalReport.DataSources.Add(reportDataSource1); _reportViewer.LocalReport.ReportEmbeddedResource = "Administration.Report.SoldTicketsReport.rdlc"; dataset.EndInit(); var connectionString = ConnectionStringBuilder.Build( Settings.Default.server, Settings.Default.database, Settings.Default.user, Settings.Default.password); var connection = new SqlConnection(connectionString); var adapter = new BrowseTicketsTableAdapter { ClearBeforeFill = true, Connection = connection }; adapter.Fill(dataset.BrowseTickets); _reportViewer.SetDisplayMode(DisplayMode.PrintLayout); _reportViewer.RefreshReport(); isReportViewerLoaded = true; }