Beispiel #1
0
        public override void FuncPreInitCreateView()
        {
            base.FuncPreInitCreateView();
            var subjects = new SubjectModel <Subject>().GetData(isBlock: false);

            ViewBag.SubjectID = subjects.Select(x => new CustomSelectListItem()
            {
                Text = x.SubjectName, Value = x.SubjectID.ToString()
            }).ToList();
        }
Beispiel #2
0
 public override void FuncPreInitEditView(object id, ref Conference EditItem, ref ConferenceEditModel model)
 {
     if (EditItem == null)
     {
         //get the item by id
         EditItem = new ConferenceModel <Conference>().Get(id);
     }
     if (EditItem != null)
     {
         model          = new ConferenceEditModel();
         model.EditItem = EditItem;
         var subjects = new SubjectModel <Subject>().GetData(isBlock: false);
         ViewBag.SubjectID = subjects.Select(x => new CustomSelectListItem()
         {
             Text = x.SubjectName, Value = x.SubjectID.ToString()
         }).ToList();
     }
 }
Beispiel #3
0
 public override void FuncPreInitEditView(object id, ref Journal EditItem, ref JournalEditModel model)
 {
     if (EditItem == null)
     {
         //get the item by id
         EditItem = new JournalModel <Journal>().Get(id);
     }
     if (EditItem != null)
     {
         model          = new JournalEditModel();
         model.EditItem = EditItem;
         var selectedItem = EditItem;
         var subjects     = new SubjectModel <Subject>().GetData();
         ViewBag.SubjectID = subjects.Select(x => new CustomSelectListItem()
         {
             Text = x.SubjectName, Value = x.SubjectID.ToString(), Selected = (x.SubjectID == selectedItem.SubjectID)
         }).ToList();
         var publishPeriod = new PublishPeriodModel <PublishPeriod>().GetData();
         ViewBag.PublishPeriodID = publishPeriod.Select(x => new CustomSelectListItem()
         {
             Text = x.PublishPeriodName, Value = x.PublishPeriodID.ToString(), Selected = (x.PublishPeriodID == selectedItem.PublishPeriodID)
         }).ToList();
     }
 }
Beispiel #4
0
        public PartialViewResult Partial_SubjectJournalJournalVersion(PartialParamters.Subject subject = null, PartialParamters.Journal journal = null, PartialParamters.JournalVersion journalVersion = null)
        {
            //prepare dropdown list for item references
            if (subject != null && subject.Show == true && subject.Items == null)
            {
                //get all subjects
                IEnumerable <SubjectViewModel> subjects = new SubjectModel <SubjectViewModel>().GetData();
                subject.Items = subjects.Select(x => new CustomSelectListItem()
                {
                    Text = x.SubjectName, Value = x.SubjectID.ToString(), Selected = (subject.SelectedItem == x.SubjectID.ToString())
                }).OrderBy(x => x.Text);
                if (subject.UseSelect)
                {
                    subject.SelectedItem = null;
                }
                else if (string.IsNullOrEmpty(subject.SelectedItem))
                {
                    subject.SelectedItem = subject.Items.ElementAt(0).Value;
                    subject.Items.ElementAt(0).Selected = true;
                }
            }

            if (journal != null && journal.Show == true && journal.Items == null)
            {
                //get all journals
                IEnumerable <JournalViewModel> journals = new JournalModel <JournalViewModel>().Get();
                journal.Items = journals.Select(x => new CustomSelectListItem()
                {
                    Text = x.JournalName, Value = x.JournalID.ToString(), Group = new SelectListGroup()
                    {
                        Name = x.SubjectID.ToString()
                    }, Selected = (journal.SelectedItem == x.JournalID.ToString())
                }).OrderBy(x => x.Text);
                if (journal.UseSelect)
                {
                    journal.SelectedItem = null;
                }
                else if (string.IsNullOrEmpty(journal.SelectedItem))
                {
                    journal.SelectedItem = journal.Items.ElementAt(0).Value;
                    journal.Items.ElementAt(0).Selected = true;
                }
            }

            if (journalVersion != null && journalVersion.Show == true && journalVersion.Items == null)
            {
                //get all journal Versions
                var journalVersions = new JournalVersionModel <JournalVersionViewModel>().GetData().OrderByDescending(x => x.IssueDate);
                journalVersion.Items = journalVersions.Select(x => new CustomSelectListItem()
                {
                    Text = x.VersionNumber.ToString(), Value = x.JournalVersionID.ToString(), Group = new SelectListGroup()
                    {
                        Name = x.JournalID.ToString()
                    }, Selected = (journalVersion.SelectedItem == x.JournalVersionID.ToString())
                });
                if (journalVersion.UseSelect)
                {
                    journalVersion.SelectedItem = null;
                }
                else if (string.IsNullOrEmpty(journalVersion.SelectedItem))
                {
                    journalVersion.SelectedItem = journalVersion.Items.ElementAt(0).Value;
                    journalVersion.Items.ElementAt(0).Selected = true;
                }
            }

            ViewBag.Subject        = subject;
            ViewBag.Journal        = journal;
            ViewBag.JournalVersion = journalVersion;
            return(PartialView());
        }