Автосервис

Автор работы: Пользователь скрыл имя, 28 Марта 2015 в 19:06, курсовая работа

Описание работы

С тех пор как появились первые механические устройства возникла необходимость в их обслуживании и ремонте. Если телегу крестьянин обслуживал сам, то за римской боевой колесницей следили до трех человек, каждый из которых был узким специалистом: ходовая, оружие, кузов. Изобретение механических двигателей, вначале паровых, а позже и внутреннего сгорания и стремительное развитие последних привело к появлению автомобиля в том виде, в котором мы привыкли видеть сейчас.

Содержание работы

Введение……………………………………...………………………………...4
1. Описание предметной области …………………..…....………......5
2. Постановка задачи …………………………………………………….9
3. Обоснование принимаемых решений по выбору технических и программных средств реализации ..……….10
4.ФУНКЦИОНАЛЬНОЕ МОДЕЛИРОВАНИЕ……………………………......12
5. ИНФОРМАЦИОННОЕ МОДЕЛИРОВАНИЕ………………………………13
6. ПРОЕКТИРОВАНИЕ И ПРОГРАММИРОВАНИЕ ИНТЕРФЕЙСОВ СИСТЕМЫ……………………………………………………………….………17
7. ОПИСАНИЕ РуководствА пользователя ……………………..…18
7.1 Назчанение программы 18
7.2 Системные требования 19
7.3 Работа программы 20
7.4 Сообщения пользователю 21
8. ТЕСТИРОВАНИЕ СИСТЕМЫ И ОПИСАНИЕ ПОЛУЧЕННЫХ РЕЗУЛЬТАТОВ……………………………………………………………….…22
Заключение………………………………………………………………….25
список литературных источников…………………………...……2

Файлы: 1 файл

Селедцов А.И.doc

— 582.50 Кб (Скачать файл)

 

                        Console.WriteLine("Введите цену к оплате");

                        var key3 = new ConsoleKeyInfo();

                        var number3 = "";

                        while ((key2 = Console.ReadKey()).Key != ConsoleKey.Enter)

                        {

                            if (!Char.IsDigit(key2.KeyChar))

                            {

                                if (!Char.IsControl(key2.KeyChar))

                                    Console.Write("\b \b");

                            }

                            else

                            {

                                if (!Char.IsControl(key2.KeyChar))

                                    number3 += key2.KeyChar;

                            }

                            if (key2.Key == ConsoleKey.Backspace && number3.Length > 0)

                            {

                                number3 = number3.Remove(number3.Length - 1, 1);

                                Console.Write("\b");

                            }

                        }

                        price = Convert.ToInt32(number3);

                        //myConnection010

                        SqlConnection myConnection010 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection010.Open();

                            SqlParameter myParam19 = new SqlParameter("@Param19", SqlDbType.NVarChar, 50);

                            myParam19.Value = work;

 

                            SqlParameter myParam20 = new SqlParameter("@Param20", SqlDbType.NVarChar, 50);

                            myParam20.Value = detali;

 

                            SqlParameter myParam21 = new SqlParameter("@Param21", SqlDbType.NVarChar, 50);

                           myParam21.Value = worker;

 

                            SqlParameter myParam22 = new SqlParameter("@Param22", SqlDbType.NVarChar, 50);

                            myParam22.Value = number;

 

                            SqlParameter myParam23 = new SqlParameter("@Param23", SqlDbType.Int);

                            myParam23.Value = price;

 

                            SqlParameter myParam24 = new SqlParameter("@Param24", SqlDbType.NVarChar, 50);

                            myParam24.Value = numberr;

                            SqlCommand myCommand5 = new SqlCommand

    ("Update work Set work = @Param19, detali = @Param20, worker = @Param21, number = @Param22, price = @Param23 where number = @Param24;", myConnection010);

                            myCommand5.Parameters.Add(myParam19);

                            myCommand5.Parameters.Add(myParam20);

                            myCommand5.Parameters.Add(myParam21);

                            myCommand5.Parameters.Add(myParam22);

                            myCommand5.Parameters.Add(myParam23);

                            myCommand5.Parameters.Add(myParam24);

                            myCommand5.ExecuteNonQuery();

                            myConnection010.Close();

                            Console.WriteLine("Запись изменена!\n");

                            break;

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться  к серверу!\n");

                           break;

                        }

 

                    case "10":

                        Console.WriteLine("Введите фамилию клиента  которого хотите удалить");

                        fam = Console.ReadLine();

                        if (fam.Length == 0)

                        {

                            Console.WriteLine("Не была введена  фамилию клиента , которого вы  хотите удалить!\n");

                            break;

                        }

 

                        SqlConnection myConnection10 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection10.Open();

                            SqlDataReader myReader2 = null;

                            SqlParameter myParam25 = new SqlParameter("@Param25", SqlDbType.NVarChar, 50);

                            myParam25.Value = fam;

                            SqlCommand myCommand6 = new SqlCommand("Select * from client where fam =@Param25",

                                                             myConnection10);

                            myCommand6.Parameters.Add(myParam25);

                            myReader2 = myCommand6.ExecuteReader();

                            if (myReader2.Read() == true)

                            {

                                while (myReader2.Read() == true)

                                {

                                    Console.Write("Фамилия: " + myReader2["Fam"].ToString() + "\n");

                                    Console.Write("Имя: " + myReader2["Name"].ToString() + "\n");

                                    Console.Write("Отчество: " + myReader2["Ochestvo"].ToString() + "\n");

                                    Console.Write("Марка машины: " + myReader2["Marka"].ToString() + "\n");

                                    Console.Write("Регистрационный номер: " + myReader2["Number"].ToString() + "\n\n");

                                }

 

                            }

 

                            myConnection10.Close();

 

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться к серверу!\n");

                            break;

                        }

 

                        SqlConnection myConnection011 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection011.Open();

                            SqlParameter myParam26 = new SqlParameter("@Param26", SqlDbType.NVarChar, 50);

                            myParam26.Value = fam;

                            SqlCommand myCommand4 = new SqlCommand("Delete FROM client WHERE  fam =@Param26",

                                                             myConnection011);

                            myCommand4.Parameters.Add(myParam26);

                            myCommand4.ExecuteReader();

                            myConnection011.Close();

                            Console.WriteLine("\nЗапись удалена!\n");

                            break;

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться к серверу!\n");

                            break;

                        }

 

                    case "11":

                        Console.WriteLine("Введите Регистрационный  номер , по которому вы хотите удалить запись из базы данных");

                        number = Console.ReadLine();

                        if (number.Length == 0)

                        {

                            Console.WriteLine("Не был введен номер!\n");

                            break;

                        }

 

                        SqlConnection myConnection11 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection11.Open();

                            SqlDataReader myReader2 = null;

                            SqlParameter myParam27 = new SqlParameter("@Param27", SqlDbType.NVarChar, 50);

                            myParam27.Value = number;

                            SqlCommand myCommand6 = new SqlCommand("Select * from work where number = @Param27",

                                                             myConnection11);

                            myCommand6.Parameters.Add(myParam27);

                            myReader2 = myCommand6.ExecuteReader();

                            if (myReader2.Read() == true)

                            {

                                while (myReader2.Read() == true)

                                {

                                    Console.Write("Работы: " + myReader2["Work"].ToString() + "\n");

                                    Console.Write("Детали: " + myReader2["Detali"].ToString() + "\n");

                                    Console.Write("Мастер: " + myReader2["Worker"].ToString() + "\n");

                                    Console.Write("Регистрационный номер машины: " + myReader2["Number"].ToString() + "\n");

                                    Console.Write("Цена: " + myReader2["Price"].ToString() + "\n\n");

                                }

 

                            }

 

                            myConnection11.Close();

 

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться к серверу!\n");

                            break;

                        }

 

                        //myConnection012

                        SqlConnection myConnection012 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection012.Open();

                            SqlParameter myParam28 = new SqlParameter("@Param28", SqlDbType.NVarChar, 50);

                            myParam28.Value = number;

                            SqlCommand myCommand4 = new SqlCommand("Delete FROM work WHERE  number =@Param28",

                                                             myConnection012);

                            myCommand4.Parameters.Add(myParam28);

                            myCommand4.ExecuteReader();

                            myConnection012.Close();

                            Console.WriteLine("\nЗапись удалена!\n");

                            break;

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться  к серверу!\n");

                            break;

                        }

 

                    case "12":

                        Console.WriteLine("Введите регистрационный  номер машины,по которому нужно  найти владельца и модель автомобиля:");

                        number = Console.ReadLine();

                        if (number.Length == 0)

                        {

                            Console.WriteLine("Не был введен регистрационный  номер машины !\n");

                            break;

                        }

 

                        SqlConnection myConnection12 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection12.Open();

                            SqlDataReader myReader5 = null;

                            SqlParameter myParam29 = new SqlParameter("@Param29", SqlDbType.NVarChar, 50);

                            myParam29.Value = number;

                            SqlCommand myCommand5 = new SqlCommand("Select * from client where number like @Param29", myConnection12);

                            myCommand5.Parameters.Add(myParam29);

                            myReader5 = myCommand5.ExecuteReader();

                            while (myReader5.Read())

                            {

                                Console.Write("\nФамилия: " + myReader5["Fam"].ToString() + "\n");

                                Console.Write("Имя: " + myReader5["Name"].ToString() + "\n");

                                Console.Write("Отчество: " + myReader5["Ochestvo"].ToString() + "\n");

                                Console.Write("Марка машины: " + myReader5["Marka"].ToString() + "\n");

                                Console.Write("Регистрационный номер: " + myReader5["Number"].ToString() + "\n\n");

                            }

 

                            myConnection12.Close();

                            break;

 

                        }

                        catch

                        {

                            Console.WriteLine("Не удалось подключиться к серверу!\n");

                            break;

                        }

 

                    case "13":

                        Console.WriteLine("Введите фамилию мастера которого нужно найти:");

                        worker = Console.ReadLine();

                        if (worker.Length == 0)

                        {

                            Console.WriteLine("Не была введена  фамилию мастера которого нужно найти!\n");

                            break;

                        }

 

                        SqlConnection myConnection13 = new SqlConnection(@"server=localhost; Trusted_Connection=yes; database=ServiceStation; Connection timeout=10");

 

                        try

                        {

                            myConnection13.Open();

                            SqlDataReader myReader5 = null;

                            SqlParameter myParam30 = new SqlParameter("@Param30", SqlDbType.NVarChar, 50);

                            myParam30.Value = worker;

                            SqlCommand myCommand5 = new SqlCommand("Select * from work where worker like @Param30", myConnection13);

                            myCommand5.Parameters.Add(myParam30);

                            myReader5 = myCommand5.ExecuteReader();

                            while (myReader5.Read())

                            {

                                Console.Write("\nРаботы: " + myReader5["Work"].ToString() + "\n");

                                Console.Write("Детали: " + myReader5["Detali"].ToString() + "\n");

                                Console.Write("Мастер: " + myReader5["Worker"].ToString() + "\n");

                                Console.Write("Регистрационный номер машины: " + myReader5["Number"].ToString() + "\n");

Информация о работе Автосервис