protected void btnSolutionAdd_Click(object sender, EventArgs e)
    {
        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.ToInt16(drpTopic.SelectedValue);
        ObjSolution.Solution = drpSolutionType.SelectedValue;
        ObjSolution.Insert();
        Solutionid = ObjSolutionKeyword.Get_SolutionId();
        ObjSolutionKeyword.Keywords   = txtKeywords.Text.ToString();
        ObjSolutionKeyword.Solutionid = Solutionid;
        ObjSolutionKeyword.Insert();
        ObjSolutionCreator.Solutionid = Solutionid;
        ObjSolutionCreator.Createdby  = objUser.Userid;
        ObjSolutionCreator.Insert();
        objSentMailToUser.SentMailToPManager(Solutionid);
        Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid);
    }
    protected void btnSolutionAdd_Click(object sender, EventArgs e)
    {///Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            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 = drpSolutionType.SelectedValue;
            ObjSolution.Insert();
            Solutionid = ObjSolutionKeyword.Get_SolutionId();
            ObjSolutionKeyword.Keywords   = txtKeywords.Text.ToString();
            ObjSolutionKeyword.Solutionid = Solutionid;
            ObjSolutionKeyword.Insert();
            ObjSolutionCreator.Solutionid = Solutionid;
            ObjSolutionCreator.Createdby  = objUser.Userid;
            ObjSolutionCreator.Insert();
            objSentMailToUser.SentMailToPManager(Solutionid);
            Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid);
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
Example #3
0
    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;
        }
    }