示例#1
0
        private void button16_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            if (tbxthanhtoan.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập thanh toán");
            }
            else
            {
                int sotienconlai = int.Parse(tbxthanhtoan.Text) - int.Parse(tbxtongtien.Text);
                tbxsotienconlai.Text = sotienconlai.ToString();
                if (sotienconlai > 0)
                {
                    var b = db.TBL_HOADONCTs.Where(p => p.MAHDBAN.Equals(tbxmahoadon.Text));
                    foreach (var r in b)
                    {
                        r.THANHTOAN = true;
                    }
                    TBL_HOADON a = new TBL_HOADON();
                    a.MAHDBAN   = tbxmahoadon.Text;
                    a.MANV      = "NV02";
                    a.TONGTIEN  = int.Parse(tbxtongtien.Text);
                    a.NGAYBAN   = dateTimengaylap.Value;
                    a.THANHTOAN = true;
                    Table <TBL_HOADON> c = db.GetTable <TBL_HOADON>();
                    c.InsertOnSubmit(a);
                    db.SubmitChanges();
                }
            }
        }
示例#2
0
 private void check()
 {
     DataClasses1DataContext db = new DataClasses1DataContext();
     if (tbxthanhtoan.Text=="")
     {
         MessageBox.Show("Bạn chưa nhập thanh toán");
     }
     else
     {
         int sotienconlai = int.Parse(tbxthanhtoan.Text) - int.Parse(tbxtongtien.Text);
         tbxsotienconlai.Text = sotienconlai.ToString();
         if(sotienconlai>0)
         {
             TBL_HOADON b = db.TBL_HOADONs.Single(p => p.MAHDBAN.Equals(tbxmahoadon.Text));
             b.THANHTOAN = true;
         }
     }
 }
 partial void DeleteTBL_HOADON(TBL_HOADON instance);
 partial void UpdateTBL_HOADON(TBL_HOADON instance);
 partial void InsertTBL_HOADON(TBL_HOADON instance);