Exemplo n.º 1
0
 private void dg1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (isRows)
     {
         DataGridViewRow row = dg1.Rows[e.RowIndex];
         using (DataClassesDataContext db = new DataClassesDataContext())
         {
             int         id = Convert.ToInt32(row.Cells["Detailid"].Value.ToString());
             Detailorder d  = db.Detailorders.Where(s => s.Detailid == id).FirstOrDefault();
             d.Status = row.Cells["Action"].Value.ToString();
             db.SubmitChanges();
         }
     }
 }
Exemplo n.º 2
0
 private void autonumber()
 {
     using (DataClassesDataContext db = new DataClassesDataContext())
     {
         Detailorder d = db.Detailorders.OrderByDescending(s => s.Detailid).FirstOrDefault();
         if (d != null)
         {
             string a = d.Detailid.ToString().Substring(6, 4);
             int    n = Convert.ToInt32(a) + 1;
             c = DateTime.Today.ToString("yyyyMM") + n.ToString("d4");
         }
         else
         {
             c = DateTime.Today.ToString("yyyyMM") + "0001";
         }
     }
 }
Exemplo n.º 3
0
 private void detach_Detailorders(Detailorder entity)
 {
     this.SendPropertyChanging();
     entity.Headerorder = null;
 }
Exemplo n.º 4
0
 partial void DeleteDetailorder(Detailorder instance);
Exemplo n.º 5
0
 partial void UpdateDetailorder(Detailorder instance);
Exemplo n.º 6
0
 partial void InsertDetailorder(Detailorder instance);
Exemplo n.º 7
0
 private void attach_Detailorders(Detailorder entity)
 {
     this.SendPropertyChanging();
     entity.Msmenu = this;
 }
Exemplo n.º 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();
     }
 }