コード例 #1
0
        public UserViewModel(StringsService stringService, IVTubeMonDbConnection vTubeMonDbConnection)
        {
            _stringService        = stringService;
            _vTubeMonDbConnection = vTubeMonDbConnection;
            UserCollection        = new ObservableCollection <IUser>(vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectUsersCommand()));
            UserSettingCollection = new ObservableCollection <UserSettingsMainViewModel>();

            InitializeUserSettings();
        }
コード例 #2
0
        public UserSettingsDetailCollectionViewModel(StringsService stringService, IVTubeMonDbConnection vTubeMonDbConnection)
        {
            _stringService        = stringService;
            _vTubeMonDbConnection = vTubeMonDbConnection;

            var list = new List <IUserSettingsMain>(_vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectUserSettingsMainCommand()));

            UserSettingsMainCollection = new ObservableCollection <UserSettingsMainViewModel>(list.Select(u => new UserSettingsMainViewModel(_vTubeMonDbConnection, u)));
        }
コード例 #3
0
        public CommandResult DailyCheckinCommand(ulong user, ulong guild, DateTime checkInDateTime, int dailyCash)
        {
            if (GetUser(user, guild) == null)
            {
                return(new CommandResult(CommandResultType.NotExist));
            }

            var queryDailiesCommand = new QueryCommand <Daily>("dailies", "*",
                                                               new WhereStatement()
            {
                Equality  = Equality.EqualTo,
                Value     = $"{user}",
                Target    = "id_user",
                UseQuotes = false
            },
                                                               new WhereStatement()
            {
                Equality  = Equality.EqualTo,
                Value     = $"{guild}",
                Target    = "id_guild",
                UseQuotes = false
            });

            List <Daily> dailies = _vTubeMonDbConnection.ExecuteDbQueryCommand(queryDailiesCommand).ToList();

            if (dailies.Any())
            {
                var lastCheckIn = dailies.Last();
                if (lastCheckIn.CheckInDate.Value.DayOfYear == DateTime.Now.DayOfYear)
                {
                    //already checked in
                    return(new CommandResult(CommandResultType.Duplicate));
                }
            }

            _vTubeMonDbConnection.ExecuteDbNonQueryCommand(new InsertCommand <IDaily>("dailies", new Daily(user, guild, checkInDateTime)));

            int             newCash    = TotalCash(user, guild) + dailyCash;
            NonQueryCommand updateCash = new NonQueryCommand("users", $"UPDATE `users` SET vtuber_cash = {newCash} WHERE id_user = {user} AND id_guild = {guild};");

            _vTubeMonDbConnection.ExecuteDbNonQueryCommand(updateCash);

            return(new CommandResult(CommandResultType.Success));
        }
コード例 #4
0
        public ItemViewModel(StringsService stringService, IVTubeMonDbConnection vTubeMonDbConnection)
        {
            _stringService         = stringService;
            _vTubeMonDbConnection  = vTubeMonDbConnection;
            ItemCollection         = new ObservableCollection <IItem>(vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectItemCommand()));
            ItemStatCollection     = new ObservableCollection <ItemStatViewModel>();
            ItemCategoryCollection = new ObservableCollection <ItemCategory>();

            InitializeItemStats();
            InitializeItemCategory();
        }
コード例 #5
0
        public SelectImageWorkItemAction(IVTubeMonDbConnection vTubeMonDbConnection, IModelService modelService, IFileService fileService)
        {
            _vTuberSelectionActionParameter    = new VTuberSelectionActionParameter(vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectVTubersCommand()));
            _browseFileWorkItemActionParameter = new BrowseFileWorkItemActionParameter("Image Files |*.bmp;*.jpg;*.png");

            ActionParameters = new ObservableCollection <IDatabaseWorkItemActionParameter>()
            {
                _vTuberSelectionActionParameter,
                _browseFileWorkItemActionParameter
            };

            _modelService = modelService;
            _fileService  = fileService;
        }
コード例 #6
0
 public DataCache(IVTubeMonDbConnection vTubeMonDbConnection)
 {
     _vTubeMonDbConnection = vTubeMonDbConnection;
     VtuberCache           = new DataCacheList <VTuber>(() => _vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectVTubersCommand()));
     AgencyCache           = new DataCacheList <Agency>(() => _vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectAgenciesCommand()));
 }
コード例 #7
0
 public CategoryViewModel(StringsService stringService, IVTubeMonDbConnection vTubeMonDbConnection)
 {
     _stringService         = stringService;
     _vTubeMonDbConnection  = vTubeMonDbConnection;
     ItemCategoryCollection = new ObservableCollection <ItemCategoryViewModel>(_vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectItemCategoryCommand()).Select(
                                                                                   u => new ItemCategoryViewModel(u, DeleteItem)));
     StatCategoryCollection = new ObservableCollection <StatCategoryViewModel>(_vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectStatCategoryCommand()).Select(
                                                                                   u => new StatCategoryViewModel(u, DeleteStat)));
 }
コード例 #8
0
 public UserSettingsMainViewModel(IVTubeMonDbConnection vtubeMonDbConnection, IUserSettingsMain userSetting = null)
 {
     UserSettingMain       = userSetting;
     _vTubeMonDbConnection = vtubeMonDbConnection;
     if (UserSettingMain != null)
     {
         SettingName = UserSettingMain.SettingName.Value;
         UserSettingsDetailCollection = new ObservableCollection <UserSettingsDetailViewModel>(_vTubeMonDbConnection.ExecuteDbQueryCommand(new SelectUserSettingsDetailsCommand(userSetting)).Select(u => new UserSettingsDetailViewModel(u)));
     }
 }