Ejemplo n.º 1
0
        static public void DeleteEntireLibrary(int id, bool fullDelete)
        {
            LibraryEntity le = new LibraryEntity(id);

            if (le.IsNew)
            {
                return;
            }

            foreach (PolicyDocumentEntity pde in le.PolicyDocument)
            {
                DeletePolicyDoc(pde);
            }

            foreach (PolicyEntity pe in le.Policy)
            {
                DeletePolicyFromLib(pe.Id);
            }

            if (fullDelete)
            {
                foreach (QueryEntity qe in le.Query)
                {
                    testController.DeleteQuery(qe.Id);
                }

                le.Delete();
            }
        }
Ejemplo n.º 2
0
        async void UpdateLibraries(string pref, string city)
        {
            var calilApi  = new CalilApi();
            var libraries = await calilApi.GetLibraryAsync(pref, city);

            listView.ItemsSource = libraries.Select(library => library.Name);
            listView.ItemTapped += async(sender, e) =>
            {
                var favorites = LibraryEntity.GetAll().ToList();
                var selected  = libraries.Where(library => library.Name == (string)e.Item).First();

                if (favorites.Contains(selected))
                {
                    await DisplayAlert("確認", "登録済みです", "閉じる");

                    return;
                }

                var yes = await DisplayAlert("登録", String.Format("{0}を登録しますか?", selected.Name), "はい", "いいえ");

                if (yes)
                {
                    selected.Write();
                    await Navigation.PopModalAsync(true);
                }
            };
        }
        /// <summary>Creates a new, empty LibraryEntity object.</summary>
        /// <returns>A new, empty LibraryEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new LibraryEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewLibrary
            // __LLBLGENPRO_USER_CODE_REGION_END
            return(toReturn);
        }
Ejemplo n.º 4
0
        private string SerializeEntity(XmlWriter xmlWriter, LibraryEntity entity)
        {
            var serializer = Serializers.FirstOrDefault(x => x.ElementType == entity.GetType());

            if (serializer == null)
            {
                throw new Exception($"Unexpected element: '{entity.GetType()}'. Serializer doesn't exist for this type!");
            }
            return(serializer.Serialize(entity));
        }
        public string Serialize(LibraryEntity entity)
        {
            var book = entity as Book;

            if (book == null)
            {
                throw new NullReferenceException();
            }

            var bookXml = new XElement(ElementTag,
                                       new XElement(_nameTag, book.Name),
                                       new XElement(_authorTag, book.Author),
                                       new XElement(_cityTag, book.City),
                                       new XElement(_yearTag, book.Year?.ToString()),
                                       new XElement(_pagesNumberTag, book.PagesNumber?.ToString()),
                                       new XElement(_noticeTag, book.Notice),
                                       new XElement(_isbnTag, book.ISBN),
                                       new XText($"{Environment.NewLine} "));

            return(bookXml.ToString(SaveOptions.None));
        }
Ejemplo n.º 6
0
        public string Serialize(LibraryEntity entity)
        {
            var patent = entity as Patent;

            if (patent == null)
            {
                throw new NullReferenceException();
            }

            var patentXml = new XElement(ElementTag,
                                         new XElement(_nameTag, patent.Name),
                                         new XElement(_inventorTag, patent.Inventor),
                                         new XElement(_countryTag, patent.Country),
                                         new XElement(_registrationNumberTag, patent.RegistrationNumber?.ToString()),
                                         new XElement(_applicationDateTag, patent.ApplicationDate?.ToString("yyyy-mm-dd")),
                                         new XElement(_publicationDateTag, patent.PublicationDate?.ToString("yyyy-mm-dd")),
                                         new XElement(_pagesNumberTag, patent.PagesNumber?.ToString()),
                                         new XElement(_noticeTag, patent.Notice),
                                         new XText($"{Environment.NewLine} "));

            return(patentXml.ToString());
        }
Ejemplo n.º 7
0
        public string Serialize(LibraryEntity entity)
        {
            var newspaper = entity as Newspaper;

            if (newspaper == null)
            {
                throw new NullReferenceException();
            }

            var newspaperXml = new XElement(ElementTag,
                                            new XElement(_nameTag, newspaper.Name),
                                            new XElement(_cityTag, newspaper.City),
                                            new XElement(_publisherNameTag, newspaper.PublisherName),
                                            new XElement(_yearTag, newspaper.Year?.ToString()),
                                            new XElement(_pagesNumberTag, newspaper.PagesNumber?.ToString()),
                                            new XElement(_noticeTag, newspaper.Notice),
                                            new XElement(_issueTag, newspaper.Issue?.ToString()),
                                            new XElement(_dateTag, newspaper.Date?.ToString("mm-dd")),
                                            new XElement(_issnTag, newspaper.ISSN),
                                            new XText($"{Environment.NewLine} "));

            return(newspaperXml.ToString());
        }
Ejemplo n.º 8
0
        private void importFolder(baseData vData)
        {
            string importFrom = Server.MapPath("~/bondiSVN");

            LibraryEntity li = vData.Library;

            li.Name = string.Format("Bondi SVN import at {0}", DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"));
            li.Save();

            DirectoryInfo di = new DirectoryInfo(importFrom);

            FileInfo[] files = di.GetFiles("*.*");

            foreach (FileInfo fi in files)
            {
                try
                {
                    importFile(vData, fi.Name, fi.FullName);
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 新增/修改 公用数据类型
 /// </summary>
 /// <param name="libraryEntity"></param>
 /// <returns></returns>
 public int LibrarySave(LibraryEntity libraryEntity)
 {
     return(QuerySingle <int>("P_Library_Save", libraryEntity, CommandType.StoredProcedure));
 }
Ejemplo n.º 10
0
 public async Task SearchInFavorites(string isbn, IProgress <List <SearchResult> > progress = null)
 {
     await Search(isbn, LibraryEntity.GetAll().ToList(), progress);
 }
Ejemplo n.º 11
0
 public async Task SearchInFavorites(string isbn, Action <List <SearchResult> > callback)
 {
     await Search(isbn, LibraryEntity.GetAll().ToList(), callback);
 }