예제 #1
0
        private void listView2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewRealEstateSet_Land.SelectedItems.Count == 1)
            {
                Объекты_недвижимостиSet объекты_Недвижимости = listViewRealEstateSet_Land.SelectedItems[0].Tag as Объекты_недвижимостиSet;

                textboxAddress_City.Text         = объекты_Недвижимости.Address_City;
                textBoxAddress_Street.Text       = объекты_Недвижимости.Address_Street;
                textBoxAddress_House.Text        = объекты_Недвижимости.Address_House;
                textBoxAddress_Number.Text       = объекты_Недвижимости.Address_Number;
                textBoxCoordinate_latitude.Text  = объекты_Недвижимости.Coordinate_latitude.ToString();
                textBoxCoodrinate_longitude.Text = объекты_Недвижимости.Coordinate_longitude.ToString();
                textBoxTotalArea.Text            = объекты_Недвижимости.TotalArea.ToString();
                textBoxRooms.Text = объекты_Недвижимости.Rooms.ToString();
                textBoxFloor.Text = объекты_Недвижимости.Floor.ToString();
            }
            else
            {
                textboxAddress_City.Text         = "";
                textBoxAddress_House.Text        = "";
                textBoxAddress_Street.Text       = "";
                textBoxAddress_Number.Text       = "";
                textBoxCoordinate_latitude.Text  = "";
                textBoxCoodrinate_longitude.Text = "";
                textBoxTotalArea.Text            = "";
                textBoxRooms.Text = "";
                textBoxFloor.Text = "";
            }
        }
예제 #2
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (comboBoxType.SelectedIndex == 0)
         {
             if (listViewRealEstateSet_Apartment.SelectedItems.Count == 1)
             {
                 Объекты_недвижимостиSet объекты_Недвижимости = listViewRealEstateSet_Apartment.SelectedItems[0].Tag as Объекты_недвижимостиSet;
                 Program.wftDb.Объекты_недвижимостиSet.Remove(объекты_Недвижимости);
                 Program.wftDb.SaveChanges();
                 showОбъекты_недвижимостиSet();
             }
             textboxAddress_City.Text         = "";
             textBoxAddress_Street.Text       = "";
             textBoxAddress_House.Text        = "";
             textBoxAddress_Number.Text       = "";
             textBoxCoordinate_latitude.Text  = "";
             textBoxCoodrinate_longitude.Text = "";
             textBoxTotalArea.Text            = "";
             textBoxRooms.Text = "";
             textBoxFloor.Text = "";
         }
         else if (comboBoxType.SelectedIndex == 1)
         {
             if (listViewRealEstateSet_House.SelectedItems.Count == 1)
             {
                 Объекты_недвижимостиSet объекты_Недвижимости = listViewRealEstateSet_House.SelectedItems[0].Tag as Объекты_недвижимостиSet;
                 Program.wftDb.Объекты_недвижимостиSet.Remove(объекты_Недвижимости);
                 Program.wftDb.SaveChanges();
                 showОбъекты_недвижимостиSet();
             }
             textboxAddress_City.Text         = "";
             textBoxAddress_Street.Text       = "";
             textBoxAddress_House.Text        = "";
             textBoxAddress_Number.Text       = "";
             textBoxCoordinate_latitude.Text  = "";
             textBoxCoodrinate_longitude.Text = "";
             textBoxTotalArea.Text            = "";
             textBoxTotalFloors.Text          = "";
         }
         else
         {
             if (listViewRealEstateSet_Land.SelectedItems.Count == 1)
             {
                 Объекты_недвижимостиSet объекты_Недвижимости = listViewRealEstateSet_Land.SelectedItems[0].Tag as Объекты_недвижимостиSet;
                 Program.wftDb.Объекты_недвижимостиSet.Remove(объекты_Недвижимости);
                 Program.wftDb.SaveChanges();
                 showОбъекты_недвижимостиSet();
             }
         }
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Объекты_недвижимостиSet объекты_недвижимости = new Объекты_недвижимостиSet();

            объекты_недвижимости.Address_City         = textboxAddress_City.Text;
            объекты_недвижимости.Address_House        = textBoxAddress_House.Text;
            объекты_недвижимости.Address_Street       = textBoxAddress_Street.Text;
            объекты_недвижимости.Address_Number       = textBoxAddress_Number.Text;
            объекты_недвижимости.Coordinate_latitude  = Convert.ToDouble(textBoxCoordinate_latitude.Text);
            объекты_недвижимости.Coordinate_longitude = Convert.ToDouble(textBoxCoodrinate_longitude.Text);
            объекты_недвижимости.TotalArea            = Convert.ToDouble(textBoxTotalArea.Text);

            if (comboBoxType.SelectedIndex == 0)
            {
                объекты_недвижимости.Type  = 0;
                объекты_недвижимости.Rooms = Convert.ToInt32(textBoxRooms.Text);
                объекты_недвижимости.Floor = Convert.ToInt32(textBoxFloor.Text);
            }
            else if (comboBoxType.SelectedIndex == 1)
            {
                объекты_недвижимости.Type = 1;
                if (textBoxTotalFloors.Text != "")
                {
                    объекты_недвижимости.TotalFloors = Convert.ToInt32(textBoxTotalFloors.Text);
                }
            }

            else
            {
                объекты_недвижимости.Type = 2;
            }

            Program.wftDb.Объекты_недвижимостиSet.Add(объекты_недвижимости);
            Program.wftDb.SaveChanges();
            showОбъекты_недвижимостиSet();
        }
예제 #4
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (comboBoxType.SelectedIndex == 0)
            {
                if (listViewRealEstateSet_Apartment.SelectedItems.Count == 1)
                {
                    Объекты_недвижимостиSet объекты_недвижимости = listViewRealEstateSet_Apartment.SelectedItems[0].Tag as Объекты_недвижимостиSet;
                    объекты_недвижимости.Address_City         = textboxAddress_City.Text;
                    объекты_недвижимости.Address_House        = textBoxAddress_House.Text;
                    объекты_недвижимости.Address_Street       = textBoxAddress_Street.Text;
                    объекты_недвижимости.Address_Number       = textBoxAddress_Number.Text;
                    объекты_недвижимости.Coordinate_latitude  = Convert.ToDouble(textBoxCoordinate_latitude.Text);
                    объекты_недвижимости.Coordinate_longitude = Convert.ToDouble(textBoxCoodrinate_longitude.Text);
                    объекты_недвижимости.TotalArea            = Convert.ToDouble(textBoxTotalArea.Text);
                    объекты_недвижимости.Rooms = Convert.ToInt32(textBoxRooms.Text);
                    объекты_недвижимости.Floor = Convert.ToInt32(textBoxFloor.Text);

                    Program.wftDb.SaveChanges();
                    showОбъекты_недвижимостиSet();
                }
            }

            else if (comboBoxType.SelectedIndex == 1)
            {
                if (listViewRealEstateSet_House.SelectedItems.Count == 1)
                {
                    Объекты_недвижимостиSet объекты_недвижимости = listViewRealEstateSet_House.SelectedItems[0].Tag as Объекты_недвижимостиSet;

                    объекты_недвижимости.Address_City   = textboxAddress_City.Text;
                    объекты_недвижимости.Address_House  = textBoxAddress_House.Text;
                    объекты_недвижимости.Address_Street = textBoxAddress_Street.Text;
                    объекты_недвижимости.Address_Number = textBoxAddress_Number.Text;
                    if (textBoxCoordinate_latitude.Text != "")
                    {
                        объекты_недвижимости.Coordinate_latitude = Convert.ToDouble(textBoxCoordinate_latitude.Text);
                    }
                    if (textBoxCoodrinate_longitude.Text != "")
                    {
                        объекты_недвижимости.Coordinate_longitude = Convert.ToDouble(textBoxCoodrinate_longitude.Text);
                    }
                    if (textBoxTotalArea.Text != "")
                    {
                        объекты_недвижимости.TotalArea = Convert.ToDouble(textBoxTotalArea.Text);
                    }
                    if (textBoxTotalFloors.Text != "")
                    {
                        объекты_недвижимости.TotalFloors = Convert.ToInt32(textBoxTotalFloors.Text);
                    }

                    Program.wftDb.SaveChanges();
                    showОбъекты_недвижимостиSet();
                }
            }
            else
            {
                if (listViewRealEstateSet_Land.SelectedItems.Count == 1)
                {
                    Объекты_недвижимостиSet объекты_недвижимости = listViewRealEstateSet_Land.SelectedItems[0].Tag as Объекты_недвижимостиSet;
                    объекты_недвижимости.Address_City   = textboxAddress_City.Text;
                    объекты_недвижимости.Address_House  = textBoxAddress_House.Text;
                    объекты_недвижимости.Address_Street = textBoxAddress_Street.Text;
                    объекты_недвижимости.Address_Number = textBoxAddress_Number.Text;
                    if (textBoxCoordinate_latitude.Text != "")
                    {
                        объекты_недвижимости.Coordinate_latitude = Convert.ToDouble(textBoxCoordinate_latitude.Text);
                    }
                    if (textBoxCoodrinate_longitude.Text != "")
                    {
                        объекты_недвижимости.Coordinate_longitude = Convert.ToDouble(textBoxCoodrinate_longitude.Text);
                    }
                    if (textBoxTotalArea.Text != "")
                    {
                        объекты_недвижимости.TotalArea = Convert.ToDouble(textBoxTotalArea.Text);
                    }
                    Program.wftDb.SaveChanges();
                    showОбъекты_недвижимостиSet();
                }
            }
        }