Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            using (var db = new AGRODataContext(Server.MapPath("\\")))
            {
                var mPrice = double.TryParse(TextBox2.Text, out double _mPrice)
                    ? _mPrice
                    : (double?)null;

                var pCulture = int.TryParse(CultureDropDown.SelectedValue, out int _pCulture)
                    ? _pCulture
                    : (int?)null;

                var pAnimals = int.TryParse(AnimalsDropDown.SelectedValue, out int _pAnimals)
                    ? _pAnimals
                    : (int?)null;

                var place = new Places
                {
                    Pname    = TextBox1.Text.Trim(),
                    MPrice   = mPrice,
                    PCulture = pCulture,
                    PAnimals = pAnimals
                };

                db.Places.InsertOnSubmit(place);

                try
                {
                    db.SubmitChanges();
                    BindGrid();
                }

                catch (Exception exception)
                {
                    Debug.WriteLine($"Somethig wrong: {exception.Message}");
                }
            }
        }
Exemplo n.º 2
0
 private void detach_Places(Places entity)
 {
     this.SendPropertyChanging();
     entity.Cultures = null;
 }
Exemplo n.º 3
0
 private void attach_Places(Places entity)
 {
     this.SendPropertyChanging();
     entity.Cultures = this;
 }
Exemplo n.º 4
0
 partial void DeletePlaces(Places instance);
Exemplo n.º 5
0
 partial void UpdatePlaces(Places instance);
Exemplo n.º 6
0
 partial void InsertPlaces(Places instance);