Example #1
0
 /// <summary>
 /// 添加新文档
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 public bool AddDocument(EDM_OmeiDocument document)
 {
     try
     {
         _ent.AddToEDM_OmeiDocumentSet(document);
         _ent.SaveChanges();
         return true;
     }
     catch (Exception exp)
     {
         base.LastError = exp.InnerException.Message;
         return false;
     }
 }
Example #2
0
        /// <summary>
        /// 保存Omei文档
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public bool SaveDocument(EDM_OmeiDocument document)
        {
            if (document == null || string.IsNullOrEmpty(document.docName))
            {
                base.LastError = "保存时没有文档ID。";
                return false;
            }

            try
            {
                var doc = GetDocumentByName(document.docName);
                _ent.ApplyPropertyChanges(doc.EntityKey.EntitySetName, document);
                _ent.SaveChanges();
                return true;
            }
            catch (Exception exp)
            {
                base.LastError = exp.InnerException.Message;
                return false;
            }
        }