示例#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}");
                }
            }
        }
示例#2
0
 private void detach_Places(Places entity)
 {
     this.SendPropertyChanging();
     entity.Cultures = null;
 }
示例#3
0
 private void attach_Places(Places entity)
 {
     this.SendPropertyChanging();
     entity.Cultures = this;
 }
示例#4
0
 partial void DeletePlaces(Places instance);
示例#5
0
 partial void UpdatePlaces(Places instance);
示例#6
0
 partial void InsertPlaces(Places instance);