public void Delete(long id)
        {
            Book r = Get(id);

            DbStore.Delete <Book>(r);
            bookdetails.Remove(r);
        }
        public Role Update(Role t)
        {
            if (!IsDuplicate(t))
            {
                if (t.Id <= 0)
                {
                    throw new ArgumentException("Invalid Role Id");
                }

                Role f = Get(t.Id);

                if (f == null)
                {
                    throw new ArgumentNullException($"Role with id {t.Id} does not exist or its deleted");
                }

                f.Name = t.Name;


                f = DbStore.Save <Role>(f);

                if (f != null)
                {
                    roles.Remove(t);
                    roles.Add(f);
                }

                return(f);
            }
            else
            {
                throw new DuplicateItemException("Role already exists");
            }
        }
示例#3
0
        public LibraryLog Update(LibraryLog t)
        {
            LibraryLog f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"Log Details with id {t.Id} does not exist or its deleted");
            }

            libraryLogs.Remove(t);


            if (t.Id <= 0)
            {
                throw new ArgumentException("Invalid Log Details Item Id");
            }

            f.BookNo         = t.BookNo;
            f.BookName       = t.BookName;
            f.MemberName     = t.MemberName;
            f.MobileNo       = t.MobileNo;
            f.Address        = t.Address;
            f.CheckedOutDate = t.CheckedOutDate;
            f.ReturnedDate   = t.ReturnedDate;



            f = DbStore.Save <LibraryLog>(f);

            return(f);
        }
        public Book Update(Book t)
        {
            string cName = t.CategoryId.CategoryName;

            if (t.Id <= 0)
            {
                throw new ArgumentException("Invalid Book Item Id");
            }

            Book f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"Book Item with id {t.Id} does not exist or its deleted");
            }


            f.BookNo     = t.BookNo;
            f.BookName   = t.BookName;
            f.AuthorName = t.AuthorName;
            f.CategoryId = t.CategoryId;

            f = DbStore.Save <Book>(f);

            return(f);
        }
        public void Delete(long id)
        {
            Member r = Get(id);

            DbStore.Delete <Member>(r);
            member.Remove(r);
        }
        public PettyCash Update(PettyCash t)
        {
            if (t.Id <= 0)
            {
                throw new ArgumentException("Invalid PettyCash Id");
            }

            PettyCash f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"PettyCash with id {t.Id} does not exist or its deleted");
            }


            f.PaidTo        = t.PaidTo;
            f.Description   = t.Description;
            f.Amount        = t.Amount;
            f.PaymentMode   = t.PaymentMode;
            f.TransactionId = t.TransactionId;
            f.ReceivedDate  = t.ReceivedDate;
            f.EntryBy       = t.EntryBy;
            f.Status        = t.Status;
            f.AttachedFiles = t.AttachedFiles;

            f = DbStore.Save <PettyCash>(f);

            return(f);
        }
        public BookCategory Update(BookCategory t)
        {
            BookCategory f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"BookCategory Item with id {t.Id} does not exist or its deleted");
            }

            bookCategory.Remove(t);

            if (!IsDuplicate(t))
            {
                if (t.Id <= 0)
                {
                    throw new ArgumentException("Invalid BookCategory Item Id");
                }

                f.CategoryName = t.CategoryName;
                f.Quantity     = t.Quantity;


                f = DbStore.Save <BookCategory>(f);

                return(f);
            }
            else
            {
                bookCategory.Add(f);
                throw new DuplicateItemException("BookCategory Item already exists");
            }
        }
        public void Delete(long id)
        {
            Role r = Get(id);

            DbStore.Delete <Role>(r);
            roles.Remove(r);
        }
        public void Delete(long id)
        {
            PettyCash r = Get(id);

            DbStore.Delete <PettyCash>(r);
            pettycashes.Remove(r);
        }
