protected void btnupdateRootcause_Click(object sender, EventArgs e) { string prev_value; string curnt_value; int historyid; int problemid = Convert.ToInt16(Request.QueryString[0]); #region For updating values in Problem history table ObjProblemHistory.Problemid = problemid; MembershipUser User = Membership.GetUser(); string username = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); int userid = ObjUser.Get_By_UserName(username, Objorganization.Orgid); ObjProblemHistory.Operationownerid = userid; ObjProblemHistory.Operation = "RootcauseUpdated"; ObjProblemHistory.Insert(); #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() historyid = ObjProblemHistory.Get_Current_ProblemHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjProblem = ObjProblem.Get_By_id(problemid); #endregion #region Find the value of current symptom ObjProblemRootcause = ObjProblemRootcause.Get_By_id(ObjProblem.ProblemId); #endregion #region Insert the values in history difference table prev_value = Convert.ToString(ObjProblemRootcause.Description); curnt_value = Convert.ToString(EditorRootcause.Text); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = "Description"; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); #endregion ObjProblemRootcause.Problemid = problemid; ObjProblemRootcause.Description = EditorRootcause.Text.ToString(); ObjProblemRootcause.Update(); ShowRootcausePlaceholder(); btnupdateRootcause.Visible = false; btnsaveRootcause.Visible = false; btncancellRootcause.Visible = false; EditorRootcause.Visible = false; lnkRootcauseedit.Visible = true; lnkRootcauseadd.Visible = false; ShowImpactPlaceholder(); ShowSymptomPlaceholder(); }
protected void btnupdateRootcause_Click(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { string prev_value; string curnt_value; int historyid; int problemid = Convert.ToInt32(Request.QueryString[0]); #region For updating values in Problem history table ObjProblemHistory.Problemid = problemid; MembershipUser User = Membership.GetUser(); string username = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); int userid = ObjUser.Get_By_UserName(username, Objorganization.Orgid); ObjProblemHistory.Operationownerid = userid; ObjProblemHistory.Operation = "RootcauseUpdated"; ObjProblemHistory.Insert(); #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() historyid = ObjProblemHistory.Get_Current_ProblemHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjProblem = ObjProblem.Get_By_id(problemid); #endregion #region Find the value of current symptom ObjProblemRootcause = ObjProblemRootcause.Get_By_id(ObjProblem.ProblemId); #endregion #region Insert the values in history difference table prev_value = Convert.ToString(ObjProblemRootcause.Description); curnt_value = Convert.ToString(EditorRootcause.Text); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = "Description"; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); #endregion ObjProblemRootcause.Problemid = problemid; ObjProblemRootcause.Description = EditorRootcause.Text.ToString(); ObjProblemRootcause.Update(); ShowRootcausePlaceholder(); btnupdateRootcause.Visible = false; btnsaveRootcause.Visible = false; btncancellRootcause.Visible = false; EditorRootcause.Visible = false; lnkRootcauseedit.Visible = true; lnkRootcauseadd.Visible = false; ShowImpactPlaceholder(); ShowSymptomPlaceholder(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }