private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iEquipOperatorId = Convert.ToInt32(ddAssignTo.SelectedValue); equip.sNote = tbNote.Text; equip.EquipAssignedTo(); Response.Redirect("e_view.aspx?id="+EquipId.ToString(), false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_reassign.aspx?id=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip!=null) { equip.Dispose(); } } }
private void btSave_FormSubmit(object sender, EventArgs e) { try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { EquipId=Convert.ToInt32(Request.QueryString["id"]); } catch(FormatException fex) { Session["lastpage"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } equip = new clsEquipment(); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iAssignedTo = Convert.ToInt32(ddAssignTo.SelectedValue); equip.sNote = tbNote.Text; equip.EquipAssignedTo(); Response.Redirect(ParentPageURL, false); } catch(Exception ex) { _functions.Log("Application error: \n" + ex.ToString()); Session["lastpage"] = "reassign.aspx?id=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip!=null) { equip.Dispose(); } } }
private void repOperators_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { try { if(e.CommandName == "Select") { UserId = Convert.ToInt32(e.CommandArgument); // assign operator to equipment equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iEquipOperatorId = UserId; equip.sNote = "changing old operator to new during Roadside Repair procedure"; equip.EquipAssignedTo(); pnlSelectOperator.Visible = false; pnlVerifyOperator.Visible = true; EquipmentDetails(); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_selectOperator.aspx?equipid=" + EquipId.ToString() + "&orderid=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); } }
/// <summary> /// Activating/Inactivating the user account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach(RepeaterItem _item in repOperatorEquipments.Items) { DropDownList ddlOperators = (DropDownList)_item.FindControl("ddlOperators"); bool IsNobody = Convert.ToBoolean(ddlOperators.Attributes["IsNobody"]); if(!IsNobody && ddlOperators.SelectedValue == "0") { Header.ErrorMessage = "Operator is required"; return; } equip.iOrgId = OrgId; equip.iId = Convert.ToInt32(ddlOperators.Attributes["EquipId"]); equip.iEquipOperatorId = Convert.ToInt32(ddlOperators.SelectedValue); equip.sNote = "Deactivated Operator - Reassigned New Operator"; equip.EquipAssignedTo(); } user = new clsUsers(); user.iOrgId = OrgId; user.daCreated = DateTime.Now; user.iLoginId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach(RepeaterItem _item in repWorkOrders.Items) { DropDownList ddlTechs = (DropDownList)_item.FindControl("ddlTechs"); bool IsNobody = Convert.ToBoolean(ddlTechs.Attributes["IsNobody"]); if(!IsNobody && ddlTechs.SelectedValue == "0") { Header.ErrorMessage = "Technician is required"; return; } user.iOrderId = Convert.ToInt32(ddlTechs.Attributes["OrderId"]); user.iId = Convert.ToInt32(ddlTechs.SelectedValue); user.SetNewTechToWorkOrder(); } user = new clsUsers(); user.iOrgId = OrgId; user.iId = UserId; user.bActiveStatus = (bool)ViewState["Active"]; if(user.UserActive() == -1) { Session["lastpage"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } if(UserId == _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true)) Response.Redirect("default.aspx", false); else { // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); if(((bool)ViewState["Active"])) finish.sMainText = "The user has been activated successfully"; else finish.sMainText = "The user has been deactivated successfully"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "selectMode.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[View the User Detail]"; finish.sViewURL = "admin_user_detail.aspx?id=" + UserId.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(user != null) user.Dispose(); if(equip != null) equip.Dispose(); } }