private void button4_Click(object sender, EventArgs e) { GIATOUR g = new GIATOUR(); g.GIA = int.Parse(textBox2.Text); g.THANGBD = comboBox2.SelectedItem.ToString(); g.THANGKT = comboBox3.SelectedItem.ToString(); int now = DateTime.Now.Month, bd = int.Parse(g.THANGBD), kt = int.Parse(g.THANGKT); if (bd > kt) { kt += 12; } if (bd <= now && now < kt) { g.current = true; textBox4.Text = textBox2.Text; } else { g.current = false; } gia.Add(g); textBox2.Text = ""; gridControl2.DataSource = gia; gridControl2.RefreshDataSource(); }
public static int them(GIATOUR g) { try { QLTOUR.them(g); return(1); } catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public static void them(GIATOUR g) { db.GIATOURs.Add(g); db.SaveChanges(); }