private void Form2_Load(object sender, EventArgs e) { CGrid(); POC(); ORGrid(); OPRefreshGrid(); PRefreshGrid(); CRefreshGrid(); LGrid(); LRefreshGrid(); AllDataContext dc = new AllDataContext(); Ordr o = new Ordr(); int?p = dc.Ordrs.Max(cu => (int?)cu.Id); if (p == null) { p = 0; } var u = p + 1; lblOId.Text = u.ToString(); }
private void addOrder() //Add Order Method { AllDataContext dc = new AllDataContext(); Ordr o = new Ordr(); o.Id = Convert.ToInt32(lblOId.Text); o.C_Id = q; o.Amount = lblTAmount.Text; o.OrderDate = label1.Text; if (radioButton1.Checked) { o.Payment = radioButton1.Text; } else if (radioButton2.Checked) { o.Payment = radioButton2.Text; } dc.Ordrs.InsertOnSubmit(o); dc.SubmitChanges(); t = o.Id; }