private void AddButton_Click(object sender, EventArgs e)
 {
     try
     {
         ConvertData();
         EstateObjects.Insert(SqlConnection, Status, OwnerId, Price, Address, District, Description, RealtyTypes, TradeTypes, Area, Rooms, LandDescription, LandArea);
         MessageBox.Show("Запись добавлена");
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private static void GetCellValue(Excel.Worksheet sheet, SqlConnection sqlConnection)
        {
            int lastRow = sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Row; // Последняя заполненная строка

            string[,] mas = new string[lastRow, 4];                                          // Выделяем память под массив строк

            mas = ArrRange(2, 1, lastRow, 12, sheet);                                        // Получаем данные с листа

            for (int l = 0; l < lastRow - 1; l++)                                            // Заполняем массив
            {
                int    statusId        = Convert.ToInt32(mas[l, 0]);
                int    ownerId         = Convert.ToInt32(mas[l, 1]);
                float  price           = (float)Convert.ToDouble(mas[l, 2]);
                string addres          = mas[l, 3];
                int    district        = Convert.ToInt32(mas[l, 4]);
                string description     = mas[l, 5];
                int    realtytype      = Convert.ToInt32(mas[l, 6]);
                int    tradetype       = Convert.ToInt32(mas[l, 7]);
                float  area            = (float)Convert.ToDouble(mas[l, 8]);
                byte   rooms           = Convert.ToByte(mas[l, 9]);
                string landdescription = mas[l, 10];
                float  landarea        = (float)Convert.ToDouble(mas[l, 11]);
                try
                {
                    if (realtytype == 3)
                    {
                        EstateObjects.Insert(sqlConnection, statusId, ownerId, price, addres, district, description, realtytype, tradetype, area, rooms, landdescription, landarea);
                    }
                    if (realtytype == 1)
                    {
                        EstateObjects.Insert(sqlConnection, statusId, ownerId, price, addres, district, description, realtytype, tradetype, area, rooms);
                    }
                    if (realtytype == 2)
                    {
                        EstateObjects.Insert(sqlConnection, statusId, ownerId, price, addres, district, description, realtytype, tradetype, area);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                }
            }
        }