コード例 #1
0
        public void InsertToBase()
        {
            danie d = new danie
            {
                Aftor  = "123",
                God    = 1234,
                Gorod  = "qwe",
                Ilustr = "2",
                Mesto  = "qwe"
            };

            dcont.danies.InsertOnSubmit(d);
            dcont.SubmitChanges();
        }
コード例 #2
0
ファイル: inserting.cs プロジェクト: forknapkin/Geologiya
        private void buttonOk_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(Util.ID.ToString());

            if (Util.Insert) // Insert
            {
                int N, Year;

                Int32.TryParse(textBoxNumber.Text, out N);
                Int32.TryParse(textBoxYear.Text, out Year);

                danie d = new danie
                {
                    Aftor   = textBoxAutor.Text,
                    God     = Year,
                    Gorod   = textBoxSity.Text,
                    Ilustr  = textBoxImages.Text,
                    Mesto   = textBoxPlace.Text,
                    Naz     = textBoxName.Text,
                    nomer   = N,
                    Org     = textBoxOrg.Text,
                    Referat = textBoxReferat.Text,
                    Slova   = textBoxKeyWords.Text,
                    Str     = textBoxStr.Text,
                    tema1   = textBoxTema1.Text,
                    tema2   = textBoxTema2.Text
                };

                //MainForm mf = new MainForm();
                //mf.dGridView.Rows.Add(d);


                MainForm.dcont.danies.InsertOnSubmit(d);
            }
            else // Update
            {
                int N, Year;

                Int32.TryParse(textBoxNumber.Text, out N);
                Int32.TryParse(textBoxYear.Text, out Year);

                var res = MainForm.tabDanie.Where(wh => wh.ID == Util.ID).FirstOrDefault();

                res.Naz    = textBoxName.Text;
                res.Aftor  = textBoxAutor.Text;
                res.Ilustr = textBoxImages.Text;
                res.Slova  = textBoxKeyWords.Text;
                res.Org    = textBoxOrg.Text;
                res.Mesto  = textBoxPlace.Text;

                res.nomer = N;

                res.Referat = textBoxReferat.Text;
                res.Gorod   = textBoxSity.Text;
                res.Str     = textBoxStr.Text;
                res.tema1   = textBoxTema1.Text;
                res.tema2   = textBoxTema2.Text;

                res.God = Year;
            }
            MainForm.dcont.SubmitChanges();
            Close();
        }
コード例 #3
0
 partial void Updatedanie(danie instance);
コード例 #4
0
 partial void Deletedanie(danie instance);
コード例 #5
0
 partial void Insertdanie(danie instance);