Example #1
0
        private async void SaveAction()
        {
            if (string.IsNullOrWhiteSpace(CurrentNotice.Title))
            {
                _dialog.ShowMessage("Error", "Invalid Title");
            }
            else if (string.IsNullOrWhiteSpace(CurrentNotice.Message))
            {
                _dialog.ShowMessage("Error", "Invalid Message");
            }
            else
            {
                CurrentNotice.PostType = CurrentPost;
                if (CurrentCourse != null && HasCourse)
                {
                    CurrentNotice.CourseId = CurrentCourse.Id;
                }
                IsBusy = true;
                if (CurrentNotice.Id == 0)
                {
                    var res = await _noticeHandler.AddPost(CurrentNotice, DBFiles.ToList());

                    ShowResponse(res, true);
                }
                else
                {
                    var res = await _noticeHandler.UpdatePost(CurrentNotice);

                    ShowResponse(res, true);
                }
                IsBusy = false;
            }
        }
Example #2
0
        private async void AddMaterialAction()
        {
            IsBusy = true;
            var file = await _filePicker.PickFile();

            if (file != null && CurrentCourse.Id == 0)
            {
                if (CurrentCourse.Id != 0)
                {
                    var res = await _courseHandler.AddMaterial(CurrentCourse.Id, new List <DBFile> {
                        file
                    });

                    if (res != null)
                    {
                        _dialog.ShowToastMessage(res.Message);
                        if (res.Actionstatus)
                        {
                            DBFiles.Add(file);
                        }
                    }
                }
            }
            IsBusy = false;
        }
Example #3
0
        public ActionResult ImportDB()
        {
            DBFiles proxy = new DBFiles();

            ViewBag.DataMessage = proxy.MakeTables();

            return(View("Index"));
        }
Example #4
0
        public ActionResult ExportDB()
        {
            DBFiles proxy = new DBFiles();

            ViewBag.DataMessage = proxy.ExportDatabase();

            return(View("Index"));
        }
Example #5
0
        private async void AddMaterialAction()
        {
            var pickFile = await _preferneceEngine.PickFile();

            if (pickFile != null)
            {
                DBFiles.Add(pickFile);
            }
        }
Example #6
0
        public void LoadData(Guid key)
        {
            BasicDatasUpdated = false;
            db.DatabasePath   = PfadClass.Instance().DatabasePfad;
            var data = db.GetByID(key);

            piclist = new PictureListClass();
            var SFiles = new List <DBFiles>();

            actData = data[0];
            DataToEdit();
            EditToData();
            axWMP.Hide();

            /*
             * btnPause.Enabled    = false;
             * btnStopPlay.Enabled = false;
             * btnPlay.Enabled     = false;
             * btnContinue.Enabled  = false;
             */
            foreach (var actFl in actData.SongFiles)
            {
                if (GlobalFunctionsClass.Instance().SongType(actFl.FilesName) == eDBSongFileType.songimage)
                {
                    SFiles.Add(actFl);
                }
                else if (GlobalFunctionsClass.Instance().SongType(actFl.FilesName) == eDBSongFileType.mp3file)
                {
                    AudioFile = actFl;
                    if (AudioFile != null)
                    {
                        /*
                         * btnPause.Enabled    = true;
                         * btnStopPlay.Enabled = true;
                         * btnPlay.Enabled     = true;
                         * btnContinue.Enabled  = true;
                         */
                        axWMP.Show();
                        PlaySongWP();
                    }
                }
            }
            SFiles.Sort();
            actData.SongFiles = SFiles.ToArray();
            int n = 0;

            foreach (var fls in actData.SongFiles)
            {
                string guid  = fls.FilesID.ToString();
                var    files = db.GetImage(guid);
                piclist.AddNewPicture(pnlSheets, db.ActMemoryStream);
                n++;
            }
            pbShownPages.Minimum = 0;
            pbShownPages.Maximum = (n <= 1) ? 1 : n - 1;
            pbShownPages.Value   = (ActPicStart + ShowCount > pbShownPages.Maximum) ? pbShownPages.Maximum : ActPicStart + ShowCount;
        }
Example #7
0
        private async void LoadCourseDataAsync(Course course)
        {
            var fullCourse = await _courseHandler.GetCourse(course.Id);

            if (fullCourse != null)
            {
                DBFiles.Clear();
                Lessons.Clear();
                foreach (var item in fullCourse.CourseMaterials)
                {
                    DBFiles.Add(item);
                }
                foreach (var item in fullCourse.Lessons)
                {
                    Lessons.Add(item);
                }
                CurrentSemester = course.Semester;
            }
        }
Example #8
0
        private async void DeleteMaterialAction(DBFile obj)
        {
            var confirm = await _dialog.ShowConfirmation("Confirm", "Are you sure you want to delete this material");

            if (confirm)
            {
                IsBusy = true;
                var res = await _courseHandler.DeleteCouseMaterial(obj);

                if (res != null)
                {
                    _dialog.ShowToastMessage(res.Message);
                }

                if (res.Actionstatus)
                {
                    DBFiles.Remove(obj);
                }

                IsBusy = false;
            }
        }
Example #9
0
        private async void SaveAction()
        {
            if (string.IsNullOrEmpty(CurrentCourse.CourseName))
            {
                _dialog.ShowToastMessage("Invalid Name");
            }
            else if (string.IsNullOrEmpty(CurrentCourse.CourseId))
            {
                _dialog.ShowToastMessage("Incalid Course ID");
            }
            else if (CurrentCourse.CourseCredit <= 0)
            {
                _dialog.ShowToastMessage("Credit hour should be greater than 0");
            }
            else
            {
                if (CurrentCourse.Id == 0)
                {
                    var res = await _courseHandler.CreateCourse(CurrentSemester.Id, CurrentCourse, DBFiles.ToList());

                    if (res != null && res.Actionstatus && res.Data is int id)
                    {
                        CurrentCourse.Id = id;
                        AllowModify      = true;
                    }
                    ShowResponse(res);
                }
                else
                {
                    var res = await _courseHandler.UpdateCourse(CurrentCourse);

                    if (res != null && res.Actionstatus)
                    {
                        _nav.GoBack();
                    }
                    ShowResponse(res);
                }
            }
        }