public JsonResult UpdateScientist(Scientists _scientists)
        {
            var response = new UpdateScientistResponse()
            {
                Result = false
            };

            #region Update
            using (var session = DatabaseModule.OpenSession())
            {
                using (var tran = session.BeginTransaction())
                {
                    if (!string.IsNullOrEmpty(_scientists.FirstName.ToString().Trim()) && !string.IsNullOrEmpty(_scientists.LastName.ToString().Trim()))
                    {
                        session.Update(_scientists); //Update
                        tran.Commit();
                        response.Result        = true;
                        response.ResultMessage = "Updated succesfully"; // TODO : Make dynamic and localized
                    }
                }
            }
            return(Json(response));

            #endregion
        }
Пример #2
0
        public OrganizationModel(Organization organization, bool downloadEntityDates = true)
        {
            Organization = organization;
            if (downloadEntityDates)
            {
                List <Scientist> scientists = OrganizationService.GetScientists(Organization);
                foreach (Scientist s in scientists)
                {
                    Scientists.Add(new ScientistModel(s));
                }

                Scientists.CollectionChanged += (o, e) =>
                {
                    if (e.Action.ToString().Equals("Add"))
                    {
                        ScientistModel sm = null;
                        foreach (ScientistModel scm in e.NewItems)
                        {
                            sm = scm;
                        }
                        OrganizationService.AddScientist(Organization, sm.Scientist);
                    }
                    else if (e.Action.ToString().Equals("Remove"))
                    {
                        ScientistModel sm = null;
                        foreach (ScientistModel scm in e.OldItems)
                        {
                            sm = scm;
                        }
                        OrganizationService.RemoveScientist(Organization, sm.Scientist);
                    }
                    OnPropertyChanged("Scientists");
                };
            }
        }
Пример #3
0
        public OrganizationAddsScientistViewModel(Window window, OrganizationModel organization)
        {
            List <Scientist> scientists = ScientistService.GetScientists();

            foreach (Scientist s in scientists)
            {
                Scientists.Add(new ScientistModel(s));
            }
            this.Window = window;
            this.SelectedOrganization = organization;
        }
Пример #4
0
        public ConferenceAddsScientistViewModel(Window window, ConferenceModel conference)
        {
            List <Scientist> scientists = ScientistService.GetScientists();

            foreach (Scientist s in scientists)
            {
                Scientists.Add(new ScientistModel(s));
            }
            this.Window             = window;
            this.SelectedConference = conference;
        }
Пример #5
0
        public CountryAddsScientistViewModel(Window window, CountryModel selectedCountry)
        {
            List <Scientist> scientists = ScientistService.GetScientists();

            foreach (Scientist s in scientists)
            {
                Scientists.Add(new ScientistModel(s));
            }
            this.Window          = window;
            this.SelectedCountry = selectedCountry;
        }
Пример #6
0
        public RoundEndEvent(RoundSummary.SumInfo_ClassList list_start, RoundSummary.SumInfo_ClassList list_finish, RoundSummary.LeadingTeam leadingTeam, int e_ds, int e_sc, int scp_kills, int round_cd, string Roundtime)
        {
            SCP = new SCPs {
                SCP_Kills = scp_kills, Starting_SCPs = list_start.scps_except_zombies, Ending_SCPs = list_finish.scps_except_zombies, Terminated_SCPs = list_start.scps_except_zombies - list_finish.scps_except_zombies
            };
            Class_D = new ClassD {
                Starting_ClassD = list_start.class_ds, Escaped_ClassD = e_ds
            };
            Scientist = new Scientists {
                Starting_Scientists = list_start.scientists, Escaped_Scientists = e_sc
            };

            TimeSpan tspan = TimeSpan.FromSeconds(list_finish.time - list_start.time);

            Roundtime   = string.Format("{0} minutes and {1} seconds", (int)tspan.TotalMinutes, tspan.Seconds);
            LeadingTeam = leadingTeam;
        }
        public ActionResult Save(Scientists dataModel)
        {
            #region Insert
            using (var session = DatabaseModule.OpenSession())
            {
                using (var tran = session.BeginTransaction())
                {
                    Scientists scientistEntities = new Scientists {
                        FirstName = dataModel.FirstName, LastName = dataModel.LastName, Title = dataModel.Title
                    };
                    session.Save(scientistEntities);
                    tran.Commit();

                    return(View());
                }
            }
            #endregion
        }
Пример #8
0
        private async Task LoadAllScientistsAsync()
        {
            var scientists = await _staticDataDataAccess.GetAllScientistsAsync();

            Scientists.AddRange(_mapper.Map <List <ScientistModel> >(scientists));
        }
Пример #9
0
        public ConferenceModel(Conference conference, bool downloadEntityDates = true)
        {
            Conference = conference;

            if (downloadEntityDates)
            {
                List <Scientist> scientists = ConferenceService.GetScientists(Conference);
                foreach (Scientist s in scientists)
                {
                    Scientists.Add(new ScientistModel(s));
                }

                Scientists.CollectionChanged += (o, e) =>
                {
                    if (e.Action.ToString().Equals("Add"))
                    {
                        ScientistModel sm = null;
                        foreach (ScientistModel scm in e.NewItems)
                        {
                            sm = scm;
                        }
                        ConferenceService.AddScientist(Conference, sm.Scientist);
                    }
                    else if (e.Action.ToString().Equals("Remove"))
                    {
                        ScientistModel sm = null;
                        foreach (ScientistModel scm in e.OldItems)
                        {
                            sm = scm;
                        }
                        ConferenceService.RemoveScientist(Conference, sm.Scientist);
                    }
                };

                List <Report> reports = ConferenceService.GetReportsOnConference(Conference);
                foreach (Report r in reports)
                {
                    Reports.Add(new ReportModel(r));
                }

                Reports.CollectionChanged += (o, e) =>
                {
                    if (e.Action.ToString().Equals("Add"))
                    {
                        ReportModel rm = null;
                        foreach (ReportModel rtm in e.NewItems)
                        {
                            rm = rtm;
                        }
                        ConferenceService.AddReport(Conference, rm.Report);
                    }
                    else if (e.Action.ToString().Equals("Remove"))
                    {
                        ReportModel rm = null;
                        foreach (ReportModel rtm in e.OldItems)
                        {
                            rm = rtm;
                        }
                        ConferenceService.RemoveReport(Conference, rm.Report);
                    }
                };
            }
        }