protected void Button1_Click(object sender, EventArgs e)
    {
        String objrefname      = Request.Form["objrefname"].ToString();
        String Status          = Request.Form["Status"].ToString();
        String selectedproject = Request.Form["activeProject"].ToString();
        String Des             = Request.Form["des"].ToString();
        String value           = Request.Form["value"].ToString();
        String Modifiable      = Request.Form["Modifiable"].ToString();
        String global          = Request.Form["global"].ToString();
        int    projectid       = 0;

        value = value.Replace("'", "''");
        value = value.Replace("\r\n", string.Empty);
        value = value.Trim().ToString();
        //lblresult.Text = "";
        DataSet ds    = null;
        int     check = 0;

        if (objrefname != "" && value != "")
        {
            duplicatecheck = "select * from obj_repository where obj_ref_name = '{0}' and projectid= {1}";

            qry = string.Format(duplicatecheck, objrefname, selectedproject);



            if (obj.getDs(qry, out ds, "dsdt"))
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ispresent = true;
                }
            }
            qry = string.Format(insertobjectrepo, selectedproject, objrefname, value, Des, Status, global, Modifiable);
            if (ispresent == true)
            {
                if (obj.insert(qry, out temp))
                {
                    if (temp == 1)
                    {
                        // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                        Response.Write("<script LANGUGE='JavaScript'> alert('" + objrefname + " Obj Repository created sucessfully  ')</script>");
                    }
                    else
                    {
                        Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new object referance name')</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('" + objrefname + " name already exists  ')</script>");
            }
        }
        else
        {
            Response.Write("<script LANGUGE='JavaScript'> alert('please select language and test case name')</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String actionname      = Request.Form["actiontype"].ToString();
        String Status          = Request.Form["Status"].ToString();
        String selectedproject = Request.Form["activeProject"].ToString();
        String Des             = Request.Form["des"].ToString();
        String exitiffail      = Request.Form["exit"].ToString();
        String Modifiable      = Request.Form["Modifiable"].ToString();
        String global          = Request.Form["global"].ToString();


        //lblresult.Text = "";
        DataSet ds = null;


        if (actionname != "" && selectedproject != "")
        {
            duplicatecheck = "select * from actiontype where actiontypename = '{0}' and projectid= {1}";

            qry = string.Format(duplicatecheck, actionname, selectedproject);



            if (obj.getDs(qry, out ds, "dsdt"))
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ispresent = true;
                }
            }
            qry = string.Format(inseractiontype, selectedproject, actionname, Des, global, Modifiable, exitiffail, Status);

            if (ispresent == true)
            {
                if (obj.insert(qry, out temp))
                {
                    if (temp == 1)
                    {
                        // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                        Response.Write("<script LANGUGE='JavaScript'> alert('" + actionname + " Action type created sucessfully  ')</script>");
                    }
                    else
                    {
                        Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new action type name')</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('" + actionname + " name already exists  ')</script>");
            }
        }
        else
        {
            Response.Write("<script LANGUGE='JavaScript'> alert('please select action and project name')</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String testcasename = Request.Form["Testcasename"].ToString();
        String language     = Request.Form["language"].ToString();
        String Des          = Request.Form["des"].ToString();
        String Status       = Request.Form["Status"].ToString();
        String Priority     = Request.Form["Priority"].ToString();

        //lblresult.Text = "";
        DataSet ds    = null;
        int     check = 0;

        if (testcasename != "" && language != "")
        {
            duplicatecheck = "select * from testcases where testcasename = '{0}'";

            qry = string.Format(duplicatecheck, testcasename);



            if (obj.getDs(qry, out ds, "dsdt"))
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ispresent = true;
                }
            }
            qry = string.Format(inserttestcase, testcasename, Des, Status, language, Priority, activeprojectname);
            if (ispresent == true)
            {
                if (obj.insert(qry, out temp))
                {
                    if (temp == 1)
                    {
                        // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                        Response.Write("<script LANGUGE='JavaScript'> alert('" + testcasename + " Test Case created sucessfully  ')</script>");
                    }
                    else
                    {
                        Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new testcase')</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('" + testcasename + " Test Case name already exists  ')</script>");
            }
        }
        else
        {
            Response.Write("<script LANGUGE='JavaScript'> alert('please select language and test case name')</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String CountryCode = Request.Form["Countrycode"].ToString();
        String CountryName = Request.Form["Countryname"].ToString();
        String Status      = Request.Form["Status"].ToString();

        qry = string.Format(insertlanguage, CountryName, Status, CountryCode);
        if (obj.insert(qry, out temp))
        {
            if (temp == 1)
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('" + CountryCode + " Country Code created sucessfully  ')</script>");
            }
            else
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new countrycode')</script>");
            }
        }
    }
Exemplo n.º 5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        String ProjectName = Request.Form["Projectname"].ToString();
        String Status      = Request.Form["Status"].ToString();
        String Des         = Request.Form["des"].ToString();

        //lblresult.Text = "";

        qry = string.Format(insertproject, ProjectName, Des, Status);
        if (obj.insert(qry, out temp))
        {
            if (temp == 1)
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('" + ProjectName + " Project created sucessfully  ')</script>");
                //lblresult.Text = " " + txtprojectname.Text.ToString() + " Project created sucessfully";
            }
            else
            {
                Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new project')</script>");
                //lblresult.Text = "Error in creating new project";
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //var checkBoxes = document.getElementsByName("Obj_ref_Checkboxes");
        string  testcaseid = Session["tcnameid"].ToString();
        var     Browsertype = Request.Form["BrowserType"].ToString();
        var     ActionType = Request.Form["ActionType"].ToString();
        var     Status = Request.Form["Status"].ToString();
        var     Obj_ref_id = Request.Form["obj_ReferenceName_Value1"].ToString();
        var     Value = Request.Form["targetValue"].ToString();
        var     Comments = Request.Form["comments"].ToString();
        int     StepId = Convert.ToInt32(Request.QueryString["NewStep"].Trim());
        Boolean ispresent = true;
        DataSet ds = null;
        string  duplicatecheck = "", qry = "";
        int     currentstepid = 0;

        if (testcaseid != "" && StepId != null)
        {
            duplicatecheck = "select * from test_case_design_steps where id={0}";

            qry = string.Format(duplicatecheck, StepId);



            //if (obj.getDs(qry, out ds, "dsdt"))
            //{


            //    if (ds.Tables[0].Rows.Count == 0)
            //    {
            //        ispresent = true;
            //    }
            //    else
            //    {
            //        ispresent = true;
            //    }



            //}

            if (ispresent == true)
            {
                MySql.Data.MySqlClient.MySqlConnection con    = obj.getSQLConnection();
                MySql.Data.MySqlClient.MySqlDataReader reader = null;

                if (StepId == 0)
                {
                    StepId++;
                    qry = string.Format(insertnewstep, StepId, testcaseid, ActionType, Obj_ref_id, Browsertype, Status, Value, Comments);
                    if (obj.insert(qry, out temp))
                    {
                        if (temp == 1)
                        {
                            // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                            Response.Write("<script LANGUGE='JavaScript'> alert('Step Created sucessfully  ')</script>");
                            Session["ActiveTestcase"] = testcaseid;
                            Response.Redirect("Default2.aspx");
                        }
                        else
                        {
                            Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new step')</script>");
                        }
                    }
                }
                else
                {
                    reader = obj.executeQueryResults(qry);
                    while (reader.Read())
                    {
                        currentstepid = Convert.ToInt32(reader["stepid"]);
                        currentstepid++;
                    }

                    qry = " update test_case_design_steps set stepid=(stepid+1) where stepid >= " + currentstepid + " and testcaseid = " + testcaseid + "";

                    if (obj.Update(qry, out temp))
                    {
                        //if (temp != 0)
                        //{
                        qry = string.Format(insertnewstep, currentstepid, testcaseid, ActionType, Obj_ref_id, Browsertype, Status, Value, Comments);
                        if (obj.insert(qry, out temp))
                        {
                            if (temp == 1)
                            {
                                // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                                Response.Write("<script LANGUGE='JavaScript'> alert('Step Created sucessfully  ')</script>");
                                Session["ActiveTestcase"] = testcaseid;
                                Response.Redirect("Default2.aspx");
                            }
                            else
                            {
                                Response.Write("<script LANGUGE='JavaScript'> alert('Error in creating new step')</script>");
                            }
                        }

                        // }
                        else
                        {
                        }
                    }
                }
            }
            else
            {
                //Response.Write("<script LANGUGE='JavaScript'> alert('" + actionname + " name already exists  ')</script>");
            }
        }
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        List <string> Browserlist = new List <string>();
        List <string> Oslist      = new List <string>();

        //String ChromeID = Request.Form["chromeid"];

        if (Chrome.Checked)
        {
            Browserlist.Add("CHROME");
        }
        if (IE.Checked)
        {
            Browserlist.Add("IE");
        }
        if (FIREFOX.Checked)
        {
            Browserlist.Add("FIREFOX");
        }
        if (SAFARI.Checked)
        {
            Browserlist.Add("SAFARI".ToUpper());
        }
        if (IosApp.Checked)
        {
            Browserlist.Add("APP".ToUpper());
        }

        if (Windows.Checked)
        {
            Oslist.Add("Windows".ToUpper());
        }

        if (Android.Checked)
        {
            Oslist.Add("Android".ToUpper());
        }

        if (IOS.Checked)
        {
            Oslist.Add("IOS".ToUpper());
        }
        String OsText = "";

        foreach (String os in Oslist)
        {
            OsText = os.ToString();
        }

        String TestcaseName = Request.Form["Obj_ref_Checkboxes"].ToString();
        //ArrayList browserlist = new
        String AgentName = Request.Form["Testagent"].ToString();
        String BuildPath = Request.Form["BuildPath"].ToString();

        //     String arg = @" -jar "+BuildPath+" "+TestcaseName+" "+""+"-user=someone";// just an example this can be anything
        // string command = "java.exe";
        //System.Diagnostics.ProcessStartInfo start = new System.Diagnostics.ProcessStartInfo(command, arg);
        // start.UseShellExecute = false;
        // start.CreateNoWindow = true;
        // System.Diagnostics.Process.Start(start);

        foreach (string c in Browserlist)
        {
            String[] testcases = TestcaseName.Split(',');
            foreach (String testcase in testcases)
            {
                String arg     = @" -jar " + BuildPath + " " + testcase + " " + c + " " + OsText;// just an example this can be anything
                string command = "java.exe";
                System.Diagnostics.ProcessStartInfo start = new System.Diagnostics.ProcessStartInfo(command, arg);
                // start.WorkingDirectory = Path.GetDirectoryName(BuildPath);
                start.UseShellExecute = false;
                // start.WindowStyle = ProcessWindowStyle.Normal;
                System.Diagnostics.Process.Start(start);

                qry = String.Format(insertBuildsQuery, c, testcase, AgentName, "curdate()", BuildPath, OsText);

                if (obj.insert(qry, out temp))
                {
                    if (temp == 1)
                    {
                        // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
                        //Response.Write("<script LANGUGE='JavaScript'> alert('" + objrefname + " Obj Repository created sucessfully  ')</script>");
                        System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo(BuildPath);
                        //
                        // System.Diagnostics.Process.Start(ps);
                        // Thread.Sleep(50000);
                    }
                    else
                    {
                        Response.Write("<script LANGUGE='JavaScript'> alert('Error in running the test case')</script>");
                    }
                }
            }


            //System.Diagnostics.Process.WaitForExit();
            //System.Diagnostics.Process
        }
        //for (int i = 0; i <= Browserlist.Length; i++)
        //{
        //    qry = String.Format(insertBuildsQuery, Browserlist[i], TestcaseName, AgentName, DateTime.Now, BuildPath);

        //    //if (obj.insert(qry, out temp))
        //    //{
        //    //    if (temp == 1)
        //    //    {
        //    //        // lblresult.Text = " " + txttestcase.Text.ToString() + " Testcase created sucessfully";
        //    //        //Response.Write("<script LANGUGE='JavaScript'> alert('" + objrefname + " Obj Repository created sucessfully  ')</script>");
        //    //        System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo(BuildPath);

        //    //        System.Diagnostics.Process.Start(ps);
        //    //        Thread.Sleep(10000);
        //    //    }
        //    //    else
        //    //    {
        //    //        Response.Write("<script LANGUGE='JavaScript'> alert('Error in running the test case')</script>");
        //    //    }
        //    //}
        //}
    }