Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(Class1.total);

            if (textBox1.Text == "")
            {
                MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBox1.Clear();
                textBox1.Focus();
            }
            else if (a < b)
            {
                MessageBox.Show("Your Money Is Not Enough", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox1.Clear();
                textBox1.Focus();
            }
            else
            {
                using (DataClassesDataContext db = new DataClassesDataContext())
                {
                    Headerorder h = db.Headerorders.Where(s => s.OrderID == Class1.orderid).FirstOrDefault();
                    h.Payment = "Cash";
                    db.SubmitChanges();
                    MessageBox.Show("Success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    close.Enabled = true;
                    this.Close();
                }
            }
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (cbxPayment.SelectedItem == null || tbxCard.Text == "" || cbxBank.SelectedItem == null)
     {
         MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
         cbxPayment.SelectedItem = null;
         tbxCard.Clear();
         cbxBank.SelectedItem = null;
     }
     else
     {
         using (DataClassesDataContext db = new DataClassesDataContext())
         {
             Headerorder h = db.Headerorders.Where(s => s.OrderID == cbxOrderid.SelectedItem.ToString()).FirstOrDefault();
             h.Payment    = cbxPayment.SelectedItem.ToString();
             h.CardNumber = tbxCard.Text;
             h.bank       = cbxBank.SelectedItem.ToString();
             h.Date       = DateTime.Now;
             db.SubmitChanges();
             cbxPayment.SelectedItem = null;
             tbxCard.Clear();
             cbxBank.SelectedItem = null;
             dg1.DataSource       = null;
             lblTotal.Text        = "Total : 0";
             this.Refresh();
             MessageBox.Show("Success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Пример #3
0
 private void detach_Headerorders(Headerorder entity)
 {
     this.SendPropertyChanging();
     entity.Msemployee = null;
 }
Пример #4
0
 partial void DeleteHeaderorder(Headerorder instance);
Пример #5
0
 partial void UpdateHeaderorder(Headerorder instance);
Пример #6
0
 partial void InsertHeaderorder(Headerorder instance);
Пример #7
0
 private void attach_Headerorders(Headerorder entity)
 {
     this.SendPropertyChanging();
     entity.Msmember = this;
 }
Пример #8
0
 private void btnOrder_Click(object sender, EventArgs e)
 {
     try
     {
         using (DataClassesDataContext db = new DataClassesDataContext())
         {
             if (dg2.DataSource == null)
             {
                 MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 awal();
             }
             else
             {
                 Headerorder d = db.Headerorders.OrderByDescending(s => s.OrderID).FirstOrDefault();
                 if (d != null)
                 {
                     string auto = d.OrderID.ToString().Substring(6, 4);
                     int    n    = Convert.ToInt32(auto) + 1;
                     c = DateTime.Today.ToString("yyyyMM") + n.ToString("d4");
                 }
                 else
                 {
                     c = DateTime.Today.ToString("yyyyMM") + "0001";
                 }
                 int         dd;
                 Detailorder ddd = db.Detailorders.OrderByDescending(s => s.Detailid).FirstOrDefault();
                 if (ddd != null)
                 {
                     string autonumber = ddd.Detailid.ToString();
                     int    n          = Convert.ToInt32(autonumber) + 1;
                     dd = Convert.ToInt32(n.ToString("d1"));
                 }
                 else
                 {
                     dd = 1;
                 }
                 var             a = c;
                 List <Msmember> m = db.Msmembers.Select(s => s).ToList();
                 db.Headerorders.InsertOnSubmit(new Headerorder
                 {
                     OrderID    = a,
                     Employeeid = emp.EmployeeID,
                     Date       = Convert.ToDateTime(DateTime.Today.ToString("yyyy-MM-dd")),
                     Memberid   = m[cbxMember.SelectedIndex].MemberID
                 });
                 db.SubmitChanges();
                 foreach (menuu i in list)
                 {
                     db.Detailorders.InsertOnSubmit(new Detailorder
                     {
                         Detailid = dd,
                         Orderid  = a,
                         Menuid   = Convert.ToInt32(i.kodemenu),
                         Qty      = i.Qty,
                         Price    = i.Price,
                         Status   = "Pending"
                     });
                     db.SubmitChanges();
                 }
                 MessageBox.Show("Successfully Order Data", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 awal();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Try Again, Please Contact Admin", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         awal();
     }
 }