public static IEnumerable <Employee> GetDrivers(Transport transport) { List <Employee> drivers = new List <Employee>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetDrivers"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@drivingCategory", transport.DrivingCategory.Id); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Employee driver = new Employee(); driver.Id = int.Parse(reader["ID_Работник"].ToString()); driver.Passport = reader["Паспорт"].ToString(); driver.FullName = reader["ФИО"].ToString(); driver.Phone = reader["Телефон"].ToString(); drivers.Add(driver); } } return(drivers); }
public static void Add(RecieptForReturn recieptForReturn, Reciept reciept) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("AddRecieptForReturn"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@idReciept", reciept.Id); command.Parameters.AddWithValue("@idTransport", reciept.Transport.Id); command.Parameters.AddWithValue("@idParking", recieptForReturn.Parking.Id); command.Parameters.AddWithValue("@creationDate", recieptForReturn.CreationDate); command.Parameters.Add(new SqlParameter("@idRecieptForReturn", SqlDbType.Int)); command.Parameters["@idRecieptForReturn"].Direction = ParameterDirection.Output; connection.Open(); command.ExecuteNonQuery(); recieptForReturn.Id = (int)command.Parameters["@idRecieptForReturn"].Value; if (recieptForReturn.FineReciept != null) { FineRecieptDAO.Add(recieptForReturn); } } }
internal static Client GetClientById(int id) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetClientByID"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Client client = new Client(); client.Id = id; client.Passport = reader["Паспорт"].ToString(); client.FullName = reader["ФИО"].ToString(); client.Phone = reader["Телефон"].ToString(); client.AddDrivingCategory(DrivingCategoryDAO.GetClientsDrivingCategories(client)); return(client); } } } return(null); }
public static IEnumerable <Client> GetClients() { List <Client> сlients = new List <Client>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetClients"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Client client = new Client(); client.Id = int.Parse(reader["ID_Клиент"].ToString()); client.Passport = reader["Паспорт"].ToString(); client.FullName = reader["ФИО"].ToString(); client.Phone = reader["Телефон"].ToString(); client.AddDrivingCategory(DrivingCategoryDAO.GetClientsDrivingCategories(client)); сlients.Add(client); } } return(сlients); }
public static void Edit(Client client) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("EditClient"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", client.Id); command.Parameters.AddWithValue("@passport", client.Passport); command.Parameters.AddWithValue("@fullName", client.FullName); command.Parameters.AddWithValue("@phone", client.Phone); DataTable drivingCategoriesTable = new DataTable(); drivingCategoriesTable.Columns.Add(new DataColumn("id", typeof(int))); foreach (DrivingCategory drivingCategory in client.DrivingCategories) { drivingCategoriesTable.Rows.Add(drivingCategory.Id); } SqlParameter drivingCategoryParameter = command.Parameters.AddWithValue("@drivingCategoryIds", drivingCategoriesTable); drivingCategoryParameter.SqlDbType = SqlDbType.Structured; connection.Open(); command.ExecuteNonQuery(); } }
public static IEnumerable <Model> GetModels() { List <Model> models = new List <Model>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetModels"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { models.Add(new Model(int.Parse(reader["ID_Модель"].ToString()), reader["НазваниеМодели"].ToString(), int.Parse(reader["ID_Марка"].ToString()), reader["НазваниеМарки"].ToString(), double.Parse(reader["КоэфПрестижа"].ToString()))); } } return(models); }
public static void Add(Employee employee) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("AddEmployee"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@passport", employee.Passport); command.Parameters.AddWithValue("@fullName", employee.FullName); command.Parameters.AddWithValue("@phone", employee.Phone); command.Parameters.AddWithValue("@idPosition", employee.Position.Id); if (employee.Account != null) { command.Parameters.AddWithValue("@login", employee.Account.Login); command.Parameters.AddWithValue("@password", employee.Account.Password); } DataTable drivingCategoriesTable = new DataTable(); drivingCategoriesTable.Columns.Add(new DataColumn("id", typeof(int))); foreach (DrivingCategory drivingCategory in employee.DrivingCategories) { drivingCategoriesTable.Rows.Add(drivingCategory.Id); } SqlParameter drivingCategoryParameter = command.Parameters.AddWithValue("@drivingCategoryIds", drivingCategoriesTable); drivingCategoryParameter.SqlDbType = SqlDbType.Structured; connection.Open(); command.ExecuteNonQuery(); } }
internal static DriverReciept GetDriverRecieptById(int id) { if (id == 0) { return(null); } using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetDriverRecieptById"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DriverReciept driverReciept = new DriverReciept(); driverReciept.Id = int.Parse(reader["ID_КвВодитель"].ToString()); int idDriver = int.Parse(reader["Работник"].ToString()); driverReciept.Driver = EmployeeDAO.GetEmployeeById(idDriver); return(driverReciept); } } } return(null); }
internal static Tariff GetTariffById(int id) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetTariffByID"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Tariff tariff = new Tariff(id, reader["Название"].ToString(), int.Parse(reader["СрокАренды"].ToString()), double.Parse(reader["СтоимостьЗаЧас"].ToString())); return(tariff); } } } return(null); }
public static IEnumerable <Employee> GetEmployees() { List <Employee> employees = new List <Employee>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetEmployees"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Employee employee = new Employee(); employee.Id = int.Parse(reader["ID_Работник"].ToString()); employee.Passport = reader["Паспорт"].ToString(); employee.FullName = reader["ФИО"].ToString(); employee.Phone = reader["Телефон"].ToString(); employee.Position = new Position(int.Parse(reader["ID_Должность"].ToString()), reader["НазваниеДолжности"].ToString()); employee.AddDrivingCategory(DrivingCategoryDAO.GetEmployeesDrivingCategories(employee)); employee.Account = AccountDAO.GetEmployeesAccaunt(employee); employees.Add(employee); } } return(employees); }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateChildren() == false) { return; } string connectionString = CombineConStringFromTextBoxes(); if (TestConnection(connectionString, out _)) { ActualConnectionString.Set(connectionString); this.Close(); } else { string dialogMessage = string.Format($"Отсутствует подключение к серверу.\r\nПрименить настройки по умолчанию?");//какое сообщение? var dialogResult = MessageBox.Show(dialogMessage, "Информация о подключении", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (DialogResult == 0) { ActualConnectionString.SetDefault(); this.Close(); } } }
public static void Add(Reciept reciept) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("AddReciept"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@tariff", reciept.Tariff.Id); command.Parameters.AddWithValue("@transport", reciept.Transport.Id); command.Parameters.AddWithValue("@parking", reciept.Parking.Id); command.Parameters.AddWithValue("@employee", reciept.Employee.Id); command.Parameters.AddWithValue("@client", reciept.Client.Id); command.Parameters.AddWithValue("@creationDate", reciept.CreationDate); command.Parameters.AddWithValue("@necessaryReturnDate", reciept.NecessaryReturnDate); command.Parameters.AddWithValue("@price", reciept.Price); command.Parameters.Add(new SqlParameter("@idReciept", SqlDbType.Int)); command.Parameters["@idReciept"].Direction = ParameterDirection.Output; connection.Open(); command.ExecuteNonQuery(); reciept.Id = (int)command.Parameters["@idReciept"].Value; if (reciept.DriverReciept != null) { DriverRecieptDAO.Add(reciept); } } }
public static void Edit(Transport transport) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("EditTransport"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@ID_transport", transport.Id); command.Parameters.AddWithValue("@title", transport.Title); command.Parameters.AddWithValue("@brand", transport.Brand.Id); command.Parameters.AddWithValue("@model", transport.Model.Id); command.Parameters.AddWithValue("@color", transport.Color.Id); command.Parameters.AddWithValue("@year", transport.Year); command.Parameters.AddWithValue("@drivingCategory", transport.DrivingCategory.Id); if (transport.Parking != null) { command.Parameters.AddWithValue("@parking", transport.Parking.Id); } command.Parameters.AddWithValue("@coef", transport.Coef); command.Parameters.AddWithValue("@correctCoef", transport.CorrectCoef); connection.Open(); command.ExecuteNonQuery(); } }
public static IEnumerable <RecieptReport> GetRecieptsReport(DateTime fromDate, DateTime toDate) { List <RecieptReport> recieptsReport = new List <RecieptReport>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetRecieptsReport"); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@fromDate", fromDate); command.Parameters.AddWithValue("@toDate", toDate); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { RecieptReport recieptReport = new RecieptReport(); recieptReport.Id = int.Parse(reader["ID_КвОВыдаче"].ToString()); recieptReport.ClientsFullName = reader["ФИО"].ToString(); recieptReport.TransportsTitle = reader["ГосНомер"].ToString(); recieptReport.CreationDate = DateTime.Parse(reader["ДатаОформления"].ToString()); recieptReport.Price = double.Parse(reader["Стоимость"].ToString()); recieptsReport.Add(recieptReport); } } return(recieptsReport); }
public FmConnection() { InitializeComponent(); ctlIntegratedSecurity.Items.Add("False"); ctlIntegratedSecurity.Items.Add("True"); string connectionString = ActualConnectionString.Get(); WriteInTextBoxes(connectionString); }
public static void CreateBackup(string path) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("CreateBackup"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@path", path); connection.Open(); command.ExecuteNonQuery(); } }
public static void Add(Reciept reciept) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("AddDriverReciept"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@idReciept", reciept.Id); command.Parameters.AddWithValue("@idEmployee", reciept.DriverReciept.Driver.Id); connection.Open(); command.ExecuteNonQuery(); } }
public static void RestoreDatabase(string databaseName, string path) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.GetMaster())) { string commandText = string.Format(@"ALTER DATABASE [{0}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE RESTORE DATABASE [{0}] FROM DISK = N'{1}' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5 ALTER DATABASE [{0}] SET MULTI_USER", databaseName, path); SqlCommand command = new SqlCommand(commandText); command.Connection = connection; connection.Open(); command.ExecuteNonQuery(); } }
private static IEnumerable <Reciept> GetReciepts(SqlParameter parameter) { List <Reciept> reciepts = new List <Reciept>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetReciepts"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; if (parameter != null) { command.Parameters.Add(parameter); } connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Reciept reciept = new Reciept(); reciept.Id = int.Parse(reader["ID_КвОВыдаче"].ToString()); int idTariff = int.Parse(reader["Тариф"].ToString()); int idTransport = int.Parse(reader["Транспорт"].ToString()); int idParking = int.Parse(reader["Парковка"].ToString()); int idEmployee = int.Parse(reader["Работник"].ToString()); int idClient = int.Parse(reader["Клиент"].ToString()); reciept.CreationDate = DateTime.Parse(reader["ДатаОформления"].ToString()); reciept.NecessaryReturnDate = DateTime.Parse(reader["НеобходимаяДатаВозврата"].ToString()); reciept.Price = double.Parse(reader["Стоимость"].ToString()); int.TryParse(reader["ID_КвОВозврате"].ToString(), out int idRecieptForReturn); int.TryParse(reader["ID_КвВодитель"].ToString(), out int idDriverReciept); reciept.Tariff = TariffsDAO.GetTariffById(idTariff); reciept.Transport = TransportDAO.GetTransportById(idTransport); reciept.Parking = ParkingDAO.GetParkingById(idParking); reciept.Employee = EmployeeDAO.GetEmployeeById(idEmployee); reciept.Client = ClientDAO.GetClientById(idClient); reciept.RecieptForReturn = RecieptForReturnDAO.GetRecieptForReturnById(idRecieptForReturn); reciept.DriverReciept = DriverRecieptDAO.GetDriverRecieptById(idDriverReciept); reciepts.Add(reciept); } } return(reciepts); }
public static void Add(RecieptForReturn recieptForReturn) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("AddFineReciept"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@idRecieptForReturn", recieptForReturn.Id); command.Parameters.AddWithValue("@fine", recieptForReturn.FineReciept.Fine); command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int)); command.Parameters["@id"].Direction = ParameterDirection.Output; connection.Open(); command.ExecuteNonQuery(); recieptForReturn.FineReciept.Id = (int)command.Parameters["@id"].Value; } }
internal static Transport GetTransportById(int id) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetTransportByID"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Transport transport = new Transport(); transport.Id = id; transport.Title = reader["ГосНомер"].ToString(); transport.Brand = new Brand(int.Parse(reader["ID_Марка"].ToString()), reader["НазваниеМарки"].ToString()); transport.Model = new Model(int.Parse(reader["ID_Модель"].ToString()), reader["НазваниеМодели"].ToString()); transport.Color = new Color(int.Parse(reader["ID_Цвет"].ToString()), reader["НазваниеЦвета"].ToString()); transport.Year = int.Parse(reader["ГодВыпуска"].ToString()); transport.DrivingCategory = new DrivingCategory(int.Parse(reader["ID_Категория"].ToString()), reader["Категория"].ToString()); if (!string.IsNullOrEmpty(reader["ID_Парковка"].ToString())) { transport.Parking = new Parking(int.Parse(reader["ID_Парковка"].ToString()), reader["Адрес"].ToString()); } transport.Coef = double.Parse(reader["КоэфСтоимости"].ToString()); transport.CorrectCoef = double.Parse(reader["ПоправочныйКоэф"].ToString()); return(transport); } } } return(null); }
public static IEnumerable <Transport> GetTransports() { List <Transport> transports = new List <Transport>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetTransports"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Transport transport = new Transport(); transport.Id = int.Parse(reader["ID_Транспорт"].ToString()); transport.Title = reader["ГосНомер"].ToString(); transport.Brand = new Brand(int.Parse(reader["ID_Марка"].ToString()), reader["НазваниеМарки"].ToString()); transport.Model = new Model(int.Parse(reader["ID_Модель"].ToString()), reader["НазваниеМодели"].ToString()); transport.Color = new Color(int.Parse(reader["ID_Цвет"].ToString()), reader["НазваниеЦвета"].ToString()); transport.Year = int.Parse(reader["ГодВыпуска"].ToString()); transport.DrivingCategory = new DrivingCategory(int.Parse(reader["ID_Категория"].ToString()), reader["Категория"].ToString()); if (!string.IsNullOrEmpty(reader["ID_Парковка"].ToString())) { transport.Parking = new Parking(int.Parse(reader["ID_Парковка"].ToString()), reader["Адрес"].ToString()); } transport.Coef = double.Parse(reader["КоэфСтоимости"].ToString()); transport.CorrectCoef = double.Parse(reader["ПоправочныйКоэф"].ToString()); transports.Add(transport); } } return(transports); }
public static IEnumerable <Color> GetColors() { List <Color> colors = new List <Color>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetColors"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { colors.Add(new Color(int.Parse(reader["ID_Цвет"].ToString()), reader["НазваниеЦвета"].ToString())); } } return(colors); }
public static IEnumerable <Position> GetPositions() { List <Position> positions = new List <Position>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetPositions"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { positions.Add(new Position(int.Parse(reader["ID_Должность"].ToString()), reader["НазваниеДолжности"].ToString())); } } return(positions); }
public static RecieptForReturn GetRecieptForReturnById(int id) { if (id == 0) { return(null); } using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetRecieptForReturnById"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { RecieptForReturn recieptForReturn = new RecieptForReturn(); recieptForReturn.Id = int.Parse(reader["ID_КвОВозврате"].ToString()); int idParking = int.Parse(reader["Парковка"].ToString()); recieptForReturn.CreationDate = DateTime.Parse(reader["ДатаОформления"].ToString()); if (!string.IsNullOrEmpty(reader["ID_КвШтраф"].ToString())) { recieptForReturn.FineReciept = new FineReciept(int.Parse(reader["ID_КвШтраф"].ToString()), double.Parse(reader["Штраф"].ToString())); } recieptForReturn.Parking = ParkingDAO.GetParkingById(idParking); return(recieptForReturn); } } } return(null); }
public static IEnumerable <Parking> GetParkings() { List <Parking> parkings = new List <Parking>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetParkings"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { parkings.Add(new Parking(int.Parse(reader["ID_Парковка"].ToString()), reader["Адрес"].ToString())); } } return(parkings); }
public static Employee GetEmployeeById(int id) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetEmployeeByID"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", id); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Employee employee = new Employee(id, (string)reader["Паспорт"], (string)reader["ФИО"]); return(employee); } } } return(null); }
public static Account GetEmployeesAccaunt(Employee employee) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetEmployeesAccaunt"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", employee.Id); connection.Open(); SqlDataReader reader = command.ExecuteReader(); Account account = null; while (reader.Read()) { account = new Account(int.Parse(reader["ID_Аккаунт"].ToString()), reader["Логин"].ToString(), reader["Пароль"].ToString()); } return(account); } }
public static Employee SearchEmployee(Account account) { using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("Login"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@log", account.Login); command.Parameters.AddWithValue("@pass", account.Password); command.Parameters.Add(new SqlParameter("@idEmployee", SqlDbType.Int)); command.Parameters["@idEmployee"].Direction = ParameterDirection.Output; connection.Open(); command.ExecuteNonQuery(); if (int.TryParse(command.Parameters["@idEmployee"].Value.ToString(), out int idEmployee)) { return(EmployeeDAO.GetEmployeeById(idEmployee)); } return(null); } }
internal static IEnumerable <DrivingCategory> GetEmployeesDrivingCategories(Employee employee) { List <DrivingCategory> drivingCategories = new List <DrivingCategory>(); using (SqlConnection connection = new SqlConnection(ActualConnectionString.Get())) { SqlCommand command = new SqlCommand("GetEmployeesDrivingCategories"); command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@id", employee.Id); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { drivingCategories.Add(new DrivingCategory(int.Parse(reader["ID_Категория"].ToString()), reader["Категория"].ToString())); } } return(drivingCategories); }