private void buttonX2_Click(object sender, EventArgs e) { if (!"".Equals(textBoxUITypeEditor1.TextBox.Text) && !"".Equals(textBoxUITypeEditor2.TextBox.Text) && !"".Equals(textBoxUITypeEditor3.TextBox.Text) && !"".Equals(textBoxUITypeEditor4.TextBox.Text) && !"".Equals(textBoxUITypeEditor5.TextBox.Text)) { ex_ticket exTicket = new ex_ticket(); exTicket.date_ex = dateTimeInput1.Value; exTicket.id_distributor = Convert.ToInt32(textBoxUITypeEditor5.TextBox.Text); exTicket.id_accountant = (int)textBoxUITypeEditor4.Tag; exTicket.id_shipper = (int)textBoxUITypeEditor1.Tag; exTicket.id_storager = (int)textBoxUITypeEditor3.Tag; exTicket.id_write = (int)textBoxUITypeEditor2.Tag; int id = ex.Insert(exTicket); List <ex_ticket_detail> list = CheckData(id); if (list != null) { ex.Insert(list); DevComponents.DotNetBar.TabControl ff = (DevComponents.DotNetBar.TabControl) this.Parent.Parent; ff.Tabs.RemoveAt(ff.SelectedTabIndex); } else { MessageBox.Show("sss"); } } }
public int Insert(ex_ticket e) { Table <ex_ticket> table = data.GetTable <ex_ticket>(); table.InsertOnSubmit(e); data.SubmitChanges(); return(e.id_ex_ticket); }