/// <summary> /// Selecting or creating of the Work Order for /// current Equipment if for current equipment there aren't /// the scheduled work order then it will be created. /// If there are one work order then select him. /// If them more than one then we are selecting the one that has /// the scheduled time by closer to the current moment. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btNext_FormSubmit(object sender, EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iEquipId = EquipId; order.daCurrentDate = DateTime.Now; order.dmMileage = Convert.ToDecimal(tbUnits.Text); order.iUserId = op.Id; order.SelectWorkOrder(); Response.Redirect("ok_addIssues.aspx?orderid=" + order.iId.Value.ToString() + "&equipid=" + EquipId.ToString(), false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_editCurrentUnits.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(order != null) order.Dispose(); } }