protected void btnOrder_Click(object sender, EventArgs e) { try { if (btnOrder.Text == "NEW ORDER") { order = Order.Create(); } else { //if (MessageBox.Show("Are you sure you wish to save this order?", "Bismark", MessageBoxButtons.YesNo, MessageBoxIcon.Question) // == DialogResult.Yes) // { OrderCUD.Create(order); //MessageBox.Show("Order created succesffully! \n" + //"Please save your order number: " + order.OrderId); txtOrderId.Text = order.OrderId.ToString(); ClearFields(); order = Order.Create(); order.EmployeeId = Convert.ToInt32(Session["EmployeeId"]); order.Department = (Department)Enum.Parse(typeof(Department), Session["Department"].ToString(), true); txtSubTotal.Text = string.Empty; txtTaxTotal.Text = string.Empty; txtGrandTotal.Text = string.Empty; txtOrderStatus.Text = "Pending"; btnOrder.Text = "NEW ORDER"; RefreshData(); // } } } catch (Exception ex) { messageBox.Text = ex.Message; } }
private void btnSaveOrder_Click(object sender, EventArgs e) { try { if (btnOrder.Text == "NEW ORDER") { order = Order.Create(); order.EmployeeId = employee.EmployeeId; item = Item.Create(); btnOrder.Text = "SAVE ORDER"; DisableFields(false); } else { if (MessageBox.Show("Are you sure you wish to save this order?", "Bismark", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { OrderCUD.Create(order); MessageBox.Show("Order created succesffully! \n" + "Please save your order number: " + order.OrderId); txtOrderId.Text = order.OrderId.ToString(); ClearFields(); order = Order.Create(); order.EmployeeId = employee.EmployeeId; order.Department = employee.JobAssignment.Department; txtSubTotal.Text = string.Empty; txtTaxTotal.Text = string.Empty; txtGrandTotal.Text = string.Empty; txtOrderStatus.Text = "Pending"; btnOrder.Text = "NEW ORDER"; DisableFields(true); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Bismark", MessageBoxButtons.OK, MessageBoxIcon.Error); } }