public void updatecomment() { string userName; MembershipUser User = Membership.GetUser(); solutionstatusid = Convert.ToInt16(Request.QueryString[0]); flag = Convert.ToInt16(Request.QueryString[1]); int userid; if (flag == 3) { string seeionsid = Session["SolutionId"].ToString(); string[] str = seeionsid.Split(new char[] { ',' }); foreach (string s in str) { if (s == "") { break; } int solid = Convert.ToInt16(s); ObjSolution = ObjSolution.Get_By_id(solid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } } else { int solutionid = Convert.ToInt16(Request.QueryString[1]); ObjSolution = ObjSolution.Get_By_id(solutionid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solutionid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } }
protected void btnSolutionAdd_Click(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { string Prev_value = ""; string Curr_value = ""; int SolutionType = Convert.ToInt32(Request.QueryString[0]); int problemid = Convert.ToInt32(Request.QueryString[1]); if (SolutionType != 0) { if (SolutionType == 1) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Solution = "WorkAround"; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjproblemToSolution.Problemid = problemid; ObjproblemToSolution.Solutionid = Solutionid; ObjproblemToSolution.Solutiontype = "WorkAround"; ObjproblemToSolution.Insert(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); } if (SolutionType == 4) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); problemid = Convert.ToInt32(Request.QueryString[1]); colproblems = ObjproblemToSolution.Get_All_Problemid(problemid); foreach (ProblemToSolution obj in colproblems) { if (obj.Solutiontype == "WorkAround") { ObjSolution.Solutionid = obj.Solutionid; } } ObjSolution.Solution = "WorkAround"; ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Update(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Convert.ToInt32(ObjSolution.Solutionid); ObjSolutionKeyword.Update(); ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.LastUpdateon = DateTime.Now.ToString(); ObjSolutionCreator.Update(); } if (SolutionType == 3) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); problemid = Convert.ToInt32(Request.QueryString[1]); colproblems = ObjproblemToSolution.Get_All_Problemid(problemid); foreach (ProblemToSolution obj in colproblems) { if (obj.Solutiontype == "Solution") { ObjSolution.Solutionid = obj.Solutionid; } } ObjSolution.Solution = "Solution"; ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Update(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Convert.ToInt32(ObjSolution.Solutionid); ObjSolutionKeyword.Update(); ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.LastUpdateon = DateTime.Now.ToString(); ObjSolutionCreator.Update(); } if (SolutionType == 2) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); // ObjproblemToSolution = ObjproblemToSolution.Get_All_Problemid(problemid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Solution = "Solution"; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjproblemToSolution.Problemid = problemid; ObjproblemToSolution.Solutionid = Solutionid; ObjproblemToSolution.Solutiontype = "Solution"; ObjproblemToSolution.Insert(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); } } string myScript; myScript = "<script language=javascript>refreshParent();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }