Ejemplo n.º 1
0
    public void StartTest(string guid, string commaseparatedbatches, string commaseparatedcommands, string priority)
    {
        BSTUser bu = new BSTUser("", "bst");

        string[] batches = commaseparatedbatches.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string batch in batches)
        {
            TestRequest.RunBatch4Request(bu.LOGIN, batch, guid, priority);
        }
        if (!string.IsNullOrEmpty(commaseparatedcommands))
        {
            TestRequest tr          = new TestRequest("", guid);
            string      txtcommands = string.Join("\r\n", commaseparatedcommands.Split(','));
            string[]    Commands;
            string[]    arrGroup;
            TestRequest.GetCommandsGroups(txtcommands, out Commands, out arrGroup);
            Schedule.AddCommands(Commands, arrGroup, tr.ID.ToString(), bu.ID.ToString(), priority);
        }
    }
Ejemplo n.º 2
0
    protected void ImageButton_Run(object sender, ImageClickEventArgs e)
    {
        string errorMail = "";

        if (!CurrentContext.Admin)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Access denied')", true);
            return;
        }

        string RequestID = Request.Params["RequestID"];

        if (string.IsNullOrEmpty(RequestID))
        {
            RequestID = "NULL";
        }
        else
        {
            FeedLog("Test request has been changed. Task: " + GetValue("SELECT T.TTID FROM TESTREQUESTS T WHERE ID = " + RequestID));
        }

        string strPRIORITY = PriorityList.SelectedItem.Value;

        string[] Commands;
        string[] arrGroup;

        TestRequest.GetCommandsGroups(FileTextBox.Text, out Commands, out arrGroup);

        TestRequest.SetAdditionalCommands(TextBoxBefore.Text.Replace("'", "''").Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None), TextBoxAfter.Text.Replace("'", "''").Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None), RequestID);

        // get user id

        DataSet DS        = GetDataSet(@"select T2.ID from PERSONS T2 where T2.USER_LOGIN = '******'");
        string  strUserID = DS.Tables[0].Rows[0][0].ToString();

        Schedule.AddCommands(Commands, arrGroup, RequestID, strUserID, strPRIORITY);

        ImageButtonRun.Enabled = false;
        FileTextBox.Enabled    = false;

        //set request priority
        if (RequestID != "NULL")
        {
            SQLExecute(string.Format("update TESTREQUESTS set REQUEST_PRIORITY = {0} where ID = {1}", strPRIORITY, RequestID));
        }
        //set testing person and send email to programmer
        if (RequestID != "NULL")
        {
            TestRequest r = new TestRequest(RequestID);
            Version     v = new Version(r.VERSIONID);

            if (r.USERID == "")
            {
                r.USERID = CurrentContext.UserID.ToString();
                r.Store();

                string body = string.Format(@"
				Your request for version ({0}) test was processed by: {1}
				<br>Your version: ({2} <a href='http://{3}/runs.aspx?R.RequestID={4}'>{0}</a>)
				<br>{5}
				<br>{6}
				<br>
				<br>Your version will be tested as soon as possible.
				<br>Person responsible: <b>{1}</b>
				<br>Best regards, <b>{1}</b>
				"                ,
                                            v.VERSION, CurrentContext.UserName(), r.REQUESTDATETIME, Settings.CurrentSettings.BSTADDRESS, RequestID, r.TTID, r.COMMENT);

                string tasknumber = Regex.Match(r.TTID.ToUpper(), "TT[0-9]+").Value.Replace("TT", "");
                if (!String.IsNullOrEmpty(tasknumber))
                {
                    DefectConnector.NotifyDefectWorker(tasknumber, string.Format("Your request for {0} test was processed by: {1}", tasknumber, CurrentContext.UserName()), CurrentContext.User.PHONE);
                }

                AddEmail(
                    r.PROGABB
                    , string.Format("Your request for version ({0}) test was processed by: {1}", v.VERSION, CurrentContext.UserName())
                    , body
                    , "#FEFCFF");
            }
        }

        LabelError.Visible = false;
        if (errorMail != "")
        {
            LabelError.Text    = errorMail;
            LabelError.Visible = true;
        }
        else if (getBackUrl != null)
        {
            Response.Redirect(Server.UrlDecode(getBackUrl));
        }
    }