示例#1
0
 public MainWindow()
 {
     InitializeComponent();
     MySQLMain.SetupMySqlConnection();
     try
     {
         RoomViewModel      = new RoomViewModel();
         UserViewModel      = new UserViewModel();
         ComputerViewModel  = new ComputerViewModel();
         ComponentViewModel = new ComponentViewModel();
         JournalViewModel   = new JournalViewModel();
     }
     catch
     {
         MySQLMain.CloseConnection(); // сброс соединения в случае, если SQL-коннекторы не смогли закрыть соединение
         MessageBox.Show("Внимание, база данных не установлена. Пожалуйста, установите ее из резервной копии");
     }
     finally
     {
         ComputerTab.DataContext  = ComputerViewModel;
         ComponentTab.DataContext = ComponentViewModel;
         UserTab.DataContext      = UserViewModel;
         RoomTab.DataContext      = RoomViewModel;
         JournalTab.DataContext   = JournalViewModel;
     }
 }
        // GET: Journals/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Journal journal = db.Journals.Find(id);

            if (journal == null)
            {
                return(HttpNotFound());
            }

            JournalViewModel jvm = new JournalViewModel
            {
                Id        = journal.Id,
                PatientId = journal.Patient.Id,
                DoctorId  = journal.Doctor.Id,
                Diagnosis = journal.Diagnosis,
                DateVisit = journal.DateVisit
            };

            ViewBag.Patients = db.Patients.ToList();
            ViewBag.Doctors  = db.Doctors.ToList();

            return(View(jvm));
        }
        private async Task <IActionResult> HandleJournalEntryIndexRequest()
        {
            var selectedPeriod = ViewBag.SelectedPeriod as AccountingPeriodViewModel;

            var pendingJournalEntries = await _journalEntryRepository
                                        .GetPendingJournalEntriesForPeriodAsync(selectedPeriod.Id);

            var pendingEntriesViewModel = pendingJournalEntries
                                          .Select(JournalEntryDetailedViewModel.FromModel)
                                          .ToList();

            var pagination = ViewBag.Pagination as Pagination;

            var paginatedEntries = await _journalEntryRepository.GetJournalEntriesForPeriodAsync(
                selectedPeriod.Id,
                pagination);

            var paginatedEntriesViewModel = new PagedResult <JournalEntryDetailedViewModel>()
            {
                Pagination = paginatedEntries.Pagination,
                Results    = paginatedEntries
                             .Results
                             .Select(JournalEntryDetailedViewModel.FromModel)
                             .ToList()
            };

            var resultViewModel = new JournalViewModel()
            {
                PendingEntries = pendingEntriesViewModel,
                Entries        = paginatedEntriesViewModel
            };

            return(View(resultViewModel));
        }
示例#4
0
        public ActionResult Info(int id, int?set)
        {
            var courseDto = _courseService.GetCourseDtoById(id);

            if (set == null)
            {
                set = courseDto.CurrentSet;
            }

            if (courseDto.Teacher.Id != User.Identity.GetUserId())
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            var courseStudents = courseDto.CourseStudents.Where(x => x.Set == set);
            JournalViewModel journalViewModel = new JournalViewModel()
            {
                CourseId = courseDto.Id,
                CourseStudentViewModels = _mapper.Map <List <CourseStudentViewModel> >(courseStudents),
                StudentSet = courseDto.CurrentSet,
                CheckedSet = set.Value
            };

            journalViewModel.CourseStudentViewModels = journalViewModel.CourseStudentViewModels
                                                       .OrderBy(x => x.Student.ApplicationUser.SecondName).ToList();
            return(View(journalViewModel));
        }
 public JournalListLast()
 {
     this.InitializeComponent();
     conn      = new Connection().GetConnection();
     viewModel = new JournalViewModel();
     journals  = viewModel.JournalListLastMonth();
 }
示例#6
0
        public ActionResult Signup(JournalViewModel journalViewModel)
        {
            if (ModelState.IsValid)
            {
                Patient patient = db.Patients.Find(journalViewModel.Patient.Id);

                //Patient patient = new Patient()
                //{
                //    Id = journalViewModel.Patient.Id,
                //    Name = journalViewModel.Patient.Name,
                //    Iin = journalViewModel.Patient.Iin
                //};

                var newJournal = new Journal()
                {
                    Diagnosis = journalViewModel.Diagnosis,
                    DateVisit = journalViewModel.DateVisit,
                    Patient   = patient
                };

                db.Journals.Add(newJournal);

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(journalViewModel));
        }
示例#7
0
        public JournalDetails(User user, int journalID)
            : base(user, "Journal:" + journalID)
        {
            InitializeComponent();
            Journal model = null;

            if (journalID >= 0) {
                var service = new SupportService(user);
                model = service.GetJournal(journalID);
            } else {
                model = new Journal();
                model.JournalID = -1;
                model.FullName = "<New Journal>";
            }

            _viewModel = new JournalViewModel(model);

            _traits = tabJournal.AddTabItem("Traits", new TraitControl(user, TraitCategoryType.Journal, _viewModel));
            _notes = tabJournal.AddTabItem("Notes", new NotesControl(user, TraitCategoryType.Journal, _viewModel));
            tabJournal.AddTabItem("Ownership", new OwnershipDetails(model));

            if (_viewModel.JournalID >= 0) {
                _viewModel.DataChanged += new DataChangedHandler(viewModel_DataChanged);
            } else {
                Loaded += new RoutedEventHandler(JournalDetails_Loaded);
                _traits.IsEnabled = false;
                _notes.IsEnabled = false;
            }

            ChangesCommitted += new PendingChangesCommittedHandler(JournalDetails_ChangesCommitted);

            this.DataContext = _viewModel;
        }
        // GET: Patients/Create
        public ActionResult Signup(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Patient patient = db.Patients.Find(id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            var jvm = new JournalViewModel
            {
                Patient = new PatientViewModel
                {
                    Id   = patient.Id,
                    Iin  = patient.Iin,
                    Name = patient.Name
                },
            };

            ViewBag.Doctors = db.Doctors.ToList();
            return(View(jvm));
        }
示例#9
0
 public JournalView(JournalViewModel model)
 {
     InitializeComponent();
     this.DataContext = model;
     _ViemModel       = model;
     if (_ViemModel.JournalDetailsEntity != null)
     {
         this.dg1.ItemsSource = this._ViemModel.JournalDetailsEntity;
     }
     if (_ViemModel.MustCompare == true)
     {
         JournalDatepicker.IsEnabled = true;
         parttextbox.IsReadOnly      = false;
     }
     else
     {
         JournalDatepicker.IsEnabled = false;
         parttextbox.IsReadOnly      = true;
         btnNew.IsEnabled            = false;
     }
     if (btnSave.IsEnabled == true)
     {
     }
     else
     {
     }
     CustomGridLines.ItemsSource = DataGridTableCollection.GridLines(9, 50).AsEnumerable();
 }
示例#10
0
        public void OnNavigatedTo(int journalId)
        {
            var journauxService = new JournauxService();
            var journal = journauxService.LoadJournal(journalId);

            JournalViewModel = new JournalViewModel(journal);
        }
示例#11
0
        //Display all courses where user is signed
        // GET: /Manage/DisplayUserCourses
        public ActionResult DisplayUserCourses(string userId, string courseNameFilter, string courseStatusFilter, int?page)
        {
            logManager.AddEventLog("ManageController => DisplayUserCourses ActionResult called(GET)", "ActionResult");
            ViewBag.UserId       = userId ?? throw new ArgumentNullException();
            ViewBag.CourseName   = courseNameFilter;
            ViewBag.CourseStatus = courseStatusFilter;
            ViewBag.Status       = new SelectList(new List <string> {
                "All", "Unknown", "Upcoming", "Active", "Ended"
            });
            int pageSize   = 5;
            int pageNumber = (page ?? 1);

            var journalsList = journalsManager.GetAllJournalsForUser(userId);

            if (Request.HttpMethod == "POST")
            {
                List <JournalViewModel> journalsPost = JournalViewModel.GerSortedJournalsList(
                    courseNameFilter,
                    courseStatusFilter,
                    JournalViewModel.GetJournalsList(journalsList, usersManager, coursesManager
                                                     ));
                return(View(journalsPost.ToPagedList(pageNumber, pageSize)));
            }
            List <JournalViewModel> journals = JournalViewModel.GerSortedJournalsList(
                courseNameFilter,
                courseStatusFilter,
                JournalViewModel.GetJournalsList(journalsList, usersManager, coursesManager
                                                 ));


            return(View(journals.ToPagedList(pageNumber, pageSize)));
        }
示例#12
0
        public async Task <IActionResult> Home(string id)
        {
            var j = await _context.Journals.Include(a => a.CreatedByUser)
                    .SingleOrDefaultAsync(m => m.ShortName == id);

            if (HttpContext.Session.GetString("JId") != id)
            {
                j.Visitors++;
                HttpContext.Session.SetString("JId", id);
            }

            _context.SaveChanges();

            _context.SaveChanges();
            ViewData["journalid"]  = j.Id;
            ViewData["jshortname"] = id;
            var journalViewModel = new JournalViewModel
            {
                AreaEditors            = _context.AreaEditors.Include(a => a.Journal).Where(a => a.JournalId == j.Id).OrderBy(a => a.Id),
                ManuscriptsManuscripts = _context.Manuscripts.Where(a => a.JournalId == j.Id).Include(a => a.Journal).Include(a => a.JournalArticleType).Include(a => a.CorrespondingAuthor),
                SubmissionReviewers    = _context.SubmissionReviewers.Include(a => a.Submission.Manuscript.Journal).Where(a => a.Submission.Manuscript.JournalId == j.Id),
                Journal = await _context.Journals.Include(a => a.Publisher)
                          .SingleOrDefaultAsync(m => m.ShortName == id),
                JournalIssues = _context.JournalIssues
                                .Where(m => m.JournalId == j.Id && m.IsPublished == true).ToList(),
                JournalPages = _context.JournalPages
                               .Where(m => m.JournalId == j.Id).ToList(),
            };

            return(View(journalViewModel));
        }
        public ActionResult Index()
        {
            JournalViewModel model = new JournalViewModel()
            {
                ListCams = new List <CameraHistory>()
            };

            List <Camera> cams;

            using (JournalDbCobtext db = new JournalDbCobtext())
            {
                cams = db.Cameras.ToList();
            }

            foreach (var cam in cams)
            {
                model.ListCams.Add(new CameraHistory
                {
                    Title = cam.Title,
                    Data  = DataProvider.GetData(DateTime.Parse("2017-05-06"), cam.Id)
                });
            }

            return(View(model));
        }
示例#14
0
        public IActionResult Journal(JournalViewModel input)
        {
            int validID = input.TransactionIDs.Find(x => x > -1);

            if (validID != 0)
            {
                switch (input.Action)
                {
                case JournalAction.EditTransaction:
                    TransactionViewModel model = transactionUtils.ConvertToTransactionViewModel(validID);
                    if (model != null)
                    {
                        model.Action = JournalAction.EditTransaction;
                        return(View("RecordTransaction", model));
                    }
                    return(RedirectToAction("Journal"));

                case JournalAction.DeleteTransaction:
                    transactionUtils.DeleteTransaction(validID);
                    return(RedirectToAction("Journal"));
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
示例#15
0
        //Manage journals when course is Ended
        // GET: /Journal/ManageJournal
        public ActionResult ManageJournal(int courseId, string userFirstNameFilter, string userLastNameFilter, int?page, string statusMessage)
        {
            logManager.AddEventLog("JournalController => ManageJournal ActionResult called(GET)", "ActionResult");
            ViewBag.StatusMessage   = statusMessage;
            ViewBag.FirstNameFilter = userFirstNameFilter;
            ViewBag.LastNameFilter  = userLastNameFilter;
            ViewBag.CourseId        = courseId;
            int pageSize     = 5;
            int pageNumber   = (page ?? 1);
            var journalsList = journalsManager.GetMarksForUsers(courseId);
            var course       = coursesManager.GetSpecificCourse(courseId);

            var courseLectorId = course.LectorId;
            var currentUserId  = User.Identity.GetUserId();

            if (courseLectorId == currentUserId && course.CourseStatus == Course.Status.Ended)
            {
                if (Request.HttpMethod == "POST")
                {
                    journalsList = usersManager.GetSortedUsersList(userFirstNameFilter, userLastNameFilter, null, journalsList);
                    List <JournalViewModel> journalsPost = JournalViewModel.GetJournalsList(journalsList, course);

                    return(View(journalsPost.ToPagedList(pageNumber, pageSize)));
                }
                journalsList = usersManager.GetSortedUsersList(userFirstNameFilter, userLastNameFilter, null, journalsList);
                List <JournalViewModel> journals = JournalViewModel.GetJournalsList(journalsList, course);

                return(View(journals.ToPagedList(pageNumber, pageSize)));
            }
            return(View("Error"));
        }
        private async void SetJournalText(DateTime journalDate)
        {
            var _journal = await App.Repository.Journals.GetAsyncByDate(journalDate);

            CurrentJournalViewModel = new JournalViewModel(_journal);
            JournalContentsBox.Document.SetText(Windows.UI.Text.TextSetOptions.None, CurrentJournalViewModel.JournalContents);
        }
示例#17
0
        public JournalAdd()
        {
            this.InitializeComponent();
            conn = new Connection().GetConnection();
            conn.CreateTable <Journal>();
            viewModel = new JournalViewModel();
            accountVM = new AccountViewModel();
            partyVM   = new PartyViewModel();
            typeVM    = new JournalTypeViewModel();
            settings  = new SettingsViewModel();

            LoadPage();


            // Testing JSON Operation
            Dictionary <int, int> data = new Dictionary <int, int>()
            {
                { 1, 2 },
                { 3, 4 }
            };
            string abc = JsonConvert.SerializeObject(data, Formatting.Indented);

            Debug.WriteLine("###################################################");
            Debug.WriteLine(abc.ToString());

            Dictionary <int, int> returnData = JsonConvert.DeserializeObject <Dictionary <int, int> >(abc);

            Debug.WriteLine("###################################################");
            foreach (KeyValuePair <int, int> acc in returnData)
            {
                Debug.WriteLine("Key = {0}, Value = {1}", acc.Key, acc.Value);
            }
        }
示例#18
0
        public IActionResult Create(JournalViewModel journalView)
        {
            if (ModelState.IsValid)
            {
                var fileName = ContentDispositionHeaderValue
                               .Parse(journalView.File.ContentDisposition)
                               .FileName
                               .Trim('"');     // FileName returns "fileName.ext"(with double quotes)

                if (fileName.EndsWith(".pdf")) // Important for security if saving in webroot
                {
                    var journal = Mapper.Map <Journal>(journalView);

                    var publisher = _context.Publishers.FirstOrDefault(x => x.PublisherId == journalView.PublisherId);
                    journal.Publisher = publisher;
                    _context.Journals.Add(journal);
                    _context.SaveChanges();

                    return(RedirectToAction("Manage"));
                }
            }

            ViewBag.CategoryId  = new SelectList(_context.Categories, "CategoryId", "Name", journalView.CategoryId);
            ViewBag.PublisherId = new SelectList(_context.Publishers, "PublisherId", "Name", journalView.PublisherId);
            ModelState.AddModelError(string.Empty, "Invalid file format.  Please use PDF format");

            ConfigureJournal(journalView);
            return(View(journalView));
        }
示例#19
0
        /// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(JournalViewModel model)
        {
            var entity = model.ToEntity();

            this._JournalsRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
示例#20
0
 public ActionResult Edit([Bind(Include = "Id,Category,Date,Amount,Remark")] JournalViewModel model)
 {
     if (ModelState.IsValid)
     {
         this._accountingService.Update(model);
         this._accountingService.Save();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
示例#21
0
        //
        // GET: /JournalsManager/Create
        public IActionResult Create()
        {
            var journalViewModel = new JournalViewModel();

            ViewBag.CategoryId  = new SelectList(_context.Categories, "CategoryId", "Name", journalViewModel.CategoryId);
            ViewBag.PublisherId = new SelectList(_context.Publishers, "PublisherId", "Name", journalViewModel.PublisherId);

            ConfigureJournal(journalViewModel);
            return(View(journalViewModel));
        }
示例#22
0
        public async Task <(JournalViewModel, ServiceModelState)> GetById(string id)
        {
            var user    = context.GetCurrentUser();
            var journal = await context.Journals.AsNoTracking()
                          .Where(j => j.Id == id)
                          .IncludeAccounts()
                          .SingleOrDefaultAsync();

            return(JournalViewModel.Of(journal), null);
        }
示例#23
0
        public ActionResult Create([Bind(Include = "Id,Category,Date,Amount,Remark")] JournalViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.Id = Guid.NewGuid();
                this._accountingService.Insert(model);
                this._accountingService.Save();
            }

            return(View(model));
        }
示例#24
0
        public JournalViewModel DomainToViewModel(ResponseJournalViewModel responseJournalViewModel)
        {
            var journalViewModel = new JournalViewModel
            {
                Id           = responseJournalViewModel.Id,
                Name         = responseJournalViewModel.Name,
                Date         = responseJournalViewModel.Date,
                ArticlesList = _articleRepository.GetArticles(responseJournalViewModel.ArticlesList),
            };

            return(journalViewModel);
        }
        public void Insert(JournalViewModel fromUI)
        {
            var entity = new AccountBook();

            entity.Id         = fromUI.Id;
            entity.Categoryyy = (int)fromUI.Category;
            entity.Dateee     = fromUI.Date;
            entity.Amounttt   = decimal.ToInt32(fromUI.Amount);
            entity.Remarkkk   = fromUI.Remark;

            this.AccountBook.Add(entity);
        }
示例#26
0
 public virtual ActionResult Edit(JournalViewModel vm)
 {
     return(ThrowIfNotLoggedIn(() => TryExecute(() =>
     {
         var dateOfTransfer = DateTime.ParseExact(vm.DateOfTransfer, "dd/MM/yyyy", CultureInfo.InvariantCulture);
         var journal = _journelService.UpdateAccount(dateOfTransfer, vm.Reference,
                                                     vm.Description, long.Parse(vm.SelectedFromAccount),
                                                     long.Parse(vm.SelectedToAccount), vm.Amount, EntryType.Journal,
                                                     WebUser.TenantId, vm.Id);
         return journal;
     })));
 }
示例#27
0
        public async Task <IActionResult> Journal()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(View(null));
            }
            IdentityUserExtended currentUser = await userManager.GetUserAsync(User);

            JournalViewModel journal = transactionUtils.RetrieveAllTransactionsByUser(currentUser.UserInfoID);

            return(View(journal));
        }
示例#28
0
        public static JournalViewModel Journal2Model(Journal j)
        {
            // Find user
            var user  = UserManager.FindById(j.AspNetUserId.ToString());
            var model = new JournalViewModel
            {
                Id     = j.Id,
                Title  = j.Title,
                Author = user?.UserName,
            };

            return(model);
        }
        public ActionResult Delete(JournalViewModel journal)
        {
            var selectedJournal = Mapper.Map <JournalViewModel, Journal>(journal);

            var opStatus = _journalRepository.DeleteJournal(selectedJournal);

            if (!opStatus.Status)
            {
                throw new System.Web.Http.HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Filter(JournalViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _systemAuditService.FilterAsync(vm.Email, vm.StartDate, vm.EndDate);

                if (result.IsValid)
                {
                    return(Json(result.Result));
                }
                return(BadRequest(result.ErrorsList));
            }
            return(BadRequest(ModelState.GetErrors()));
        }
示例#31
0
        /// <summary>
        /// Throw an exception if name is exist.
        /// </summary>
        /// <param name="model">Journal view model</param>
        public void ThrowExceptionIfExist(JournalViewModel model)
        {
            ConditionFilter <Journal, long> condition = new ConditionFilter <Journal, long>
            {
                Query = (entity =>
                         //entity.Name == model.Name &&
                         entity.Code == model.Code)
            };
            var existEntity = this._JournalsRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
            {
                throw new ItemAlreadyExistException();
            }
        }
示例#32
0
        public ActionResult Edit(JournalViewModel model)
        {
            if (ModelState.IsValid)
            {
                Journal journal = new Journal();
                Model2Journal(model, journal);
                journal.AspNetUserId = new Guid(User.Identity.GetUserId());

                db.Entry(journal).State = EntityState.Modified;
                Model2Journal(model, journal);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
示例#33
0
 private void EditJournal(JournalViewModel viewModel)
 {
     if (viewModel != null) {
         Owner.EditJournal(viewModel.JournalID);
     }
 }
示例#34
0
        private void DeleteJournal(JournalViewModel model)
        {
            if (!User.HasPermission(PermissionCategory.SUPPORT_JOURNALS, PERMISSION_MASK.DELETE)) {
                ErrorMessage.Show("You do not have sufficient priviledges to delete journals!");
                return;
            }

            var service = new SupportService(User);
            if (service.OkToDeleteJournal(model.JournalID)) {
                if (this.Question(string.Format("Are you sure you wish to permanently delete the journal '{0}'?", model.FullName), "Delete Journal?")) {
                    if (_findModel.Contains(model)) {
                        _findModel.Remove(model);
                    }

                    if (_page.Model.Contains(model)) {
                        _findModel.Remove(model);
                    }

                    RegisterPendingChange(new DeleteJournalCommand(model.Model));
                }
            } else {
                ErrorMessage.Show("You cannot delete this Journal at this time. This is most probably because this Journal is cited in one or more References.");
            }
        }