コード例 #1
0
ファイル: Land.xaml.cs プロジェクト: Hellsis/Sessions
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            int plus;
            int minus;

            try
            {
                Entities db = new Entities();
                db.lands.Load();
                land newAp = new land();
                newAp.Address_City   = Ac.Text;
                newAp.Address_House  = Ah.Text;
                newAp.Address_Number = An.Text;
                newAp.Address_Street = As.Text;
                try
                {
                    plus  = Convert.ToInt32(Cl.Text);
                    minus = Convert.ToInt32(Cl.Text);
                    if (plus >= -90 && minus <= 180)
                    {
                        newAp.Coordinate_latitude = Cl.Text;
                    }
                    else
                    {
                        newAp.Coordinate_latitude = "";
                    }
                }
                catch
                {
                    newAp.Coordinate_latitude = "";
                }

                try
                {
                    plus  = Convert.ToInt32(Clo.Text);
                    minus = Convert.ToInt32(Clo.Text);
                    if (plus >= -90 && minus <= 180)
                    {
                        newAp.Coordinate_longitude = Clo.Text;
                    }
                    else
                    {
                        newAp.Coordinate_longitude = "";
                    }
                }
                catch
                {
                    newAp.Coordinate_longitude = "";
                }
                newAp.TotalArea = Convert.ToDouble(Ta.Text);
                db.lands.Add(newAp);
                db.SaveChanges();
            }
            catch
            {
            }
        }
コード例 #2
0
ファイル: Land.xaml.cs プロジェクト: Hellsis/Sessions
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Entities db = new Entities();
         db.lands.Load();
         var  nub  = Convert.ToInt64(DeleteId.Text);
         land delS = db.lands.Where(p => p.Id == nub).FirstOrDefault();
         db.lands.Remove(delS);
         db.SaveChanges();
     }
     catch
     {
     }
 }
コード例 #3
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Entities db = new Entities();
                db.lands.Load();
                var  nub   = Convert.ToInt64(UpdateId.Text);
                land newAp = db.lands.Where(p => p.Id == nub).FirstOrDefault();
                if (AcU.Text != "")
                {
                    newAp.Address_City = AcU.Text;
                }
                if (AhU.Text != "")
                {
                    newAp.Address_House = AhU.Text;
                }
                if (AnU.Text != "")
                {
                    newAp.Address_Number = AnU.Text;
                }
                if (AsU.Text != "")
                {
                    newAp.Address_Street = AsU.Text;
                }
                if (ClU.Text != "")
                {
                    newAp.Coordinate_latitude = ClU.Text;
                }
                if (CloU.Text != "")
                {
                    newAp.Coordinate_longitude = CloU.Text;
                }
                if (TaU.Text != "")
                {
                    newAp.TotalArea = TaU.Text;
                }

                db.SaveChanges();
            }
            catch
            {
            }
        }
コード例 #4
0
 private void Add_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Entities db = new Entities();
         db.lands.Load();
         land newAp = new land();
         newAp.Address_City         = Ac.Text;
         newAp.Address_House        = Ah.Text;
         newAp.Address_Number       = An.Text;
         newAp.Address_Street       = As.Text;
         newAp.Coordinate_latitude  = Cl.Text;
         newAp.Coordinate_longitude = Clo.Text;
         newAp.TotalArea            = Ta.Text;
         db.lands.Add(newAp);
         db.SaveChanges();
     }
     catch
     {
     }
 }