ction) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@" INSERT INTO [MariosWindows]. [dbo]. [Orders]
([IdOrder]
, [IdObjectInstallation]
, [IdCustomer]
, [OrderNumber]
, [OrderDate]
, [TermPerfomance]
, [PaymentKind]
, [AdvancePayment]
, [TotalSum]
, [OrderPaid]
, [BeginWorkDate]) ({0}, {1},{2},laquo;{3}raquo;,laquo;{4}raquo;,laquo;{5}raquo;,laquo;{6}raquo;,{7},{8},{9},laquo;{10}raquo;)", incrMaxNumber, order.IdObjectInstallation, order.IdCustomer, order.Number, .Date.ToShortDateString (), order.TermPerfomance, order.PaymentKind, order.PaymentAdvance, order.TotalSum, Convert.ToInt32 (order.OrderPaid), order.BeginWorkDate. ToShortDateString ()); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader ();
//cust.Id=incrMaxNumber; .Close (); (var service in services)
{specificationsQueryOrderService=String.Format (
@" INSERT INTO [MariosWindows]. [dbo]. [OrdersServices]
([idServices]
, [idOrder]
, [Count]) ({0}, {1}, {2})" , service.Id, incrMaxNumber, service.Count); specificationsCommandOrderService=new SqlCommand (specificationsQueryOrderService, connection) ;. CommandTimeout=0; reader2=specificationsCommandOrderService.ExecuteReader () ;. Close ();
} (var configuration in configurations)
{specificationsQueryOrderConfiguration=String.Format (
@" INSERT INTO [MariosWindows]. [dbo]. [OrdersConfigurations]
([idConfiguration]
, [idOrder]
, [Count]) ({0}, {1}, {2})" , configuration.Id, incrMaxNumber, configuration.Count); specificationsCommandOrderConfiguration=new SqlCommand (specificationsQueryOrderConfiguration, connection) ;. CommandTimeout=0; reader3=specificationsCommandOrderConfiguration.ExecuteReader () ;. Close ();
} (var employee in employees)
{specificationsQueryOrderEmployee=String.Format (
@" INSERT INTO [MariosWindows]. [dbo]. [EmployeesOrders]
([idEmployee]
, [idOrder]) ({0}, {1})" , employee.Id, incrMaxNumber); specificationsCommandOrderEmployee=new SqlCommand (specificationsQueryOrderEmployee, connection) ;. CommandTimeout=0; reader4=specificationsCommandOrderEmployee. ExecuteReader () ;. Close ();
}. Close ();
} int IncrementNumberOrder (string source)
{connection=GetConnection (source);
maxNumberQuery=String.Format (@ SELECT MAX (OrderNumber) [MariosWindows]. [dbo]. [Orders] ); maxNumberCommand=new SqlCommand (maxNumberQuery, connection) ;. CommandTimeout= 0; Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1;
}
//Пошук заказовList lt; Order gt; GetOrder (string val, string source)
{connection=GetConnection (source); orders=new List lt; Order gt; (); specificationsCommand=new SqlCommand (val, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader (); ( reader.Read ())
{order=new Order () ;. IdOrder=Convert.ToInt32 (reader [0]) ;. Number=Convert.ToInt32 (reader [1]) ;. Date=Convert.ToDateTime (reader [2]) ;. TermPerfomance=reader [3] .ToString () ;. PaymentKind=reader [4] .ToString () ;. PaymentAdvance=Convert.ToInt32 (reader [5]) ;. TotalSum=Convert.ToInt32 (reader [6]) ;. OrderPaid=Convert.ToBoolean (reader [7]) ;. BeginWorkDate=Convert.ToDateTime (reader [8]); customer=new Customer () ;. Surname=reader [9] .ToString ();.Name=reader [10] .ToString () ;. Patronomyc=reader [11] .ToString () ;. Address=reader [12] .ToString () ;. Phone1=reader [13] .ToString () ;. Phone2 =reader [14] .ToString () ;. customer=customer; placeWork=new PlaceWork () ;. Address=reader [15] .ToString () ;. Note=reader [16] .ToString () ;. placeWork=placeWork ; .Add (order);
}. Close (); (var order in orders)
{employees=new List lt; Employee gt; (); query=String.Format(@laquo;SELECT.Id,.Surname,.Name,.Patronymic,.BusinessPhone,.EMail,.PassportNumber,.PassportSeries,.Profession,.[Address],.Birthday,.PersonHourEmployees em INNER JOIN EmployeesOrders eo ON (em.Id=eo.IdEmployee) eo.IdOrder={0} , Order.IdOrder); specificationsEmployeesCommand=new SqlComma...