示例#1
0
        protected void DataGridTests_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            FlattenedTestRequest testRequest;
            short testID;

            switch (e.CommandName)
            {
                case "Add":
                    testID = Convert.ToInt16(((DropDownList)e.Item.FindControl("AddTest")).SelectedItem.Value);

                    if (testID == 0)
                    {
                        this.LabelFormStatus.Text = "A blank row or heading was selected instead of a test. Please try again.";
                    }
                    else
                    {
                        testRequest = new FlattenedTestRequest();

                        testRequest.TestRequestID = 0;
                        testRequest.TestID = testID;
                        testRequest.TestName = ((DropDownList)e.Item.FindControl("AddTest")).SelectedItem.Text;
                        testRequest.Restarts = Convert.ToInt16(((DropDownList)e.Item.FindControl("AddRestart")).SelectedItem.Value);
                        testRequest.RunOrder = Convert.ToInt16(((DropDownList)e.Item.FindControl("AddRunOrder")).SelectedItem.Value);
                        testRequest.Status = FlattenedTestRequest.TestRequestStatus.New;

                        testRequests.Add(testRequest);

                        DataGridTests.ShowFooter = false;
                        BindData(testRequests);
                        this.ButtonAddTest.Enabled = true;
                    }
                    break;
            }
        }
示例#2
0
        private ArrayList UnpackageTestRequests(string joinedTestRequests)
        {
            char[] objectSeparator = {objectDelimiter};
            char[] fieldSeparator = {fieldDelimiter};
            string[] fields;
            FlattenedTestRequest tr;

            testRequests = new ArrayList();

            if (joinedTestRequests != "")
            {
                foreach (string request in joinedTestRequests.Split(objectSeparator))
                {
                    fields = request.Split(fieldSeparator);
                    tr = new FlattenedTestRequest();
                    tr.TestRequestID = Convert.ToInt16(fields[0]);
                    tr.TestID = Convert.ToInt16(fields[1]);
                    tr.TestName = fields[2];
                    tr.Restarts = Convert.ToInt16(fields[3]);
                    tr.RunOrder = Convert.ToInt16(fields[4]);
                    tr.Status = (FlattenedTestRequest.TestRequestStatus)Convert.ToInt16(fields[5]);

                    testRequests.Add(tr);
                }
            }

            return testRequests;
        }