protected void btnOK_Click(object sender, EventArgs e) { clsOrder AnOrder = new clsOrder(); string orderId = txtBxOrderId.Text; string staffId = txtBxStaffId.Text; string customerId = txtBxCustomerId.Text; string date = txtBxDate.Text; string details = txtBxDetails.Text; string error = AnOrder.Validate(orderId, customerId, staffId, date, details); clssupplierCollection orders = new clssupplierCollection(); if (error == "") { AnOrder.OrderId = Convert.ToInt32(orderId); AnOrder.StaffId = Convert.ToInt32(staffId); AnOrder.CustomerId = Convert.ToInt32(customerId); AnOrder.Date = Convert.ToDateTime(date); AnOrder.Details = details; Session["AnOrder"] = AnOrder; clssupplierCollection orderList = new clssupplierCollection(); if (!AnOrder.exists(AnOrder.OrderId)) { orderList.ThisOrder = AnOrder; orderList.Add(); } else { orderList.ThisOrder = AnOrder; orderList.Update(); } } else { lblError.Text = error; } Response.Redirect("OrderViewer.aspx"); }