private void btnClear_Click(object sender, EventArgs e) { mTable = new POS_Orders(); NewRecord = true; Refund = string.Empty; txtOrderNo.Text = string.Empty; cmbOrderType.SelectedIndex = 0; lookUpTables.EditValue = null; LookUpCustomers.EditValue = null; txtCustomerAddress.Text = string.Empty; lookUpDelivery.EditValue = null; txtNote.Text = string.Empty; Itemsdt.Rows.Clear(); grdSummary(); LookUpOrders.EditValue = null; }
void Retrieve(long id) { mTable = db.POS_Orders.Find(id); if (mTable == null) { btnClear_Click(null, null); return; } NewRecord = false; //txtOrderNo.Text = mTable.OrderNo.ToString(); cmbOrderType.SelectedValue = mTable.LookupOrderType_ID; cmbOrderType.SelectedValue = mTable.OrderStatus; LookUpCustomers.EditValue = mTable.Customer_ID; txtCustomerTel.Text = mTable.CustomerTel; txtCustomerAddress.Text = mTable.CustomerAddress; txtNote.Text = mTable.Note; lblTotal.Text = mTable.Total.ToString(); lblTax.Text = mTable.Tax.ToString(); lblDiscount.Text = mTable.Discount.ToString(); lblService.Text = mTable.Service.ToString(); lblDeliveryFees.Text = mTable.DeliveryFees.ToString(); lblTotalNet.Text = mTable.TotalNet.ToString(); var lst = (from mOrderD in db.POS_Orders2 from oitems in db.POS_Items.Where(oitems => oitems.ID == mOrderD.Item_ID).DefaultIfEmpty() from oSizes in db.POS_Sizes.Where(oSizes => oSizes.ID == mOrderD.Size_ID).DefaultIfEmpty() where mOrderD.Master_ID == id && mOrderD.Branch_ID == Settings.CurrentBranch_ID select new { mOrderD.ID, mOrderD.Item_ID, mOrderD.Size_ID, mOrderD.Qty, ItemName = mOrderD.Size_ID == null ? oitems.ItemName : oitems.ItemName + " - " + oSizes.SizeName, mOrderD.Note, mOrderD.Price, mOrderD.value, mOrderD.Discount, mOrderD.isPrint, mOrderD.isDelete, mOrderD.Perant_ID, mOrderD.UserCreate, mOrderD.UserLastModified, mOrderD.CreationDate, mOrderD.LastModified, mOrderD.Deleterow, mOrderD.UserDelete }).ToList(); Itemsdt.Rows.Clear(); foreach (var itm in lst) { Itemsdt.Rows.Add( itm.ID, itm.Item_ID, itm.Size_ID, itm.Qty, itm.ItemName, itm.Note, itm.Price, itm.value, itm.Discount, itm.isPrint, itm.isDelete, itm.Perant_ID, itm.UserCreate, itm.UserLastModified, itm.CreationDate, itm.LastModified, itm.Deleterow, itm.UserDelete ); } TreeItems.Refresh(); }