示例#10
0
        private static async Task Run(WaitHandle done, CancellationToken cancellationToken)
        {
            // Run
            var tasks = new List <Task>();

            using (var host = CreateWebHost())
            {
                Metrics.Instance = host.Services.GetRequiredService <IMetrics>();

                // Dependencies
                var connectionStringBuilder = new SqlConnectionStringBuilder(
                    "Server=(local);Initial Catalog=EventStore;Integrated Security=SSPI;Connection Timeout=60;");
                var connectionProvider = new ConnectionProvider(connectionStringBuilder);
                var dbStore            = new DbStore(connectionProvider);

                // Init
                await dbStore.PrepareDatabaseAsync(cancellationToken);

                await dbStore.ClearEventsAsync(cancellationToken);

                foreach (var appConfig in CreateApplications())
                {
                    var app = new Application(dbStore, appConfig);
                    Task.Run(() => app.Start(cancellationToken));
                }

                tasks.Add(host.StartAsync(cancellationToken));

                done.WaitOne();
            }

            await Task.WhenAll(tasks);
        }
        public void Delete(long id)
        {
            MemberType r = Get(id);

            DbStore.Delete <MemberType>(r);
            memberType.Remove(r);
        }
        public void Delete(long id)
        {
            Branch r = Get(id);

            DbStore.Delete <Branch>(r);
            branches.Remove(r);
        }
示例#13
0
        public ConfigDbContext(IOptions <ConfigDbSettings> options)
        {
            var configDbSettings = options.Value;

            ArangoDatabase.ChangeSetting(s =>
            {
                s.Database   = configDbSettings.DbName;
                s.Url        = configDbSettings.Url;
                s.Credential = new NetworkCredential(configDbSettings.UserName, configDbSettings.Password);
                s.SystemDatabaseCredential = new NetworkCredential(configDbSettings.UserName, configDbSettings.Password);
            });

            using (var db = ArangoDatabase.CreateWithSetting())
            {
                Versions = db.Document <DbVersions>(configDbSettings.BaseVersion);

                AppDefaults = db.Document <DbAppDefaults>(Versions.AppDefaults);

                UserDefaults = db.Document <DbUserDefaults>(Versions.UserDefaults);

                Cakes = db.Document <DbCakes>(Versions.Cakes);

                Avatars = db.Document <DbAvatars>(Versions.Avatars);

                Buildings = db.Document <DbBuildings>(Versions.Buildings);

                Store = db.Document <DbStore>(Versions.Store);
            }
        }
示例#14
0
        public void Delete(long id)
        {
            LibraryLog r = Get(id);

            DbStore.Delete <LibraryLog>(r);
            libraryLogs.Remove(r);
        }
        public void Delete(long id)
        {
            BookCategory r = Get(id);

            DbStore.Delete <BookCategory>(r);
            bookCategory.Remove(r);
        }
示例#16
0
        public List <User> Get()
        {
            List <User> userlist   = null;
            var         expression = PredicateBuilder.Create <User>(d => d.DeletedDate == null);

            userlist = DbStore.ExecuteeExpressionList <User>(expression);
            return(userlist);
        }
示例#17
0
        public TokenManager(DbStore database)
        {
            dbTokenList = database.GetCollection <DbApiToken>(ApiTokenTable);
            dbTokenList.EnsureIndex(x => x.UserUid, true);
            dbTokenList.EnsureIndex(x => x.Token, true);

            database.GetMetaData(ApiTokenTable);
        }
 public List <Member> GetMember()
 {
     if (member == null)
     {
         var expression = PredicateBuilder.Create <Member>(d => d.DeletedDate == null);
         member = DbStore.ExecuteeExpressionList <Member>(expression);
     }
     return(member);
 }
 public List <PettyCash> GetPettyCash()
 {
     if (pettycashes == null)
     {
         var expression = PredicateBuilder.Create <PettyCash>(d => d.DeletedDate == null);
         pettycashes = DbStore.ExecuteeExpressionList <PettyCash>(expression);
     }
     return(pettycashes);
 }
 public List <Book> GetBookDetails()
 {
     if (bookdetails == null)
     {
         var expression = PredicateBuilder.Create <Book>(d => d.DeletedDate == null);
         bookdetails = DbStore.ExecuteeExpressionList <Book>(expression);
     }
     return(bookdetails);
 }
示例#21
0
        public HistoryManager(ConfHistory config, DbStore database)
        {
            Formatter = new SmartHistoryFormatter();

            this.config   = config;
            this.database = database;

            Initialize();
        }
示例#22
0
 public List <LibraryLog> GetLibraryLog()
 {
     if (libraryLogs == null)
     {
         var expression = PredicateBuilder.Create <LibraryLog>(d => d.DeletedDate == null);
         libraryLogs = DbStore.ExecuteeExpressionList <LibraryLog>(expression);
     }
     libraryLogs.Distinct();
     return(libraryLogs);
 }
