예제 #1
0
        /// <summary>
        /// 根据Id获取分组
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Proj_Group GetGroupInfoByIdFromDB(string id)
        {
            string sql = "select g.id as id, g.name as name, g.description as description "
                         + "from Proj_Group g where g.isdeleted ='N' and g.id = :id";
            Dictionary <string, object> p2vs = new Dictionary <string, object>();

            p2vs.Add("id", id);
            DataTable dt = null;

            try
            {
                dt = SqliteHelper.MainDbHelper.GetDataTable(sql, p2vs);
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误提示", "无法获取分组信息. Id = " + id + "\r\n" + ex.Message);
            }
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    DataRow    row = dt.Rows[0];
                    Proj_Group g   = new Proj_Group();
                    g.Id          = (string)row["id"];
                    g.Name        = (string)row["name"];
                    g.Description = (string)row["description"];
                    return(g);
                }
            }
            return(null);
        }
예제 #2
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeViewProjectList.SelectedNode;

            if (selectedNode == null)
            {
                CommonUtil.Alert("提示", "无选中项");
            }
            else
            {
                if (selectedNode.Tag is Proj_Group)
                {
                    if (DeleteGroup((Proj_Group)selectedNode.Tag))
                    {
                        selectedNode.Remove();
                    }
                }
                else if (selectedNode.Tag is Proj_Main)
                {
                    if (DeleteProject((Proj_Main)selectedNode.Tag))
                    {
                        TreeNode groupNode = selectedNode.Parent;
                        selectedNode.Remove();
                        RefreshGroupNodeText(groupNode);
                    }
                }
            }
        }
예제 #3
0
        private void toolStripMenuItemAddProject_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeViewProjectList.SelectedNode;

            if (selectedNode == null)
            {
                CommonUtil.Alert("提示", "请选择或新建分组.");
            }
            else
            {
                TreeNode   groupNode = ((selectedNode.Tag is Proj_Main) ? selectedNode.Parent : selectedNode);
                Proj_Group group     = (Proj_Group)groupNode.Tag;

                string     id      = group.Id + "_New_Project";
                NDATabPage tabPage = CheckExistTabPage(id);
                if (tabPage == null)
                {
                    UserControlEditProject projectControl = new UserControlEditProject(group.Id, null);
                    projectControl.AfterSaveEvent += new AfterSaveHandler(projectControl_AfterSaveEvent);
                    projectControl.Dock            = DockStyle.Fill;
                    tabPage = this.CreateTabPage(id, "新建项目");
                    tabPage.Controls.Add(projectControl);
                    tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_ProjectBeforeTabPageCloseEvent);
                }
                this.tabControlMain.SelectedTab = tabPage;
            }
        }
예제 #4
0
        /// <summary>
        /// 获取所有分组
        /// </summary>
        /// <returns></returns>
        public static List <Proj_Group> GetAllGroupsFromDB()
        {
            string sql = "select g.id as id, g.name as name, g.description as description "
                         + "from Proj_Group g where g.isdeleted ='N' order by g.name";
            DataTable dt = null;

            try
            {
                dt = SqliteHelper.MainDbHelper.GetDataTable(sql, null);
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误提示", "无法获取分组信息. \r\n" + ex.Message);
            }
            if (dt != null)
            {
                List <Proj_Group> allGroups = new List <Proj_Group>();
                foreach (DataRow row in dt.Rows)
                {
                    Proj_Group g = new Proj_Group();
                    g.Id          = (string)row["id"];
                    g.Name        = (string)row["name"];
                    g.Description = (string)row["description"];
                    allGroups.Add(g);
                }
                return(allGroups);
            }
            return(null);
        }
        private bool Check()
        {
            string projectName = this.textBoxName.Text.Trim();

            if (CommonUtil.IsNullOrBlank(projectName))
            {
                CommonUtil.Alert("验证", "请录入项目名称.");
                return(false);
            }
            else
            {
                //新建项目
                if (this.Project == null)
                {
                    this.Project = new Proj_Main();
                    SaveInputToPrjectObject();
                    return(true);
                }
                else
                {
                    //判断此项目名称是否存在且Id不同
                    Proj_Main p = ProjectTaskAccess.GetProjectInfoByNameFromDB(projectName);
                    if (p != null && p.Id != this.Project.Id)
                    {
                        CommonUtil.Alert("验证", "已存在的项目名称,请使用其它名称.");
                        return(false);
                    }
                    else
                    {
                        SaveInputToPrjectObject();
                        return(true);
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// 从数据库中删除此分组(打标记,不实际删除记录)
        /// </summary>
        /// <param name="id"></param>
        public static bool DeleteGroup(string id)
        {
            string sql = "update Proj_Group set isdeleted = :isdeleted where id = :id";
            Dictionary <string, object> p2vs = new Dictionary <string, object>();

            p2vs.Add("isdeleted", "Y");
            p2vs.Add("id", id);
            try
            {
                return(SqliteHelper.MainDbHelper.ExecuteSql(sql, p2vs));
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误提示", "无法删除此分组. Id = " + id + "\r\n" + ex.Message);
                return(false);
            }
        }
예제 #7
0
        /// <summary>
        /// 根据Id获取项目
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Proj_Main GetProjectInfoByIdFromDB(string id)
        {
            string sql = @"select p.id as id,
                            p.name as name,  
                            p.description as description,  
                            p.group_id as group_id,  
                            p.logintype as logintype,
                            p.loginpageinfo as loginpageinfo, 
                            p.detailgrabtype as detailgrabtype,
                            p.detailgrabinfo as detailgrabinfo,
                            p.programaftergraball as programaftergraball,
                            p.programexternalrun as programexternalrun from Proj_Main p where p.isdeleted = 'N' and p.id = :id";
            Dictionary <string, object> p2vs = new Dictionary <string, object>();

            p2vs.Add("id", id);
            DataTable dt = null;

            try
            {
                dt = SqliteHelper.MainDbHelper.GetDataTable(sql, p2vs);
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误提示", "无法获取项目信息. Id = " + id + "\r\n" + ex.Message);
            }
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    DataRow   row = dt.Rows[0];
                    Proj_Main p   = new Proj_Main();
                    p.Id                  = (string)row["id"];
                    p.Name                = (string)row["name"];
                    p.Description         = (string)row["description"];
                    p.Group_Id            = (string)row["group_id"];
                    p.LoginType           = (LoginLevelType)Enum.Parse(typeof(LoginLevelType), (string)row["logintype"]);
                    p.LoginPageInfo       = (string)row["loginpageinfo"];
                    p.DetailGrabType      = (DetailGrabType)Enum.Parse(typeof(DetailGrabType), (string)row["detailgrabtype"]);
                    p.DetailGrabInfo      = (string)row["detailgrabinfo"];
                    p.ProgramAfterGrabAll = (string)row["programaftergraball"];
                    p.ProgramExternalRun  = (string)row["programexternalrun"];
                    return(p);
                }
            }
            return(null);
        }
예제 #8
0
        private void EditNodeObject(TreeNode selectedNode)
        {
            if (selectedNode == null)
            {
                CommonUtil.Alert("提示", "无选中项");
            }
            else
            {
                if (selectedNode.Tag is Proj_Group)
                {
                    Proj_Group group = (Proj_Group)selectedNode.Tag;

                    string     id      = group.Id;
                    NDATabPage tabPage = CheckExistTabPage(id);
                    if (tabPage == null)
                    {
                        UserControlEditGroup groupControl = new UserControlEditGroup(group);
                        groupControl.AfterSaveEvent += new AfterSaveHandler(groupControl_AfterSaveEvent);
                        groupControl.Dock            = DockStyle.Fill;
                        tabPage = this.CreateTabPage(id, "分组:" + group.Name);
                        tabPage.Controls.Add(groupControl);
                        tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_GroupBeforeTabPageCloseEvent);
                    }
                    this.tabControlMain.SelectedTab = tabPage;
                }
                else if (selectedNode.Tag is Proj_Main)
                {
                    Proj_Main  project = (Proj_Main)selectedNode.Tag;
                    Proj_Group group   = (Proj_Group)selectedNode.Parent.Tag;

                    string     id      = project.Id;
                    NDATabPage tabPage = CheckExistTabPage(id);
                    if (tabPage == null)
                    {
                        UserControlEditProject projectControl = new UserControlEditProject(group.Id, project);
                        projectControl.AfterSaveEvent += new AfterSaveHandler(projectControl_AfterSaveEvent);
                        projectControl.Dock            = DockStyle.Fill;
                        tabPage = this.CreateTabPage(id, "项目:" + project.Name);
                        tabPage.Controls.Add(projectControl);
                        tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_ProjectBeforeTabPageCloseEvent);
                    }
                    this.tabControlMain.SelectedTab = tabPage;
                }
            }
        }
예제 #9
0
        /// <summary>
        /// 获取所有项目
        /// </summary>
        /// <returns></returns>
        public static List <Proj_Main> GetAllProjectsFromDB()
        {
            string    sql = @"select p.id as id,
                            p.name as name, 
                            p.description as description, 
                            p.group_id as group_id,  
                            p.logintype as logintype,
                            p.loginpageinfo as loginpageinfo,
                            p.detailgrabtype as detailgrabtype,
                            p.detailgrabinfo as detailgrabinfo,
                            p.programaftergraball as programaftergraball,
                            p.programexternalrun as programexternalrun from Proj_Main p where p.isdeleted = 'N' order by p.name";
            DataTable dt  = null;

            try
            {
                dt = SqliteHelper.MainDbHelper.GetDataTable(sql, null);
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误提示", "无法获取项目信息. \r\n" + ex.Message);
            }
            if (dt != null)
            {
                List <Proj_Main> allProjects = new List <Proj_Main>();
                foreach (DataRow row in dt.Rows)
                {
                    Proj_Main p = new Proj_Main();
                    p.Id                  = (string)row["id"];
                    p.Name                = (string)row["name"];
                    p.Description         = (string)row["description"];
                    p.Group_Id            = (string)row["group_id"];
                    p.LoginType           = (LoginLevelType)Enum.Parse(typeof(LoginLevelType), (string)row["logintype"]);
                    p.LoginPageInfo       = (string)row["loginpageinfo"];
                    p.DetailGrabType      = (DetailGrabType)Enum.Parse(typeof(DetailGrabType), (string)row["detailgrabtype"]);
                    p.DetailGrabInfo      = (string)row["detailgrabinfo"];
                    p.ProgramAfterGrabAll = (string)row["programaftergraball"];
                    p.ProgramExternalRun  = (string)row["programexternalrun"];
                    allProjects.Add(p);
                }
                return(allProjects);
            }
            return(null);
        }
예제 #10
0
        void projectControl_AfterSaveEvent(object sender, EventArgs e)
        {
            UserControlEditProject projectControl = (UserControlEditProject)sender;
            TreeNode groupNode = GetGroupNode(projectControl.GroupId);

            if (groupNode != null)
            {
                TreeNode projectNode = ShowProject(groupNode, projectControl.Project, true);
                RefreshGroupNodeText(groupNode);
                groupNode.Expand();
                this.treeViewProjectList.SelectedNode = projectNode;
                NDATabPage tabPage = (NDATabPage)projectControl.Parent;
                tabPage.Id   = projectControl.Project.Id;
                tabPage.Text = "项目:" + projectControl.Project.Name;
            }
            else
            {
                CommonUtil.Alert("提示", "分组已被删除.");
            }
        }
        private bool Check()
        {
            string groupName = this.textBoxName.Text.Trim();

            if (CommonUtil.IsNullOrBlank(groupName))
            {
                CommonUtil.Alert("验证", "请录入组名.");
                return(false);
            }
            else
            {
                //新建分组
                if (this.Group == null)
                {
                    this.Group             = new Proj_Group();
                    this.Group.Name        = groupName;
                    this.Group.Description = this.textBoxDescription.Text.Trim();
                    return(true);
                }
                else
                {
                    //判断此组名是否存在且Id不同
                    Proj_Group g = ProjectTaskAccess.GetGroupInfoByNameFromDB(groupName);
                    if (g != null && g.Id != this.Group.Id)
                    {
                        CommonUtil.Alert("验证", "已存在的组名,请使用其它名称.");
                        return(false);
                    }
                    else
                    {
                        this.Group.Name        = groupName;
                        this.Group.Description = this.textBoxDescription.Text.Trim();
                        return(true);
                    }
                }
            }
        }
