示例#1
0
        /// <summary>
        /// 删除指定的iframe信息
        /// </summary>
        /// <param name="prodefId"></param>
        /// <param name="actdefId"></param>
        /// <param name="iframeId"></param>
        public static void DeleteIframe(String prodefId, String actdefId, String iframeId, bool IsDeleteAll, DataGridView dgv, String childProdefId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefId, childProdefId);
            XmlDocument doc  = new XmlDocument();

            if (File.Exists(path))
            {
                doc.Load(path);
            }
            if (IsDeleteAll)
            {
                XmlNode nodeIfame = doc.SelectSingleNode("//Actdef[@ID='" + actdefId + "']/iframe");
                if (nodeIfame != null)
                {
                    nodeIfame.RemoveAll();
                }
            }
            else
            {
                XmlNode nodeIfame = doc.SelectSingleNode("//Actdef[@ID='" + actdefId + "']/iframe/iframeChild[@ID='" + iframeId + "']");
                if (nodeIfame != null)
                {
                    nodeIfame.ParentNode.RemoveChild(nodeIfame);
                }
            }

            doc.Save(path);
            ReadIframe(actdefId, doc, dgv);
        }
示例#2
0
        /// <summary>
        /// 调整子Iframe操作顺序
        /// </summary>
        /// <param name="dataGridViewRowList"></param>
        /// <param name="prodefKey"></param>
        /// <param name="childProdefId"></param>
        /// <param name="actdefId"></param>
        /// <param name="iframeId"></param>
        public static void UpdateChildElementOrder(List <DataGridViewRow> dataGridViewRowList, String prodefKey,
                                                   String childProdefId, String actdefId, String iframeId, String locationElementId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefKey, childProdefId);
            XmlDocument doc  = new XmlDocument();

            doc.Load(path);
            XmlNode nodeLocationElement = doc.SelectSingleNode("//Actdef[@ID='" + actdefId + "']/" +
                                                               "iframe/iframeChild[@ID='" + iframeId + "']/LocationElement[@ID='" + locationElementId + "']");

            dataGridViewRowList.ForEach(p =>
            {
                String id          = p.Cells["ChildLocationID"].Value.ToString();
                XmlElement element = (XmlElement)nodeLocationElement.SelectSingleNode("ChildLocationElement[@ID='" + id + "']");
                element.SetAttribute("Order", p.Cells["ChildOrder"].Value.ToString());
            });

            List <XmlNode> listAllNode = nodeLocationElement.SelectNodes("ChildLocationElement").ToList <XmlNode>();

            listAllNode = listAllNode.OrderBy(p => TypeConvert.ToConvert <object, long>(p.Attributes["Order"].Value, false)).ToList();
            foreach (XmlNode nodeDelete in nodeLocationElement.ChildNodes)
            {
                nodeDelete.ParentNode.RemoveChild(nodeDelete);
            }
            foreach (XmlNode nodeTemp in listAllNode)
            {
                nodeLocationElement.AppendChild(nodeTemp);
            }

            doc.Save(path);
        }
示例#3
0
        /// <summary>
        /// 增加iframe节点
        /// </summary>
        /// <param name="iframe"></param>
        /// <param name="actdef"></param>
        /// <param name="prodef"></param>
        public static void AddIframeToXML(IFrameEntity iframe, ActdefEntity actdef, ProdefEntity prodef, String secondPackageId, String childProdefId)
        {
            String      path       = CreateActionCommon.GetXmlPath(prodef.Key, childProdefId);
            XmlNode     nodeActdef = null;
            XmlDocument doc        = GetActdefNode(actdef, prodef, out nodeActdef, path, secondPackageId);
            XmlNode     nodeIframe = nodeActdef.SelectSingleNode("iframe");

            if (nodeIframe == null)
            {
                nodeIframe = doc.CreateElement("iframe") as XmlNode;
                nodeActdef.AppendChild(nodeIframe);
            }

            XmlNode nodeTempIframe = nodeIframe.SelectSingleNode("iframeChild[@ID='" + iframe.Id + "']");

            if (nodeTempIframe != null)
            {
                nodeTempIframe.ParentNode.RemoveChild(nodeTempIframe);
            }

            XmlElement elementTempIframe = doc.CreateElement("iframeChild");

            elementTempIframe.SetAttribute("ID", iframe.Id);
            elementTempIframe.SetAttribute("Name", iframe.Name);
            elementTempIframe.SetAttribute("URL", iframe.UrlPath);
            nodeIframe.AppendChild(elementTempIframe);

            doc.Save(path);
        }
示例#4
0
        /// <summary>
        /// 添加用户信息
        /// </summary>
        /// <param name="departmentUser"></param>
        /// <param name="actdef"></param>
        /// <param name="prodef"></param>

        /*public static void AddUserToXML(DepartmentUser departmentUser,Department department, Actdef actdef, Prodef prodef)
         * {
         *  String path = CreateActionCommon.GetXmlPath(prodef.Key);
         *  XmlNode nodeActdef = null;
         *  XmlDocument doc = GetActdefNode(actdef, prodef, out nodeActdef, path);
         *
         *
         *  XmlNode nodeUser = nodeActdef.SelectSingleNode("user");
         *  if (nodeUser == null)
         *  {
         *      nodeUser = doc.CreateElement("user") as XmlNode;
         *      nodeActdef.AppendChild(nodeUser);
         *  }
         *
         *  XmlElement elementUser =  nodeUser as XmlElement;
         *  elementUser.SetAttribute("ID", departmentUser.Id);
         *  elementUser.SetAttribute("Name", departmentUser.Name);
         *  elementUser.SetAttribute("ParentID", department.Id);
         *  nodeActdef.AppendChild(elementUser);
         *
         *  doc.Save(path);
         *
         * }*/

        /// <summary>
        /// 添加操作元素
        /// </summary>
        public static void AddElementToXML(String iframeId, LocationElementEntity locationElement, String prodefKey, String actdefId, DataGridView dgv, String childProdefId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefKey, childProdefId);
            XmlDocument doc  = new XmlDocument();

            doc.Load(path);
            XmlNode nodeIframeChild = doc.SelectSingleNode("//Actdef[@ID='" + actdefId + "']/iframe/iframeChild[@ID='" + iframeId + "']");

            if (nodeIframeChild == null)
            {
                throw new Exception("请先选择要操作的Iframe");
            }

            XmlNode nodeElement = nodeIframeChild.SelectSingleNode("LocationElement[@ID='" + locationElement.Id + "']");

            if (nodeElement == null)
            {
                nodeElement = doc.CreateElement("LocationElement");
                nodeIframeChild.AppendChild(nodeElement);
            }

            XmlElement elementLocation = nodeElement as XmlElement;

            elementLocation.SetAttribute("ID", locationElement.Id);
            elementLocation.SetAttribute("LocationType", locationElement.LocationType); //定位方式
            elementLocation.SetAttribute("Path", locationElement.LocationPath);         //定位路径
            elementLocation.SetAttribute("OperateType", locationElement.OperateType);   //操作类型
            elementLocation.SetAttribute("Order", locationElement.Order);               //顺序
            elementLocation.SetAttribute("DefaultValue", locationElement.LocationDefaultValue);
            if (!string.IsNullOrEmpty(locationElement.SqlSchemaId))
            {
                elementLocation.SetAttribute("SqlSchemaId", locationElement.SqlSchemaId); //SQL方案内码
            }
            else
            {
                elementLocation.SetAttribute("SqlSchemaId", "");                               //SQL方案内码
            }
            elementLocation.SetAttribute("Introduce", locationElement.Introduce);              //备注说明
            elementLocation.SetAttribute("IsRandom", locationElement.IsRanddom.ToString());
            elementLocation.SetAttribute("WaitSecond", locationElement.WaitSecond.ToString()); //操作等待时间
            List <XmlNode> listAllNode = nodeIframeChild.SelectNodes("LocationElement").ToList <XmlNode>();

            listAllNode = listAllNode.OrderBy(p => TypeConvert.ToConvert <object, long>(p.Attributes["Order"].Value, false)).ToList();
            foreach (XmlNode nodeDelete in nodeIframeChild.ChildNodes)
            {
                nodeDelete.ParentNode.RemoveChild(nodeDelete);
            }
            foreach (XmlNode nodeTemp in listAllNode)
            {
                nodeIframeChild.AppendChild(nodeTemp);
            }
            doc.Save(path);

            ReadLocationElement(doc, iframeId, actdefId, locationElement.Id, dgv);
        }
示例#5
0
        /// <summary>
        /// 读取所有iframe信息
        /// </summary>
        /// <param name="prodefId"></param>
        /// <param name="actdefId"></param>
        /// <param name="dgv"></param>
        /// <returns></returns>
        public static DataTable ReadIframe(String prodefId, String actdefId, DataGridView dgv, String childProdefId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefId, childProdefId);
            XmlDocument doc  = new XmlDocument();

            if (File.Exists(path))
            {
                doc.Load(path);
            }
            return(ReadIframe(actdefId, doc, dgv));
        }
示例#6
0
        /// <summary>
        /// 读取子Iframe元素信息
        /// </summary>
        /// <param name="iframeId"></param>
        /// <param name="childIframeId"></param>
        /// <param name="prodefId"></param>
        /// <param name="selectId"></param>
        /// <param name="dgv"></param>
        public static void ReadChildLocationElement(String iframeId, String childIframeId, String prodefId,
                                                    String selectId
                                                    , DataGridView dgv, String childProdefId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefId, childProdefId);
            XmlDocument doc  = new XmlDocument();

            if (File.Exists(path))
            {
                doc.Load(path);
            }
            ReadChildLocationElement(doc, iframeId, childIframeId, selectId, dgv);
        }
示例#7
0
        /// <summary>
        /// 删除页面操作元素
        /// </summary>
        /// <param name="prodefId"></param>
        /// <param name="actdefId"></param>
        /// <param name="iframeId"></param>
        /// <param name="locationElementId"></param>
        public static void DeleteLocationElement(String prodefId, String actdefId,
                                                 String iframeId, String locationElementId, DataGridView dgv, String childProdefId)
        {
            String      path = CreateActionCommon.GetXmlPath(prodefId, childProdefId);
            XmlDocument doc  = new XmlDocument();

            if (File.Exists(path))
            {
                doc.Load(path);
            }

            XmlNode node = doc.SelectSingleNode("//Actdef[@ID='" + actdefId + "']/iframe/iframeChild[@ID='" + iframeId + "']/LocationElement[@ID='" + locationElementId + "']");

            if (node != null)
            {
                node.ParentNode.RemoveChild(node);
            }

            doc.Save(path);
            ReadLocationElement(doc, iframeId, actdefId, "", dgv);
        }