示例#23
0
        public Stats(ConfRoot conf, DbStore database, BotManager botManager)
        {
            this.conf          = conf;
            this.database      = database;
            this.botManager    = botManager;
            uploadParamEnabled = true;
            runtimeLastTrack   = Tools.Now;

            ReadAndUpgradeStats();
        }
 public List <BookCategory> GetBookCategory()
 {
     if (bookCategory == null)
     {
         var expression = PredicateBuilder.Create <BookCategory>(d => d.DeletedDate == null);
         bookCategory = DbStore.ExecuteeExpressionList <BookCategory>(expression);
     }
     bookCategory.Distinct();
     return(bookCategory);
 }
        public List <Branch> GetBranches()
        {
            if (branches == null)
            {
                var expression = PredicateBuilder.Create <Branch>(d => d.DeletedDate == null);
                branches = DbStore.ExecuteeExpressionList <Branch>(expression);
            }

            branches.Sort();
            return(branches);
        }
        public List <Role> GetRoles()
        {
            if (roles == null)
            {
                var expression = PredicateBuilder.Create <Role>(d => d.DeletedDate == null);
                roles = DbStore.ExecuteeExpressionList <Role>(expression);
            }

            roles.Sort();
            return(roles);
        }
示例#27
0
        public User Get(long id)
        {
            User user = null;

            if (user == null)
            {
                var expression = PredicateBuilder.Create <User>(d => d.Id == id && d.DeletedDate == null);
                user = DbStore.ExecuteExpressionFirst <User>(expression);
            }
            return(user);
        }
示例#28
0
        public SessionManager(DbStore database)
        {
            Util.Init(ref openSessions);
            Util.Init(ref liveTokenList);

            dbTokenList = database.GetCollection <DbApiToken>(ApiTokenTable);
            dbTokenList.EnsureIndex(x => x.UserUid, true);
            dbTokenList.EnsureIndex(x => x.Token, true);

            database.GetMetaData(ApiTokenTable);
        }
示例#29
0
        private static void DbStoreOptions(DbStore dbStore)
        {
            dbStore.DbName  = "theatreTicketsDb";
            dbStore.Version = 1;

            dbStore.Stores.Add(TheaterSchema);
            dbStore.Stores.Add(HallSchema);
            dbStore.Stores.Add(PlaySchema);
            dbStore.Stores.Add(PlayDateTimeSchema);
            dbStore.Stores.Add(TicketSchema);
            dbStore.Stores.Add(UserSchema);
        }
示例#30
0
            public void Build()
            {
                Store = new DbStore();
                if (!ConfigCheck())
                {
                    return;
                }
                //,default, ConsoleColor.Blue;
                //IO?.Write("Enter Source Directory>");
                //
                if (!Directory.Exists(Config.DataPath))
                {
                    IO?.Write("Directory Not Exist!", OutputType.Error);

                    return;
                }
                var numbRgx = new Regex("[0-9]");
                var di      = new DirectoryInfo(Config.DataPath);

                foreach (var actorShell in di.GetDirectories())
                {
                    foreach (var actorDir in actorShell.GetDirectories())
                    {
                        var actorInfo = actorDir.Name.Split('-');

                        var actorName = actorInfo[1];
                        var actor     = new DbStore.SrcActor
                        {
                            Index  = 26 * (actorInfo[0][0] - 'A') + actorInfo[0][1] - 'A',
                            Name   = actorName,
                            Stared = (actorInfo.Length == 3)
                        };
                        Store.Actors.Add(actor);
                        var itemIndex = 0;
                        foreach (var item in actorDir.GetFiles())
                        {
                            var itemInfoArr = SplitFn(item);
                            if (itemInfoArr.Length < 4)
                            {
                                IO?.WriteLine($"FORMAT ERROR:{itemInfoArr[0]}");
                                continue;
                            }
                            var itemInfo = new DbStore.SrcItem
                            {
                                Path = item.FullName,
                                Name = itemInfoArr.Length > 4 && numbRgx.IsMatch(itemInfoArr[4])
                                ? $"{itemInfoArr[2].ToUpper()}-{itemInfoArr[3].ToUpper()}-{itemInfoArr[4]}"
                                : $"{itemInfoArr[2].ToUpper()}-{itemInfoArr[3].ToUpper()}"
                            };

                            if (itemInfoArr.Length > 4)
                            {
                                foreach (var label in itemInfoArr[4..])