Ejemplo n.º 1
0
        private void deleteBlend(DataGridViewSelectedRowCollection listSelectBlend)
        {
            try
            {
                foreach (DataGridViewRow k in listSelectBlend)
                {
                    using (EntrepotBDDataContext db = new EntrepotBDDataContext())
                    {
                        string  name  = k.Cells["name"].Value.ToString();
                        tb_liga blend = (from b in db.tb_ligas
                                         where b.liga == name
                                         select b).FirstOrDefault();

                        db.tb_ligas.DeleteOnSubmit(blend);
                        db.SubmitChanges();
                    }
                }

                MessageBox.Show("success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                chargeGridView();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            try
            {
                using (EntrepotBDDataContext db = new EntrepotBDDataContext())
                {
                    tb_liga blend = new tb_liga();

                    blend.liga = textBox1.Text;
                    db.tb_ligas.InsertOnSubmit(blend);
                    db.SubmitChanges();
                    chargeCombo();
                    MessageBox.Show("success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox1.Clear();
                    chargeGridView();
                    textBox1.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }