예제 #1
0
        public void SaveDocument(Position position, string NewStr)
        {
            XmlDocument xmlDocument = (XmlDocument)position.GetDocument();
            Type        type        = xmlDocument.GetType();

            switch (type.Name)
            {
            case "HrXmlDocument":
                HrXmlDocument hrDoc = (HrXmlDocument)position.GetDocument();
                position.Property.SetValue(hrDoc, NewStr, null);
                hrDoc.Save();
                _doc = hrDoc;
                break;

            case "InviteBiddingXmlDocument":
                InviteBiddingXmlDocument bidDoc = (InviteBiddingXmlDocument)position.GetDocument();
                position.Property.SetValue(bidDoc, NewStr, null);
                bidDoc.Save();
                _doc = bidDoc;
                break;

            case "KnowledgeXmlDocument":
                KnowledgeXmlDocument knowDoc = (KnowledgeXmlDocument)position.GetDocument();
                position.Property.SetValue(knowDoc, NewStr, null);
                knowDoc.Save();
                _doc = knowDoc;
                break;

            case "ProductXmlDocument":
                ProductXmlDocument prodcutDoc = (ProductXmlDocument)position.GetDocument();
                position.Property.SetValue(prodcutDoc, NewStr, null);
                prodcutDoc.Save();
                _doc = prodcutDoc;
                break;

            case "ProjectXmlDocument":
                ProjectXmlDocument projectDoc = (ProjectXmlDocument)position.GetDocument();
                position.Property.SetValue(projectDoc, NewStr, null);
                projectDoc.Save();
                _doc = projectDoc;
                break;

            default:
                break;
            }
        }
예제 #2
0
        /// <summary>
        /// 创建一个PageXmlDocument对象。(type参数决定从哪个派生类创建)
        /// </summary>
        static public PageXmlDocument CreateInstance(string relativeFilePath, string pageId, PageType type, SimpleExIndexXmlElement sdsiteElement)
        {
            Debug.Assert(!string.IsNullOrEmpty(relativeFilePath));
            Debug.Assert(!string.IsNullOrEmpty(pageId));

            PageXmlDocument doc = null;

            switch (type)
            {
            case PageType.General:
                doc = new GeneralPageXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.Product:
                doc = new ProductXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.Project:
                doc = new ProjectXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.InviteBidding:
                doc = new InviteBiddingXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.Knowledge:
                doc = new KnowledgeXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.Hr:
                doc = new HrXmlDocument(relativeFilePath, sdsiteElement);
                break;

            case PageType.Home:
                doc = new HomeXmlDocument(relativeFilePath, sdsiteElement);
                break;

            default:
                Debug.Assert(false, "开发期错误。未知的PageType:" + type);
                break;
            }

            return(doc);
        }