protected void gvOrders_RowDeleting(object sender, GridViewDeleteEventArgs e) { SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient(); try { SvcKitchen.ServiceResult result = svc.DeleteOrder(int.Parse(gvOrders.Rows[e.RowIndex].Cells[2].Text)); if (result.ErrorCode == 0) { GetOrders(); lblInfo.ForeColor = System.Drawing.Color.DarkGreen; } else { lblInfo.ForeColor = System.Drawing.Color.DarkRed; } lblInfo.Text = result.Message; } catch { lblInfo.ForeColor = System.Drawing.Color.DarkRed; lblInfo.Text = "There was an error attempting to delete the order."; } }
protected void btnDelete_Click(object sender, EventArgs e) { SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient(); SvcKitchen.ServiceResult result; try { result = svc.DeleteOrder(order.ID); if (result.ErrorCode == 0) { Response.Redirect("~/Orders"); } lblStatus.ForeColor = System.Drawing.Color.DarkRed; lblStatus.Text = result.Message; } catch { lblStatus.ForeColor = System.Drawing.Color.DarkRed; lblStatus.Text = "There was an error attempting to delete the order."; } }