der [1] .ToString () ;. Cost=Convert.ToDouble (reader [ 2] .ToString ()) ;. Category=reader [3] .ToString (); (key!=service.Category amp; amp; key!=string.Empty)
{. Add (key, services);=new List lt; Service gt; () ;. Add (service);
}
{. Add (service);
}=service.Category;
}. Add (key, services) ;. Close () ;. Close (); categoryServices;
}
//Отримати список комплектаційDictionary lt; string, List lt; Configuration gt; gt; GetConfiguration (string source)
{categoryConfiguration=new Dictionary lt; string, List lt; Configuration gt; gt; (); configurations=new List lt; Configuration gt; (); connection=GetConnection (source); specificationsQuery=String.Format (
@" SELECT [Id]
, [ConfigurationKind]
, [PriceWithMargin]
, [PriceSupplier]
, [CountStore]
, [Category] [MariosWindows]. [dbo]. [Configuration] BY Category" ); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ; key=string.Empty; (reader.Read ())
{configuration=new Configuration () ;. Id=Convert.ToInt32 (reader [0]) ;. Name=reader [1] .ToString () ;. PriceWithMargin=Convert.ToDouble (reader [ 2] .ToString ()) ;. PriceSupplier=Convert.ToDouble (reader [3] .ToString ()) ;. CountStore=Convert.ToInt32 (reader [4] .ToString ()) ;. Category=reader [5]. ToString (); (key!=configuration.Category amp; amp; key!=string.Empty)
{. Add (key, configurations);=new List lt; Configuration gt; () ;. Add (configuration);
}
{. Add (configuration);
}=configuration.Category;
}. Add (key, configurations) ;. Close ();
. Close (); categoryConfiguration;
}
//Додавання заказчікаCustomer SetCustomer (Customer cust, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Customer] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Customer ({0}, Nlaquo;{1}raquo;,Nlaquo;{2}raquo;,Nlaquo;{3}raquo;,laquo;{4}raquo;,laquo;{5}raquo;,laquo;{6}raquo;)raquo;, incrMaxNumber, cust.Surname.Trim (), cust.Name.Trim () ,. Patronomyc, cust.Address, cust.Phone1.Trim (), cust.Phone2); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout =0; reader=specificationsCommand.ExecuteReader () ;. Id=incrMaxNumber; .Close () ;. Close (); cust;
}
//Додавання поставщікаSupplier SetSupplier (Supplier supplier, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Suppliers] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Suppliers ({0}, N {1} , N {2} , N {3} , N {4} ) raquo ;, incrMaxNumber, supplier.Name.Trim (), supplier.Address.Trim () ,. INN, supplier.KPP); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ;. Id=incrMaxNumber; .Close () ;. Close (); supplier;
}
//Додавання комплектацііvoid SetConfiguration (Configuration configuration, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Configuration] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Configuration ({0}, {1}, N {2} , {3}, {4}, {5}, N {6} , null) raquo ;, incrMaxNumber, configuration.IdSuppliers, .Name.Trim () ,. PriceWithMargin, configuration.PriceSupplier, configuration.CountStore, configuration.Category); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ;. Close () ;. Close ();
}
//Додавання услугіvoid SetService (Service service, string source)