y"> {connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Services] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Services ({0}, N {1} , {2}, N {3} ) raquo ;, incrMaxNumber, service.Name, .Cost , service.Category); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ;. Close () ;. Close ();
}
//Додавання сотрудніковvoid SetEmployee (Employee employee, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Employees] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Employees ({0}, Nlaquo;{1}raquo;,Nlaquo;{2}raquo;,Nlaquo;{3}raquo;,Nlaquo;{4}raquo;,Nlaquo;{5}raquo;,Nlaquo;{6}raquo;,Nlaquo;{7}raquo;,Nlaquo;{8}raquo;,Nlaquo;{9}raquo;,Nlaquo;{10}raquo;)raquo;, incrMaxNumber, employee.Name, .Surname, employee.Patronomic, employee.PasportSeries, employee.PasportName, .BusinessPhone, employee.Email, employee.Profession, employee.Birthday, employee.Address); specificationsCommand=new SqlCommand (specificationsQuery, connection) ; .CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ;. Close () ;. Close ();
}
//Пошук всіх об'ектовList lt; PlaceWork gt; GetPlaceWork (string source)
{connection=GetConnection (source); placeWorks=new List lt; PlaceWork gt; (); specificationsQuery=String.Format (
@" SELECT [Id]
, [Address]
, [Note] [MariosWindows]. [dbo]. [Objects] BY [Address]" ); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader (); (reader.Read ())
{placeWork=new PlaceWork () ;. Id=Convert.ToInt32 (reader [0]) ;. Address=reader [1] .ToString (); (reader [2]!=null).Note=reader [2] .ToString () ;. Note=string.Empty; .Add (placeWork);
}. Close () ;. Close (); placeWorks;
}
//Пошук всіх заказчіковList lt; Customer gt; GetCustomer (string source)
{connection=GetConnection (source); customers=new List lt; Customer gt; (); specificationsQuery=String.Format (
@" SELECT [Id]
, [Family]
, [Name]
, [Patronomic]
, [AddressResidence]
, [Phone1]
, [Phone2] [MariosWindows]. [dbo]. [Customer] BY [Family], [Name]" ); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader =specificationsCommand.ExecuteReader (); (reader.Read ())
{cust=new Customer () ;. Id=Convert.ToInt32 (reader [0]) ;. Surname=reader [1] .ToString () ;. Name=reader [2] .ToString (); (reader [3]!=null) .Patronomyc=reader [3] .ToString () ;. Patronomyc=string.Empty; (reader [4]!=null) .Address=reader [4] .ToString ( ) ;. Address=string.Empty; .Phone1=reader [5] .ToString (); (reader [6]!=null) .Phone2=reader [6] .ToString () ;. Phone2=string.Empty ;. Add (cust);
}. Close () ;. Close (); customers;
}
//Додавання місця работиPlaceWork SetPlaceWork (PlaceWork placeWork, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (Id) [MariosWindows]. [dbo]. [Objects] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, connection) ;. CommandTimeout=0; incrMaxNumber=Convert.ToInt32 (maxNumberCommand.ExecuteScalar ()) + 1; specificationsQuery=String.Format (
@ INSERT INTO Objects ({0}, N {1} , N {2} ) raquo ;, incrMaxNumber, placeWork.Address.Trim () ,. Note ); specificationsCommand=new SqlCommand (specificationsQuery, connection) ;. CommandTimeout=0; reader=specificationsCommand.ExecuteReader () ;. Id=incrMaxNumber; .Close () ;. Close (); placeWork;
} void AddOrder (Order order, List lt; Service gt; services, List lt; Configuration gt; configurations, List lt; Employee gt; employees, string source)
{connection=GetConnection (source); maxNumberQuery=String.Format (@ SELECT MAX (IdOrder) [MariosWindows]. [dbo]. [Orders] ); maxNumberCommand=new SqlCommand ( maxNumberQuery, conne...