Esempio n. 1
0
        public void wmFnIfRemoveSection(string sStepID, int iIndex)
        {
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                if (!ui.IsGUID(sStepID))
                    throw new Exception("Unable to remove section from step. Invalid or missing Step ID. [" + sStepID + "]");

                string sEmbStepID = "";

                if (iIndex > 0)
                {
                    //is there an embedded step?
                    sEmbStepID = ft.GetNodeValueFromCommandXML(sStepID, "//function/tests/test[" + iIndex.ToString() + "]/action[1]");

                    if (ui.IsGUID(sEmbStepID))
                        wmDeleteStep(sEmbStepID); //whack it

                    //now adjust the XML
                    ft.RemoveFromCommandXML(sStepID, "//function/tests/test[" + iIndex.ToString() + "]");
                }
                else if (iIndex == -1)
                {
                    //is there an embedded step?
                    sEmbStepID = ft.GetNodeValueFromCommandXML(sStepID, "//function/else[1]");

                    if (ui.IsGUID(sEmbStepID))
                        wmDeleteStep(sEmbStepID); //whack it

                    //now adjust the XML
                    ft.RemoveFromCommandXML(sStepID, "//function/else[1]");
                }
                else
                {
                    throw new Exception("Unable to modify step. Invalid index.");
                }

                return;

            }

            catch (Exception ex)
            {
                throw ex;
            }
        }