//Case 976: 1.3.1_GetPatient_N2_getCumulativeDose
        public void Run_Patient_GetPatient_CumulativeDose_Case976()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            string dose_value = string.Empty;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Cumulative Dose");

                PatientService ps = new PatientService();
                ImageService igs = new ImageService();

                XMLParameter cpatientData = new XMLParameter("patient");
                XMLParameter imageData = new XMLParameter("image");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        cpatientData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "Image")
                    {
                        imageData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        if (ids.InputParameters.GetParameter(i).Key == "area_dose_product")
                            dose_value = ids.InputParameters.GetParameter(i).Value;
                    }
                }
                if (isCreatePatient)
                {
                    CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                    r.CheckPoints.Add(pCreate);

                    XMLResult rslCreate = ps.createPatient(cpatientData);
                    if (!rslCreate.IsErrorOccured)
                    {
                        patientUID = rslCreate.SingleResult;
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                    }
                    else
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("create", "Create patient ERR", rslCreate.Message);
                        goto CLEANUP;
                    }
                }

                if (patientUID != null)
                {
                    imageData.AddParameter("patient_internal_id", patientUID);
                    CheckPoint imageSet = new CheckPoint("Create image", "Create image");
                    r.CheckPoints.Add(imageSet);
                    XMLResult rslCreateImage = igs.createImage(imageData);
                    if (rslCreateImage.IsErrorOccured)
                    {
                        imageSet.Outputs.AddParameter("Create", "Create Image Fail", rslCreateImage.Message);
                        imageSet.Result = TestResult.Fail;
                    }
                    else
                    {
                        imageSet.Outputs.AddParameter("Create", "Create Image UID", rslCreateImage.SingleResult);
                        imageSet.Result = TestResult.Pass;

                        CheckPoint pGet = new CheckPoint("Get Patient", "Get Cumulative Dose");
                        r.CheckPoints.Add(pGet);

                        XMLResult rslGet = ps.getPatient(patientUID);
                        if (!rslGet.IsErrorOccured && rslGet.Code == 0)
                        {
                            for (int j = 0; j < rslGet.ArrayResult.Parameters.Count; j++)
                            {
                                if (rslGet.ArrayResult.Parameters[j].ParameterName == "cumulative_dose")
                                {
                                    if (double.Parse(rslGet.ArrayResult.Parameters[j].ParameterValue) == double.Parse(dose_value))
                                    {
                                        pGet.Outputs.AddParameter("Get", "Get patient OK", rslGet.ResultContent);
                                        pGet.Result = TestResult.Pass;
                                    }
                                    else
                                    {
                                        pGet.Outputs.AddParameter("Get", "Get wrong dose_value", "Expect: " + dose_value + "; actually get: " + rslGet.ArrayResult.Parameters[j].ParameterValue);
                                        pGet.Result = TestResult.Fail;
                                        goto CLEANUP;
                                    }
                                }
                            }
                        }
                        else
                        {
                            pGet.Outputs.AddParameter("Get", "Get patient Error", rslGet.ResultContent);
                            pGet.Result = TestResult.Fail;
                        }
                    }
                }

            CLEANUP:
                SaveRound(r);
                if (isCreatePatient && !string.IsNullOrEmpty(patientUID))
                {
                    ps.deletePatient(patientUID);
                }
            }
            Output();
        }
        //Case 7: 1.3.7_CreatePresentationState_Normal
        public void Run_PS_CreatePresentationState_Normal_Case7()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test PresentationState Service: createPresentationState");

                try
                {
                    #region Parameter initialize
                    string imageInternalID = string.Empty;
                    XMLParameter p_CreateImage = new XMLParameter("image");
                    XMLParameter p_CreatePresentationState = new XMLParameter("presentationstate");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "createImage")
                        {
                            p_CreateImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        if (ids.InputParameters.GetParameter(i).Step == "createPresentationState")
                        {
                            p_CreatePresentationState.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                    }

                    bool ep_isReturnOK = true;
                    string ep_ReturnValue = string.Empty;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "createPresentationState")
                        {
                            if (ids.ExpectedValues.GetParameter(i).Key == "returnState")
                            {
                                if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("pass"))
                                {
                                    ep_isReturnOK = true;
                                }
                                else if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("fail"))
                                {
                                    ep_isReturnOK = false;
                                }
                            }
                            else if (ids.ExpectedValues.GetParameter(i).Key == "returnMessage")
                            {
                                ep_ReturnValue = ids.ExpectedValues.GetParameter(i).Value;
                            }
                        }
                    }
                    #endregion

                    ImageService imageService = new ImageService();
                    PresentationStateService psService = new PresentationStateService();

                    #region Step 1: Call ImageService.createImage to create a new image
                    CheckPoint cp_CreateImage = new CheckPoint("Image create", "Call imageService.createImage to create a new image");
                    r.CheckPoints.Add(cp_CreateImage);

                    XMLResult rt_CreateImage = imageService.createImage(p_CreateImage);
                    if (rt_CreateImage.IsErrorOccured)
                    {
                        cp_CreateImage.Result = TestResult.Fail;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns error", rt_CreateImage.Message);

                        SaveRound(r);
                        continue; // There is error when create image, end current run
                    }
                    else
                    {
                        cp_CreateImage.Result = TestResult.Pass;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns success", rt_CreateImage.Message);
                        imageInternalID = rt_CreateImage.SingleResult;
                    }
                    #endregion

                    #region Step 2: Call PresentationStateService.CreatePresentationState to create a PS for the image
                    CheckPoint cp_CreatePresentationState = new CheckPoint("Create PS", "Call PresentationStateService.CreatePresentationState to create a new ps");
                    r.CheckPoints.Add(cp_CreatePresentationState);

                    XMLResult rt_CreatePresentationState = psService.createPresentationState(imageInternalID, p_CreatePresentationState);
                    if (true == ep_isReturnOK) // Expect the call returns OK
                    {
                        if (rt_CreatePresentationState.IsErrorOccured)
                        {
                            cp_CreatePresentationState.Result = TestResult.Fail;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error", rt_CreatePresentationState.Message);
                        }
                        else
                        {
                            cp_CreatePresentationState.Result = TestResult.Pass;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns success", rt_CreatePresentationState.Message);
                        }
                    }
                    else // Expect the call return error
                    {
                        if (rt_CreatePresentationState.IsErrorOccured) // There is error
                        {
                            if (rt_CreatePresentationState.Message.ToLower().Contains(ep_ReturnValue.ToLower()))
                            {
                                cp_CreatePresentationState.Result = TestResult.Pass;
                                cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error as expected", rt_CreatePresentationState.Message);
                            }
                            else
                            {
                                cp_CreatePresentationState.Result = TestResult.Fail;
                                cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error message not match the expected. ", "Expect: " + ep_ReturnValue + "; Actually returns: " + rt_CreatePresentationState.Message);
                            }
                        }
                        else // There is no error
                        {
                            cp_CreatePresentationState.Result = TestResult.Fail;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS not returns error as expected. ", "Actually returns: " + rt_CreatePresentationState.Message);
                        }
                    }
                    #endregion

                    #region Step 3: Call ImageService.deleteImage to delete the created image
                    CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                    r.CheckPoints.Add(cp_DeleteImage);

                    XMLResult rt_DeleteImage = imageService.deleteImage(imageInternalID, new XMLParameter("preferences"));
                    if (rt_DeleteImage.IsErrorOccured)
                    {
                        cp_DeleteImage.Result = TestResult.Fail;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);
                    }
                    else
                    {
                        cp_DeleteImage.Result = TestResult.Pass;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    SaveRound(r);
                }
            }

            Output();
        }
        // Case 1178: 1.3.6_WorkFlow_N04_createImage_getImageInfo_getImageDescription_setImageInfo_getImageInfo_getImageDescription_deleteImage
        public void Run_Image_WorkFlow_Case1178()
        {
            int runCount = 0;
            string imageinternalUid = string.Empty;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test Image Service: createImage -> getImageInfo & getImageDescription -> setImageInfo ->  getImageInfo & getImageDescription -> deleteImage");

                try
                {
                    ImageService imageService = new ImageService();

                    #region Parameter Initialize
                    XMLParameter p_CreateImage = new XMLParameter("image");
                    XMLParameter p_SetImageInfo = new XMLParameter("image");
                    //XMLParameter p_SetImage_series = new XMLParameter("series");
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "createImage_image")
                        {
                            p_CreateImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        if (ids.InputParameters.GetParameter(i).Step == "setImageInfo")
                        {
                            p_SetImageInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        //if (ids.InputParameters.GetParameter(i).Step == "setImageInfo_series")
                        //{
                        //    p_SetImage_series.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        //}
                    }

                    XMLParameter ep_getImageInfoAfterCreate = new XMLParameter("image");
                    XMLParameter ep_getImageDescriptionAfterCreate = new XMLParameter("image");
                    //XMLParameter ep_getImageDescriptionAfterCreate_series = new XMLParameter("series");
                    XMLParameter ep_getImageInfoAfterSet = new XMLParameter("image");
                    XMLParameter ep_getImageDescriptionAfterSet = new XMLParameter("image");
                    //XMLParameter ep_getImageDescriptionAfterSet_series = new XMLParameter("series");
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "getImageInfo_AfterCreate")
                        {
                            ep_getImageInfoAfterCreate.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Step == "getImageDescription_AfterCreate")
                        {
                            ep_getImageDescriptionAfterCreate.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                        //else if (ids.ExpectedValues.GetParameter(i).Step == "getImageDescription_AfterCreate_series")
                        //{
                        //    ep_getImageDescriptionAfterCreate_series.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        //}
                        else if (ids.ExpectedValues.GetParameter(i).Step == "getImageInfo_AfterSet")
                        {
                            ep_getImageInfoAfterSet.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Step == "getImageDescription_AfterSet")
                        {
                            ep_getImageDescriptionAfterSet.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                        //else if (ids.ExpectedValues.GetParameter(i).Step == "getImageDescription_AfterSet_series")
                        //{
                        //    ep_getImageDescriptionAfterSet_series.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        //}
                    }
                    #endregion

                    #region Step 1: Call ImageService.createImage to create a new image
                    CheckPoint cp_CreateImage = new CheckPoint("Image create", "Call imageService.createImage to create a new image");
                    r.CheckPoints.Add(cp_CreateImage);

                    XMLResult rt_CreateImage = imageService.createImage(p_CreateImage);
                    if (rt_CreateImage.IsErrorOccured)
                    {
                        cp_CreateImage.Result = TestResult.Fail;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns error", rt_CreateImage.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_CreateImage.Result = TestResult.Pass;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns success", rt_CreateImage.Message);
                        imageinternalUid = rt_CreateImage.SingleResult;
                    }
                    #endregion

                    #region Step 2: Call imageService.getImageInfo to check the return value
                    CheckPoint cp_GetImageInfoAfterCreate = new CheckPoint("Get Image Info", "Call imageService.GetImageInfo to get Image Info after the image is created");
                    r.CheckPoints.Add(cp_GetImageInfoAfterCreate);

                    XMLParameter p_GetImageInfoAfterCreate = new XMLParameter("image");
                    p_GetImageInfoAfterCreate.AddParameter("internal_id", imageinternalUid);

                    XMLResult rt_GetImageInfoAfterCreate = imageService.getImageInfo(p_GetImageInfoAfterCreate);
                    if (rt_GetImageInfoAfterCreate.IsErrorOccured)
                    {
                        cp_GetImageInfoAfterCreate.Result = TestResult.Fail;
                        cp_GetImageInfoAfterCreate.Outputs.AddParameter("getImageInfo", "Get image info after create returns error", rt_GetImageInfoAfterCreate.Message);

                        goto CLEANUP;
                    }
                    else
                    {
                        //Check the value
                        bool isValueEqual = false;
                        bool isKeyShow = false;

                        foreach (XMLParameterNode psNode in ep_getImageInfoAfterCreate.Parameters)
                        {
                            isValueEqual = false;
                            isKeyShow = false;

                            int i = 0;
                            for (i = 0; i < rt_GetImageInfoAfterCreate.MultiResults[0].Parameters.Count; i++)
                            {
                                if (psNode.ParameterName == rt_GetImageInfoAfterCreate.MultiResults[0].Parameters[i].ParameterName)
                                {
                                    isKeyShow = true;
                                    isValueEqual = string.Equals(psNode.ParameterValue, rt_GetImageInfoAfterCreate.MultiResults[0].Parameters[i].ParameterValue);
                                    break; // End current for loop to search node
                                }
                            }

                            if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress
                            {
                                cp_GetImageInfoAfterCreate.Result = TestResult.Fail;

                                if (isKeyShow)
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageInfo does not match the expected.");
                                    cp_GetImageInfoAfterCreate.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after create image", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetImageInfoAfterCreate.MultiResults[0].Parameters[i].ParameterValue);
                                }
                                else
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageInfo does not contain the node: " + psNode.ParameterName);
                                    cp_GetImageInfoAfterCreate.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after create image", "The return value in getImageInfo does not contain the node: " + psNode.ParameterName);
                                }

                                break; // End current foreach loop, not compare the follwing nodes
                            }
                        }

                        if (isValueEqual)
                        {
                            cp_GetImageInfoAfterCreate.Result = TestResult.Pass;

                            System.Diagnostics.Debug.Print("The return values in getImageInfo all match the expected.");
                            cp_GetImageInfoAfterCreate.Outputs.AddParameter("getImageInfo", "Get image info after create returns success", rt_GetImageInfoAfterCreate.Message);
                            cp_GetImageInfoAfterCreate.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after create", "The return values in getImageInfo all match the expected");
                        }
                    }
                    #endregion

                    #region Step 3: Call ImageService.getImageDescription to check the return value
                    CheckPoint cp_GetImageDescriptionAfterCreate = new CheckPoint("Get Image Description", "Call Call imageService.GetImageDescription to get Image description after the image is created");
                    r.CheckPoints.Add(cp_GetImageDescriptionAfterCreate);

                    XMLResult rt_GetImageDescriptionAfterCreate = imageService.getImageDescription(imageinternalUid);
                    if (rt_GetImageDescriptionAfterCreate.IsErrorOccured)
                    {
                        cp_GetImageDescriptionAfterCreate.Result = TestResult.Fail;
                        cp_GetImageDescriptionAfterCreate.Outputs.AddParameter("getImageDescription", "Get image description after create returns error", rt_GetImageDescriptionAfterCreate.Message);

                        goto CLEANUP;
                    }
                    else
                    {
                        //Check the value
                        bool isValueEqual = false;
                        bool isKeyShow = false;

                        foreach (XMLParameterNode psNode in ep_getImageDescriptionAfterCreate.Parameters)
                        {
                            isValueEqual = false;
                            isKeyShow = false;

                            int i = 0;
                            for (i = 0; i < rt_GetImageDescriptionAfterCreate.MultiResults[0].Parameters.Count; i++)
                            {
                                if (psNode.ParameterName == rt_GetImageDescriptionAfterCreate.MultiResults[0].Parameters[i].ParameterName)
                                {
                                    isKeyShow = true;
                                    isValueEqual = string.Equals(psNode.ParameterValue, rt_GetImageDescriptionAfterCreate.MultiResults[0].Parameters[i].ParameterValue);
                                    break; // End current for loop to search node
                                }
                            }

                            if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress
                            {
                                cp_GetImageDescriptionAfterCreate.Result = TestResult.Fail;

                                if (isKeyShow)
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageDescription does not match the expected.");
                                    cp_GetImageDescriptionAfterCreate.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after create image", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetImageDescriptionAfterCreate.MultiResults[0].Parameters[i].ParameterValue);
                                }
                                else
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageDescription does not contain the node: " + psNode.ParameterName);
                                    cp_GetImageDescriptionAfterCreate.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after create image", "The return value in getImageDescription does not contain the node: " + psNode.ParameterName);
                                }
                                break; // End current foreach loop, not compare the follwing nodes
                            }
                        }

                        if (isValueEqual)
                        {
                            cp_GetImageDescriptionAfterCreate.Result = TestResult.Pass;

                            System.Diagnostics.Debug.Print("The return values in getImageDescription all match the expected.");
                            cp_GetImageDescriptionAfterCreate.Outputs.AddParameter("getImageDescription", "Get image Description after create returns success", rt_GetImageDescriptionAfterCreate.Message);
                            cp_GetImageDescriptionAfterCreate.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after create", "The return values in getImageDescription all match the expected");
                        }
                    }
                    #endregion

                    #region Step 4: Call imageService.setImageInfo to set image info
                    CheckPoint cp_SetImageInfoAfterCreate = new CheckPoint("Set Image Info", "Call  imageService.SetImageInfo to set Image Info after the image is created");
                    r.CheckPoints.Add(cp_SetImageInfoAfterCreate);

                    XMLResult rt_SetImageInfoAfterCreate = imageService.setImageInfo(p_SetImageInfo, imageinternalUid);
                    if (rt_SetImageInfoAfterCreate.IsErrorOccured)
                    {
                        cp_SetImageInfoAfterCreate.Result = TestResult.Fail;
                        cp_SetImageInfoAfterCreate.Outputs.AddParameter("setImageInfo", "Set image info after create returns error", rt_SetImageInfoAfterCreate.Message);

                        goto CLEANUP;
                    }
                    else
                    {
                        cp_SetImageInfoAfterCreate.Result = TestResult.Pass;
                        cp_SetImageInfoAfterCreate.Outputs.AddParameter("setImageInfo", "Set image info after create returns success", rt_SetImageInfoAfterCreate.Message);
                    }
                    #endregion

                    #region Step 5: Call imageService.getImageInfo to check the return value
                    CheckPoint cp_GetImageInfoAfterSet = new CheckPoint("Get Image Info", "Call imageService.GetImageInfo to get Image Info after set the image info");
                    r.CheckPoints.Add(cp_GetImageInfoAfterSet);

                    XMLParameter p_GetImageInfoAfterSet = new XMLParameter("image");
                    p_GetImageInfoAfterSet.AddParameter("internal_id", imageinternalUid);

                    XMLResult rt_GetImageInfoAfterSet = imageService.getImageInfo(p_GetImageInfoAfterSet);
                    if (rt_GetImageInfoAfterSet.IsErrorOccured)
                    {
                        cp_GetImageInfoAfterSet.Result = TestResult.Fail;
                        cp_GetImageInfoAfterSet.Outputs.AddParameter("getImageInfo", "Get image info after set returns error", rt_GetImageInfoAfterSet.Message);

                        goto CLEANUP;
                    }
                    else
                    {
                        //Check the value
                        bool isValueEqual = false;
                        bool isKeyShow = false;

                        foreach (XMLParameterNode psNode in ep_getImageInfoAfterSet.Parameters)
                        {
                            isValueEqual = false;
                            isKeyShow = false;

                            int i = 0;
                            for (i = 0; i < rt_GetImageInfoAfterSet.MultiResults[0].Parameters.Count; i++)
                            {
                                if (psNode.ParameterName == rt_GetImageInfoAfterSet.MultiResults[0].Parameters[i].ParameterName)
                                {
                                    isKeyShow = true;
                                    isValueEqual = string.Equals(psNode.ParameterValue, rt_GetImageInfoAfterSet.MultiResults[0].Parameters[i].ParameterValue);
                                    break; // End current for loop to search node
                                }
                            }

                            if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress
                            {
                                cp_GetImageInfoAfterSet.Result = TestResult.Fail;

                                if (isKeyShow)
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageInfo does not match the expected.");
                                    cp_GetImageInfoAfterSet.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after set image", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetImageInfoAfterSet.MultiResults[0].Parameters[i].ParameterValue);
                                }
                                else
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageInfo does not contain the node: " + psNode.ParameterName);
                                    cp_GetImageInfoAfterSet.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after set image", "The return value in getImageInfo does not contain the node: " + psNode.ParameterName);
                                }

                                break; // End current foreach loop, not compare the follwing nodes
                            }
                        }

                        if (isValueEqual)
                        {
                            cp_GetImageInfoAfterSet.Result = TestResult.Pass;

                            System.Diagnostics.Debug.Print("The return values in getImageInfo all match the expected.");
                            cp_GetImageInfoAfterSet.Outputs.AddParameter("getImageInfo", "Get image info after set returns success", rt_GetImageInfoAfterSet.Message);
                            cp_GetImageInfoAfterSet.Outputs.AddParameter("ImageInfo", "Check the values in getImageInfo return after set", "The return values in getImageInfo all match the expected");
                        }
                    }
                    #endregion

                    #region Step 6: Call ImageService.getImageDescription to check the return value
                    CheckPoint cp_GetImageDescriptionAfterSet = new CheckPoint("Get Image Description", "Call Call imageService.GetImageDescription to get Image description after the image is setd");
                    r.CheckPoints.Add(cp_GetImageDescriptionAfterSet);

                    XMLResult rt_GetImageDescriptionAfterSet = imageService.getImageDescription(imageinternalUid);
                    if (rt_GetImageDescriptionAfterSet.IsErrorOccured)
                    {
                        cp_GetImageDescriptionAfterSet.Result = TestResult.Fail;
                        cp_GetImageDescriptionAfterSet.Outputs.AddParameter("getImageDescription", "Get image description after set returns error", rt_GetImageDescriptionAfterSet.Message);

                        goto CLEANUP;
                    }
                    else
                    {
                        //Check the value
                        bool isValueEqual = false;
                        bool isKeyShow = false;

                        foreach (XMLParameterNode psNode in ep_getImageDescriptionAfterSet.Parameters)
                        {
                            isValueEqual = false;
                            isKeyShow = false;

                            int i = 0;
                            for (i = 0; i < rt_GetImageDescriptionAfterSet.MultiResults[0].Parameters.Count; i++)
                            {
                                if (psNode.ParameterName == rt_GetImageDescriptionAfterSet.MultiResults[0].Parameters[i].ParameterName)
                                {
                                    isKeyShow = true;
                                    isValueEqual = string.Equals(psNode.ParameterValue, rt_GetImageDescriptionAfterSet.MultiResults[0].Parameters[i].ParameterValue);
                                    break; // End current for loop to search node
                                }
                            }

                            if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress
                            {
                                cp_GetImageDescriptionAfterSet.Result = TestResult.Fail;

                                if (isKeyShow)
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageDescription does not match the expected.");
                                    cp_GetImageDescriptionAfterSet.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after set image", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetImageDescriptionAfterSet.MultiResults[0].Parameters[i].ParameterValue);
                                }
                                else
                                {
                                    System.Diagnostics.Debug.Print("The return value in getImageDescription does not contain the node: " + psNode.ParameterName);
                                    cp_GetImageDescriptionAfterSet.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after set image", "The return value in getImageDescription does not contain the node: " + psNode.ParameterName);
                                }
                                break; // End current foreach loop, not compare the follwing nodes
                            }
                        }

                        if (isValueEqual)
                        {
                            cp_GetImageDescriptionAfterSet.Result = TestResult.Pass;

                            System.Diagnostics.Debug.Print("The return values in getImageDescription all match the expected.");
                            cp_GetImageDescriptionAfterSet.Outputs.AddParameter("getImageDescription", "Get image Description after set returns success", rt_GetImageDescriptionAfterSet.Message);
                            cp_GetImageDescriptionAfterSet.Outputs.AddParameter("ImageDescription", "Check the values in getImageDescription return after set", "The return values in getImageDescription all match the expected");
                        }
                    }
                    #endregion

                CLEANUP:
                    #region Step 7: Call ImageService.deleteImage to delete the image
                    CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                    r.CheckPoints.Add(cp_DeleteImage);

                    XMLResult rt_DeleteImage = imageService.deleteImage(imageinternalUid, new XMLParameter("preferences"));
                    if (rt_DeleteImage.IsErrorOccured)
                    {
                        cp_DeleteImage.Result = TestResult.Fail;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_DeleteImage.Result = TestResult.Pass;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        //Case 55: 1.3.6_DeleteImage_Normal
        public void Run_Image_DeleteImage_Normal_Case55()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            string imageUID = string.Empty;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Create image");
                CheckPoint pCreate = new CheckPoint("Create patient", "Test create");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();
                ImageService ims = new ImageService();
                XMLParameter pa = new XMLParameter("patient");
                XMLParameter ia = new XMLParameter("image");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "image")
                    {
                        ia.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }
                if (isCreatePatient)
                {
                    XMLResult result = ps.createPatient(pa);
                    if (!result.IsErrorOccured)
                    {
                        patientUID = result.SingleResult;

                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                    }
                    else
                    {
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient return error: ", result.ResultContent);
                    }
                }

                CheckPoint cpCreateImage = new CheckPoint("Image create", "Test image");
                r.CheckPoints.Add(cpCreateImage);
                if (patientUID != null)
                {
                    ia.AddParameter("patient_internal_id", patientUID);
                    XMLResult imageRsl = ims.createImage(ia);
                    if (imageRsl.IsErrorOccured)
                    {
                        cpCreateImage.Result = TestResult.Fail;
                        cpCreateImage.Outputs.AddParameter("create", "Create image error", imageRsl.Message);
                    }
                    else
                    {
                        cpCreateImage.Result = TestResult.Pass;
                        cpCreateImage.Outputs.AddParameter("create", "Create image Id", imageUID);
                        imageUID = imageRsl.SingleResult;
                    }
                }
                if (imageUID != null)
                {
                    CheckPoint cpDeleteImage = new CheckPoint("Image delete", "Test image");
                    r.CheckPoints.Add(cpDeleteImage);

                    XMLParameter deletePreference = new XMLParameter("preferences");
                    deletePreference.AddParameter("completedFlag", "true");
                    XMLResult delImageRsl = ims.deleteImage(imageUID, deletePreference);
                    if (delImageRsl.IsErrorOccured)
                    {
                        cpDeleteImage.Result = TestResult.Fail;
                        cpDeleteImage.Outputs.AddParameter("delete", "delete image error", delImageRsl.Message);
                    }
                    else
                    {
                        cpDeleteImage.Result = TestResult.Pass;
                        cpDeleteImage.Outputs.AddParameter("delete", "delete image success", delImageRsl.Message);
                    }
                }

                if (!string.IsNullOrEmpty(patientUID))
                {
                    ps.deletePatient(patientUID);
                }

                SaveRound(r);
            }

            Output();
        }
        //Case 111: 1.3.6_SetCephTracing_Normal
        public void Run_Image_SetCephTracing_Normal_Case111()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test Image Service: createImage -> getImageInfo & getImageDescription -> setImageInfo ->  getImageInfo & getImageDescription -> deleteImage");

                try
                {
                    string imageinternalUid = null;
                    ImageService imageService = new ImageService();

                    #region Parameter Initialize
                    //Input parameter
                    XMLParameter p_CreateImage = new XMLParameter("image");
                    string p_SetCephTracing = null;
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "createImage")
                        {
                            p_CreateImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        if (ids.InputParameters.GetParameter(i).Step == "setCephTracing" && ids.InputParameters.GetParameter(i).Key == "cephTracing")
                        {
                            p_SetCephTracing = ids.InputParameters.GetParameter(i).Value;
                        }
                    }

                    //Output value
                    string ep_GetCephTraingReturn = null;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "getCephTracing" && ids.ExpectedValues.GetParameter(i).Key == "cephTracing")
                        {
                            ep_GetCephTraingReturn = ids.ExpectedValues.GetParameter(i).Value;
                        }

                    }
                    #endregion

                    #region Step 1: Call ImageService.createImage to create a new image
                    CheckPoint cp_CreateImage = new CheckPoint("Image create", "Call imageService.createImage to create a new image");
                    r.CheckPoints.Add(cp_CreateImage);

                    XMLResult rt_CreateImage = imageService.createImage(p_CreateImage);
                    if (rt_CreateImage.IsErrorOccured)
                    {
                        cp_CreateImage.Result = TestResult.Fail;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns error", rt_CreateImage.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_CreateImage.Result = TestResult.Pass;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns success", rt_CreateImage.Message);
                        imageinternalUid = rt_CreateImage.SingleResult;
                    }
                    #endregion

                    #region Step 2: Call ImageService.setCephTracing to set the Ceph Tracing
                    CheckPoint cp_SetCephTracing = new CheckPoint("Set cephTracing", "Call imageService.setCephTracing to set the cephTracing");
                    r.CheckPoints.Add(cp_SetCephTracing);

                    XMLResult rt_SetCephTracing = imageService.setCephTracing(p_SetCephTracing, imageinternalUid);
                    if (rt_SetCephTracing.IsErrorOccured)
                    {
                        cp_SetCephTracing.Result = TestResult.Fail;
                        cp_SetCephTracing.Outputs.AddParameter("setCephTracing", "Call imageService.setCephTracing returns error", rt_SetCephTracing.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_SetCephTracing.Result = TestResult.Pass;
                        cp_SetCephTracing.Outputs.AddParameter("setCephTracing", "Call imageService.setCephTracing returns success", rt_SetCephTracing.Message);
                    }
                    #endregion

                    #region Step 3: Call ImageService.getCephTracing to get the Ceph tracing info
                    CheckPoint cp_GetCephTracing = new CheckPoint("getCephTracing", "Call ImageService.getCephTracing to get the Ceph tracing info");
                    r.CheckPoints.Add(cp_GetCephTracing);

                    XMLResult getCephTracingResult = imageService.getCephTracing(imageinternalUid);

                    if (getCephTracingResult.IsErrorOccured)
                    {
                        cp_GetCephTracing.Result = TestResult.Fail;

                        System.Diagnostics.Debug.Print("Call ImageService.getCephTracing to get the Ceph tracing info returns error.");
                        cp_GetCephTracing.Outputs.AddParameter("getCephTracing", "Call ImageService.getCephTracing to get the Ceph tracing info", getCephTracingResult.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        // Check the return value
                        if (String.Equals(getCephTracingResult.SingleResult.Replace("\n", "").Replace("\r", ""), ep_GetCephTraingReturn.Replace("\n", "").Replace("\r", "")))
                        {
                            cp_GetCephTracing.Result = TestResult.Pass;

                            System.Diagnostics.Debug.Print("Call ImageService.getCephTracing to get the Ceph tracing info succeeds.");
                            cp_GetCephTracing.Outputs.AddParameter("getCephTracing", "Call ImageService.getCephTracing to get the Ceph tracing info", getCephTracingResult.Message);
                        }
                        else
                        {
                            cp_GetCephTracing.Result = TestResult.Fail;

                            System.Diagnostics.Debug.Print("Call ImageService.getCephTracing to get the Ceph tracing info return value is not correct.");
                            cp_GetCephTracing.Outputs.AddParameter("getCephTracing", "Call ImageService.getCephTracing to get the Ceph tracing info return value is not correct", "Expect: " + ep_GetCephTraingReturn + "\n\n\n Actually Get: " + getCephTracingResult.SingleResult);
                        }
                    }
                    #endregion

                    #region Step 4: Call ImageService.deleteImage to delete the image
                    CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                    r.CheckPoints.Add(cp_DeleteImage);

                    XMLResult rt_DeleteImage = imageService.deleteImage(imageinternalUid, new XMLParameter("preferences"));
                    if (rt_DeleteImage.IsErrorOccured)
                    {
                        cp_DeleteImage.Result = TestResult.Fail;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_DeleteImage.Result = TestResult.Pass;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        //Case 99: 1.3.6_CreateImage_Exception
        public void Run_Image_CreateImage_Exception_Case99()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            bool isCreatePatient = false;
            bool isDeletePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                isDeletePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Create image");

                PatientService patientSvc = new PatientService();
                ImageService imageSvc = new ImageService();

                XMLParameter pCreatePatient = new XMLParameter("patient");
                XMLParameter pCreateImage = new XMLParameter("image");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "createPatient")
                    {
                        pCreatePatient.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "createImage")
                    {
                        pCreateImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "deletePatient")
                    {
                        isDeletePatient = ids.InputParameters.GetParameter(i).Value.ToLower().Equals("true");
                    }
                }

                string epErrorCode = string.Empty;
                string epErrorMessage = string.Empty;
                for (int i = 0; i < ids.ExpectedValues.Count; i++)
                {
                    if (ids.ExpectedValues.GetParameter(i).Step == "createImage")
                    {
                        if (ids.ExpectedValues.GetParameter(i).Key == "error_code")
                        {
                            epErrorCode = ids.ExpectedValues.GetParameter(i).Value;
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Key == "error_message")
                        {
                            epErrorMessage = ids.ExpectedValues.GetParameter(i).Value;
                        }
                    }
                }

                try
                {
                    #region Create Patient
                    if (isCreatePatient)
                    {
                        CheckPoint cpCreatePatient = new CheckPoint("Create Patient", "Test create patient");
                        r.CheckPoints.Add(cpCreatePatient);
                        XMLResult rtCreatePatient = patientSvc.createPatient(pCreatePatient);
                        if (rtCreatePatient.IsErrorOccured)
                        {
                            cpCreatePatient.Result = TestResult.Fail;
                            cpCreatePatient.Outputs.AddParameter("create patient returns error", "Create Patient", rtCreatePatient.ResultContent);
                            SaveRound(r);
                            break;
                        }
                        else
                        {
                            patientUID = rtCreatePatient.SingleResult;
                            cpCreatePatient.Result = TestResult.Pass;
                            cpCreatePatient.Outputs.AddParameter("create patient returns success", "Create Patient", rtCreatePatient.ResultContent);
                        }
                    }
                    #endregion

                    #region Create Image
                    CheckPoint cpCreateImage = new CheckPoint("Create Image", "Test create image");
                    r.CheckPoints.Add(cpCreateImage);
                    if (patientUID != null)
                    {
                        pCreateImage.AddParameter("patient_internal_id", patientUID);
                        XMLResult rtCreateImage = imageSvc.createImage(pCreateImage);
                        if (rtCreateImage.IsErrorOccured)
                        {
                            if (rtCreateImage.Code.ToString().Equals(epErrorCode) && rtCreateImage.Message.Contains(epErrorMessage))
                            {
                                cpCreateImage.Result = TestResult.Pass;
                                cpCreateImage.Outputs.AddParameter("Create image returns correct error message as expected", "Create Image", rtCreateImage.ResultContent);
                            }
                            else
                            {
                                cpCreateImage.Result = TestResult.Fail;
                                cpCreateImage.Outputs.AddParameter("Create image doesn't return correct error info as expected", "Create Image", rtCreateImage.ResultContent);
                            }
                        }
                        else
                        {
                            cpCreateImage.Result = TestResult.Fail;
                            cpCreateImage.Outputs.AddParameter("Create image doesn't return error as expected", "Create Image", rtCreateImage.ResultContent);
                        }
                    }
                    #endregion

                    #region Delete patient
                    if (isDeletePatient)
                    {
                        CheckPoint cpDeletePatient = new CheckPoint("DeletePatient", "Delete the created patient");
                        r.CheckPoints.Add(cpDeletePatient);

                        XMLResult rtDeletePatient = patientSvc.deletePatient(patientUID);

                        if (rtDeletePatient.IsErrorOccured)
                        {
                            cpDeletePatient.Result = TestResult.Fail;
                            cpDeletePatient.Outputs.AddParameter("delete patient returns error", "Delete Patient", rtDeletePatient.ResultContent);
                            SaveRound(r);
                            break;
                        }
                        else
                        {
                            cpDeletePatient.Result = TestResult.Pass;
                            cpDeletePatient.Outputs.AddParameter("delete patient returns success", "Delete Patient", rtDeletePatient.ResultContent);
                        }
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        //Case 44: 1.3.6_CreateImage_Normal
        public void Run_Image_CreateImage_Normal_Case44()
        {
            int runCount = 0;
            string patientUID = null;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Create image");

                PatientService ps = new PatientService();
                ImageService ims = new ImageService();
                XMLParameter pa = new XMLParameter("patient");
                XMLParameter ia = new XMLParameter("image");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "image")
                    {
                        ia.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }
                if (isCreatePatient)
                {
                    CheckPoint pCreate = new CheckPoint("Create patient", "Test create");
                    r.CheckPoints.Add(pCreate);

                    XMLResult result = ps.createPatient(pa);
                    if (!result.IsErrorOccured)
                    {
                        patientUID = result.SingleResult;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                        pCreate.Result = TestResult.Pass;
                    }
                    else
                    {
                        pCreate.Outputs.AddParameter("create", "Create patient returns error: ", result.ResultContent);
                        pCreate.Result = TestResult.Fail;
                        goto CLEANUP;
                    }
                }

                CheckPoint pImage = new CheckPoint("Image create", "Test image");
                r.CheckPoints.Add(pImage);
                if (patientUID != null)
                {
                    ia.AddParameter("patient_internal_id", patientUID);
                    XMLResult imageRsl = ims.createImage(ia);
                    if (imageRsl.IsErrorOccured)
                    {
                        pImage.Result = TestResult.Fail;
                        pImage.Outputs.AddParameter("create", "Create image error", imageRsl.Message);
                    }
                    else
                    {
                        pImage.Result = TestResult.Pass;
                        pImage.Outputs.AddParameter("create", "Create image Id", imageRsl.SingleResult);
                    }
                }

            CLEANUP:
                if (isCreatePatient && !string.IsNullOrEmpty(patientUID))
                {
                    ps.deletePatient(patientUID);
                }
                SaveRound(r);
            }

            Output();
        }