예제 #12
0
        public bool Format()
        {
            try
            {
                if (!CommonUtil.IsNullOrBlank(this.LoginPageInfo))
                {
                    Proj_LoginPageInfo loginObj = new Proj_LoginPageInfo();
                    XmlDocument        xmlDoc   = new XmlDocument();
                    xmlDoc.LoadXml(this.LoginPageInfo);
                    XmlElement rootElement = xmlDoc.DocumentElement;
                    loginObj.LoginUrl                = rootElement.Attributes["LoginUrl"].Value;
                    loginObj.LoginBtnPath            = rootElement.Attributes["LoginBtnPath"].Value;
                    loginObj.LoginName               = rootElement.Attributes["LoginName"].Value;
                    loginObj.LoginNameCtrlPath       = rootElement.Attributes["LoginNameCtrlPath"].Value;
                    loginObj.LoginPwdCtrlPath        = rootElement.Attributes["LoginPwdCtrlPath"].Value;
                    loginObj.LoginPwdValue           = rootElement.Attributes["LoginPwdValue"].Value;
                    loginObj.DataAccessType          = rootElement.Attributes["DataAccessType"] == null ? loginObj.DataAccessType : (Proj_DataAccessType)Enum.Parse(typeof(Proj_DataAccessType), rootElement.Attributes["DataAccessType"].Value);
                    loginObj.NeedProxy               = rootElement.Attributes["NeedProxy"] == null ? false : bool.Parse(rootElement.Attributes["NeedProxy"].Value);
                    loginObj.AutoAbandonDisableProxy = rootElement.Attributes["AutoAbandonDisableProxy"] == null ? true : bool.Parse(rootElement.Attributes["AutoAbandonDisableProxy"].Value);
                    this.LoginPageInfoObject         = loginObj;
                }

                if (!CommonUtil.IsNullOrBlank(this.DetailGrabInfo))
                {
                    switch (this.DetailGrabType)
                    {
                    case DetailGrabType.SingleLineType:
                    case DetailGrabType.ProgramType:
                    {
                        Proj_Detail_SingleLine detailObj = new Proj_Detail_SingleLine();
                        XmlDocument            xmlDoc    = new XmlDocument();
                        xmlDoc.LoadXml(this.DetailGrabInfo);
                        XmlElement rootElement = xmlDoc.DocumentElement;
                        detailObj.IntervalAfterLoaded     = decimal.Parse(rootElement.Attributes["IntervalAfterLoaded"].Value);
                        detailObj.DataAccessType          = rootElement.Attributes["DataAccessType"] == null ? detailObj.DataAccessType : (Proj_DataAccessType)Enum.Parse(typeof(Proj_DataAccessType), rootElement.Attributes["DataAccessType"].Value);
                        detailObj.NeedProxy               = rootElement.Attributes["NeedProxy"] == null ? false : bool.Parse(rootElement.Attributes["NeedProxy"].Value);
                        detailObj.AutoAbandonDisableProxy = rootElement.Attributes["AutoAbandonDisableProxy"] == null ? true : bool.Parse(rootElement.Attributes["AutoAbandonDisableProxy"].Value);
                        detailObj.IntervalDetailPageSave  = rootElement.Attributes["IntervalDetailPageSave"] == null ? SysConfig.IntervalDetailPageSave : int.Parse(rootElement.Attributes["IntervalDetailPageSave"].Value);
                        detailObj.StartPageIndex          = rootElement.Attributes["StartPageIndex"] == null ? 0 : int.Parse(rootElement.Attributes["StartPageIndex"].Value);
                        detailObj.EndPageIndex            = rootElement.Attributes["EndPageIndex"] == null ? 0 : int.Parse(rootElement.Attributes["EndPageIndex"].Value);
                        detailObj.SaveFileDirectory       = rootElement.Attributes["SaveFileDirectory"] == null ? "" : rootElement.Attributes["SaveFileDirectory"].Value;
                        detailObj.ExportType              = rootElement.Attributes["ExportType"] == null ? ExportType.Excel : (ExportType)Enum.Parse(typeof(ExportType), rootElement.Attributes["ExportType"].Value);
                        detailObj.AllowAutoGiveUp         = rootElement.Attributes["AllowAutoGiveUp"] == null ? false : bool.Parse(rootElement.Attributes["AllowAutoGiveUp"].Value);
                        detailObj.NeedPartDir             = rootElement.Attributes["NeedPartDir"] == null ? false : bool.Parse(rootElement.Attributes["NeedPartDir"].Value);
                        detailObj.ThreadCount             = rootElement.Attributes["ThreadCount"] == null ? 5 : int.Parse(rootElement.Attributes["ThreadCount"].Value);
                        detailObj.RequestTimeout          = rootElement.Attributes["RequestTimeout"] == null ? SysConfig.WebPageRequestTimeout : int.Parse(rootElement.Attributes["RequestTimeout"].Value);
                        detailObj.Encoding             = rootElement.Attributes["Encoding"] == null ? SysConfig.WebPageEncoding : rootElement.Attributes["Encoding"].Value;
                        detailObj.XRequestedWith       = rootElement.Attributes["XRequestedWith"] == null ? "" : rootElement.Attributes["XRequestedWith"].Value;
                        detailObj.IntervalProxyRequest = rootElement.Attributes["IntervalProxyRequest"] == null ? detailObj.IntervalProxyRequest : int.Parse(rootElement.Attributes["IntervalProxyRequest"].Value);
                        detailObj.BrowserType          = rootElement.Attributes["BrowserType"] == null ? WebBrowserType.IE : (WebBrowserType)Enum.Parse(typeof(WebBrowserType), rootElement.Attributes["BrowserType"].Value);

                        XmlNode completeCheckListNode = rootElement.SelectSingleNode("CompleteChecks") == null ? null : rootElement.SelectSingleNode("CompleteChecks");
                        if (completeCheckListNode != null)
                        {
                            detailObj.CompleteChecks = new Proj_CompleteCheckList();
                            detailObj.CompleteChecks.AndCondition = completeCheckListNode.Attributes["AndCondition"] == null ? detailObj.CompleteChecks.AndCondition : bool.Parse(completeCheckListNode.Attributes["AndCondition"].Value);
                            XmlNodeList completeCheckList = completeCheckListNode.ChildNodes;
                            foreach (XmlNode completeCheckNode in completeCheckList)
                            {
                                Proj_CompleteCheck completeCheck = new Proj_CompleteCheck();
                                completeCheck.CheckValue = completeCheckNode.Attributes["CheckValue"] == null ? "" : completeCheckNode.Attributes["CheckValue"].Value;
                                completeCheck.CheckType  = completeCheckNode.Attributes["CheckType"] == null ? DocumentCompleteCheckType.BrowserCompleteEvent : (DocumentCompleteCheckType)Enum.Parse(typeof(DocumentCompleteCheckType), completeCheckNode.Attributes["CheckType"].Value);
                                detailObj.CompleteChecks.Add(completeCheck);
                            }
                        }

                        XmlNodeList fieldNodeList = rootElement.SelectSingleNode("Fields") == null ? null : rootElement.SelectSingleNode("Fields").ChildNodes;
                        if (fieldNodeList != null)
                        {
                            foreach (XmlNode fieldNode in fieldNodeList)
                            {
                                Proj_Detail_Field field = new Proj_Detail_Field();
                                field.Name          = fieldNode.Attributes["Name"].Value;
                                field.Path          = fieldNode.Attributes["Path"] == null ? "" : fieldNode.Attributes["Path"].Value;
                                field.AttributeName = fieldNode.Attributes["AttributeName"] == null ? "" : fieldNode.Attributes["AttributeName"].Value;
                                field.NeedAllHtml   = fieldNode.Attributes["NeedAllHtml"] == null ? false : "Y".Equals(fieldNode.Attributes["NeedAllHtml"].Value.ToUpper());
                                field.ColumnWidth   = fieldNode.Attributes["ColumnWidth"] == null ? field.ColumnWidth : int.Parse(fieldNode.Attributes["ColumnWidth"].Value);
                                detailObj.Fields.Add(field);
                            }
                        }
                        this.DetailGrabInfoObject = detailObj;
                    }
                    break;

                    case DetailGrabType.MultiLineType:
                    {
                        Proj_Detail_MultiLine detailObj = new Proj_Detail_MultiLine();
                        XmlDocument           xmlDoc    = new XmlDocument();
                        xmlDoc.LoadXml(this.DetailGrabInfo);
                        XmlElement rootElement = xmlDoc.DocumentElement;
                        detailObj.IntervalAfterLoaded     = int.Parse(rootElement.Attributes["IntervalAfterLoaded"].Value);
                        detailObj.MultiCtrlPath           = rootElement.Attributes["MultiCtrlPath"].Value;
                        detailObj.DataAccessType          = rootElement.Attributes["DataAccessType"] == null ? detailObj.DataAccessType : (Proj_DataAccessType)Enum.Parse(typeof(Proj_DataAccessType), rootElement.Attributes["DataAccessType"].Value);
                        detailObj.NeedProxy               = rootElement.Attributes["NeedProxy"] == null ? false : bool.Parse(rootElement.Attributes["NeedProxy"].Value);
                        detailObj.AutoAbandonDisableProxy = rootElement.Attributes["AutoAbandonDisableProxy"] == null ? true : bool.Parse(rootElement.Attributes["AutoAbandonDisableProxy"].Value);
                        detailObj.IntervalDetailPageSave  = rootElement.Attributes["IntervalDetailPageSave"] == null ? SysConfig.IntervalDetailPageSave : int.Parse(rootElement.Attributes["IntervalDetailPageSave"].Value);
                        detailObj.StartPageIndex          = rootElement.Attributes["StartPageIndex"] == null ? 0 : int.Parse(rootElement.Attributes["StartPageIndex"].Value);
                        detailObj.EndPageIndex            = rootElement.Attributes["EndPageIndex"] == null ? 0 : int.Parse(rootElement.Attributes["EndPageIndex"].Value);
                        detailObj.SaveFileDirectory       = rootElement.Attributes["SaveFileDirectory"] == null ? "" : rootElement.Attributes["SaveFileDirectory"].Value;
                        detailObj.ExportType              = rootElement.Attributes["ExportType"] == null ? ExportType.Excel : (ExportType)Enum.Parse(typeof(ExportType), rootElement.Attributes["ExportType"].Value);
                        detailObj.AllowAutoGiveUp         = rootElement.Attributes["AllowAutoGiveUp"] == null ? false : bool.Parse(rootElement.Attributes["AllowAutoGiveUp"].Value);
                        detailObj.NeedPartDir             = rootElement.Attributes["NeedPartDir"] == null ? false : bool.Parse(rootElement.Attributes["NeedPartDir"].Value);
                        detailObj.ThreadCount             = rootElement.Attributes["ThreadCount"] == null ? 5 : int.Parse(rootElement.Attributes["ThreadCount"].Value);
                        detailObj.RequestTimeout          = rootElement.Attributes["RequestTimeout"] == null ? SysConfig.WebPageRequestTimeout : int.Parse(rootElement.Attributes["RequestTimeout"].Value);
                        detailObj.Encoding             = rootElement.Attributes["Encoding"] == null ? SysConfig.WebPageEncoding : rootElement.Attributes["Encoding"].Value;
                        detailObj.XRequestedWith       = rootElement.Attributes["XRequestedWith"] == null ? "" : rootElement.Attributes["XRequestedWith"].Value;
                        detailObj.IntervalProxyRequest = rootElement.Attributes["IntervalProxyRequest"] == null ? detailObj.IntervalProxyRequest : int.Parse(rootElement.Attributes["IntervalProxyRequest"].Value);
                        detailObj.BrowserType          = rootElement.Attributes["BrowserType"] == null ? WebBrowserType.IE : (WebBrowserType)Enum.Parse(typeof(WebBrowserType), rootElement.Attributes["BrowserType"].Value);

                        XmlNode completeCheckListNode = rootElement.SelectSingleNode("CompleteChecks") == null ? null : rootElement.SelectSingleNode("CompleteChecks");
                        if (completeCheckListNode != null)
                        {
                            detailObj.CompleteChecks = new Proj_CompleteCheckList();
                            detailObj.CompleteChecks.AndCondition = completeCheckListNode.Attributes["AndCondition"] == null ? detailObj.CompleteChecks.AndCondition : bool.Parse(completeCheckListNode.Attributes["AndCondition"].Value);
                            XmlNodeList completeCheckList = completeCheckListNode.ChildNodes;
                            foreach (XmlNode completeCheckNode in completeCheckList)
                            {
                                Proj_CompleteCheck completeCheck = new Proj_CompleteCheck();
                                completeCheck.CheckValue = completeCheckNode.Attributes["CheckValue"] == null ? "" : completeCheckNode.Attributes["CheckValue"].Value;
                                completeCheck.CheckType  = completeCheckNode.Attributes["CheckType"] == null ? DocumentCompleteCheckType.BrowserCompleteEvent : (DocumentCompleteCheckType)Enum.Parse(typeof(DocumentCompleteCheckType), completeCheckNode.Attributes["CheckType"].Value);
                                detailObj.CompleteChecks.Add(completeCheck);
                            }
                        }

                        XmlNodeList fieldNodeList = rootElement.SelectSingleNode("Fields").ChildNodes;
                        foreach (XmlNode fieldNode in fieldNodeList)
                        {
                            Proj_Detail_Field field = new Proj_Detail_Field();
                            field.Name          = fieldNode.Attributes["Name"].Value;
                            field.Path          = fieldNode.Attributes["Path"] == null ? field.Name : fieldNode.Attributes["Path"].Value;
                            field.AttributeName = fieldNode.Attributes["AttributeName"] == null ? "" : fieldNode.Attributes["AttributeName"].Value;
                            field.IsAbsolute    = fieldNode.Attributes["IsAbsolute"] == null ? false : "Y".Equals(fieldNode.Attributes["IsAbsolute"].Value.ToUpper());
                            field.NeedAllHtml   = fieldNode.Attributes["NeedAllHtml"] == null ? false : "Y".Equals(fieldNode.Attributes["NeedAllHtml"].Value.ToUpper());
                            field.ColumnWidth   = fieldNode.Attributes["ColumnWidth"] == null ? field.ColumnWidth : int.Parse(fieldNode.Attributes["ColumnWidth"].Value);
                            detailObj.Fields.Add(field);
                        }
                        this.DetailGrabInfoObject = detailObj;
                    }
                    break;

                        /*
                         * case DetailGrabType.ProgramType:
                         * if (!CommonUtil.IsNullOrBlank(this.DetailGrabInfo))
                         * {
                         *  this.DetailGrabInfoObject = GetCustomProgram(this.DetailGrabInfo);
                         * }
                         * break;
                         * */
                    }
                }
                else
                {
                    if (this.DetailGrabType != EnumTypes.DetailGrabType.NoneDetailPage)
                    {
                        CommonUtil.Alert("错误", "没有设置详情页.");
                        return(false);
                    }
                }

                if (!CommonUtil.IsNullOrBlank(this.ProgramAfterGrabAll))
                {
                    this.ProgramAfterGrabAllObject = GetCustomProgram(this.ProgramAfterGrabAll);
                }

                if (!CommonUtil.IsNullOrBlank(this.ProgramExternalRun))
                {
                    this.ProgramExternalRunObject = GetCustomProgram(this.ProgramExternalRun);
                }
                return(true);
            }
            catch (Exception ex)
            {
                CommonUtil.Alert("错误", "格式化设置失败.\r\n" + ex.Message);
                return(false);
            }
        }