public ActionResult Details(int id) { DataClasses1DataContext db = new DataClasses1DataContext(); OrderAndServies orderservies = new OrderAndServies(); List <ListServiesModif> listServies = new List <ListServiesModif>(); /* * List<list_add_services> servies = new List<list_add_services>(); * * //var order = db.Orders.Where(item => item.Id_order == id); * var order = db.ExecuteQuery<Order>(@"SELECT * FROM Orders WHERE Id_order = " + id + ";"); * Order ddd = order.First(); */ var ttt = db.ExecuteQuery <OrderModific>(@"SELECT [Orders].[Id_order], [Orders].[date], [Orders].[begin], [Orders].[end], [Client].[FIO] FROM [Orders], [Client] WHERE Orders.Id_order = '" + id + "' AND Orders.id_client = Client.Id_client;").ToList <OrderModific>().First(); //listServies = db.ExecuteQuery<ListServiesModif>(@"SELECT CAST([list_add_services].[Id_list_add_services] AS NVARCHAR(100)), CAST([list_add_services].[id_order] AS NVARCHAR(100)), CAST([type_servies].[name] AS NVARCHAR(100)) FROM [list_add_services], [type_servies], [Orders] WHERE [list_add_services].[id_servies] = [type_servies].[Id_servies] AND [list_add_services].[id_order] = '" + id + "'GROUP BY CAST([list_add_services].[Id_list_add_services] AS NVARCHAR(100)), CAST([list_add_services].[Id_order] AS NVARCHAR(100)), CAST([type_servies].[name] AS NVARCHAR(100));").ToList<ListServiesModif>(); //listServies = db.ExecuteQuery<ListServiesModif>(@"SELECT CAST([list_add_services].[Id_list_add_services] AS NVARCHAR(100)), CAST([list_add_services].[id_order] AS NVARCHAR(100)), CAST([type_servies].[name] AS NVARCHAR(100)) FROM [list_add_services], [type_servies], [Orders] WHERE [list_add_services].[id_servies] = [type_servies].[Id_servies] AND [list_add_services].[id_order] = '" + id + "'GROUP BY CAST([list_add_services].[Id_list_add_services] AS NVARCHAR(100)), CAST([list_add_services].[Id_order] AS NVARCHAR(100)), CAST([type_servies].[name] AS NVARCHAR(100));").ToList<ListServiesModif>(); //listServies = db.ExecuteQuery<ListServiesModif>(@"SELECT [list_add_services].[Id_list_add_services], [list_add_services].[id_order], CAST([type_servies].[name] AS NVARCHAR(100)) AS 'name' FROM [list_add_services], [type_servies], [Orders] WHERE [list_add_services].[id_servies] = [type_servies].[Id_servies] AND [list_add_services].[id_order] = '" + id + "' GROUP BY [list_add_services].[Id_list_add_services], [list_add_services].[Id_order], CAST([type_servies].[name] AS NVARCHAR(100));").ToList<ListServiesModif>(); /* * orderservies.order = ttt; * orderservies.ListServirecs = listServies; */ return(View(orderservies)); }
public ActionResult Details(int id) { /* * DataClasses1DataContext db = new DataClasses1DataContext(); * * OrderAndServies orderservies = new OrderAndServies(); * List<ListServiesModif> listServies = new List<ListServiesModif>(); * * //var ttt = db.ExecuteQuery<OrderModific>(@"SELECT [Orders].[Id_order], [Orders].[date], [Orders].[begin], [Orders].[end], [Orders].[payment], [Client].[FIO] FROM [Orders], [Client] WHERE Orders.Id_order = '" + id + "' AND Orders.id_client = Client.Id_client;").ToList<OrderModific>().First(); * var ttt = db.ExecuteQuery<OrderModific>(@"SELECT [Orders].[Id_order], [Orders].[date], [Orders].[begin], [Orders].[end], [Orders].[payment], [Orders].[BigPrice], [Client].[FIO] FROM [Orders], [Client] WHERE Orders.Id_order = '" + id + "' AND Orders.id_client = Client.Id_client").ToList<OrderModific>().First(); * * * listServies = db.ExecuteQuery<ListServiesModif>(@"SELECT [list_add_services].[Id_list_add_services], [list_add_services].[id_order], CAST([type_servies].[name] AS NVARCHAR(100)) AS 'name' FROM [list_add_services], [type_servies], [Orders] WHERE [list_add_services].[id_servies] = [type_servies].[Id_servies] AND [list_add_services].[id_order] = '" + id + "' GROUP BY [list_add_services].[Id_list_add_services], [list_add_services].[Id_order], CAST([type_servies].[name] AS NVARCHAR(100));").ToList<ListServiesModif>(); * //listServies = db.ExecuteQuery<ListServiesModif>(@"SELECT [list_add_services].[Id_list_add_services], [list_add_services].[id_order], CAST([type_servies].[name] AS NVARCHAR(100)) AS 'name' FROM [list_add_services], [type_servies], [Orders] WHERE [list_add_services].[id_servies] = [type_servies].[Id_servies] AND [list_add_services].[id_order] = '" + id + "' GROUP BY [list_add_services].[Id_list_add_services], [list_add_services].[Id_order], CAST([type_servies].[name] AS NVARCHAR(100));").ToList<ListServiesModif>(); * * * orderservies.order = ttt; * orderservies.list = listServies; * */ DataClasses1DataContext db = new DataClasses1DataContext(); OrderAndServies orderservies = new OrderAndServies(); var order = db.ExecuteQuery <OrderModific>(@"SELECT [Orders].[id_client], [Orders].[Id_order], [Orders].[date], [Orders].[begin], [Orders].[end], [Orders].[payment], [Orders].[BigPrice], [Client].[FIO] FROM [Orders], [Client] WHERE Orders.Id_order = '" + id + "' AND Orders.id_client = Client.Id_client").ToList <OrderModific>().First(); List <list_add_serviecsModific> listServies = FromDB <list_add_serviecsModific>(@"SELECT [list_add_services].*, [type_servies].[name] AS name_servies FROM [list_add_services], [type_servies] WHERE [list_add_services].[id_order] = " + id + " AND [list_add_services].id_servies = [type_servies].[Id_servies] "); //List<list_number> listNumber = FromDB<list_number>(@"SELECT * FROM [list_number] WHERE [list_number].[id_order] = " + id); //List<list_numberModifc> listNumber = FromDB<list_numberModifc>(@"SELECT [type_number].[name] AS 'number_room', [list_number].[settlement_date], [list_number].[eviction_date], [type_pool].[type] AS 'type_room', [list_number].[price] FROM [list_number], [type_pool], [type_number] WHERE [list_number].[id_order] = " + id + " AND [list_number].[id_number_room] = [type_number].[id_number] AND [list_number].[id_type_room] = [type_pool].Id_pool GROUP BY [type_number].[name], [list_number].[settlement_date], [list_number].[eviction_date], [type_pool].[type], [list_number].[price]"); List <list_numberModifc> listNumber = FromDB <list_numberModifc>(@"SELECT CAST([type_number].[name] AS NVARCHAR(MAX)) AS 'number_room', [list_number].[settlement_date], [list_number].[eviction_date], CAST([type_pool].[type] AS NVARCHAR(MAX)) AS 'type_room', CAST([nametyperoom].[name] AS NVARCHAR(MAX)) AS 'col_in_room', CAST([list_number].[price] AS NVARCHAR(MAX)) AS 'price' FROM [list_number], [type_pool], [type_number], [nametyperoom] WHERE [list_number].[id_order] = " + id + " AND [list_number].[id_number_room] = [type_number].[id_number] AND [list_number].[id_type_room] = [type_pool].Id_pool AND [list_number].[id_col_in_room] = [nametyperoom].[Id] GROUP BY CAST([type_number].[name] AS NVARCHAR(MAX)), [list_number].[settlement_date], [list_number].[eviction_date], CAST([type_pool].[type] AS NVARCHAR(MAX)), CAST([nametyperoom].[name] AS NVARCHAR(MAX)), CAST([list_number].[price] AS NVARCHAR(MAX))"); orderservies.order = order; orderservies.ListServirecs = listServies; orderservies.ListNumber = listNumber; return(View(orderservies)); }