Ejemplo n.º 1
0
        public void DeleteTechnologiesDetails(int id)
        {
            Technologies Technologies = _context.Technologies.Where(u => u.TechnologyID == id).FirstOrDefault();

            _context.Technologies.Remove(Technologies);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public override Application CreateApplication()
        {
            Technologies.Add(new Java());
            Technologies.Add(new Hibernate());

            return(this);
        }
Ejemplo n.º 3
0
        public Technologies Post(Technologies model)
        {
            model.Id = Guid.NewGuid();
            var data2 = _repository.Insert(model);

            return(data2);
        }
Ejemplo n.º 4
0
 private void FinaliseTechnology(Dictionary <string, float> techInvestment, Dictionary <string, List <string> > techOrder)
 {
     foreach (var tech in techInvestment)
     {
         Technologies.AddRange(techOrder[tech.Key].GetRange(0, Math.Max(0, (int)tech.Value)));
     }
 }
        public async Task <ActionResult> Create(Technologies collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here
                    if (collection.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <Technologies>("api/Technology/Post", collection);

                        TempData["sucess"] = TechnologiesResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <Technologies>("api/Technology/Put", collection);

                        TempData["sucess"] = TechnologiesResources.update;
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(collection));
                }
            }
            catch (Exception ex)
            {
                TempData["error"] = CommonResources.error;
                return(RedirectToAction("AccessDenied", "Error"));
            }
        }
        public void technologies_valid_method(string[] technos, bool expected)
        {
            Technologies technologies = new Technologies();

            technologies.technologies = technos;

            Assert.That(technologies.isValid(), Is.EqualTo(expected));
        }
Ejemplo n.º 7
0
        public override Application CreateApplication()
        {
            Technologies.Add(new AspNetMvc());
            Technologies.Add(new CSharp());
            Technologies.Add(new SqlServer());

            return(this);
        }
        public async Task <IActionResult> AddTechnologies([FromBody] Technologies entity)
        {
            await _context.AddAsync(entity);

            await _context.SaveChangesAsync();

            var newCreatedTech = _context.Technologies.FirstOrDefaultAsync(c => c.Id == entity.Id);

            return(Created("GetTechnologies", new { Id = newCreatedTech.Id }));
        }
Ejemplo n.º 9
0
 public void SaveTechnologiesDetails(Technologies objTechnologies)
 {
     try
     {
         _context.Technologies.Add(objTechnologies);
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public ActionResult DeleteTech(int TechId)
        {
            Technologies model = new Technologies();

            using (EmpDbContext Techdb = new EmpDbContext())
            {
                Technologies techlist = Techdb.Technologies.SingleOrDefault(x => x.TechId == TechId);
                techlist.Checkstatus = "N";
                Techdb.SaveChanges();
            }
            return(RedirectToAction("Index", "Technology"));
        }
Ejemplo n.º 11
0
        public PdxSublist GetHistoryCountryFile(Vic2World world)
        {
            var data = new PdxSublist(null);

            data.AddValue("capital", Capital.ToString());
            data.AddValue("primary_culture", PrimaryCulture);
            AcceptedCultures.ForEach(c => data.AddValue("culture", c));
            data.AddValue("religion", Religion);
            data.AddValue("government", Government);
            data.AddValue("plurality", Plurality.ToString());
            if (NationalValues != null)
            {
                data.AddValue("nationalvalue", NationalValues.Value);
            }
            data.AddValue("literacy", Literacy.ToString());
            data.AddValue("civilized", IsCivilised ? "yes" : "no");

            data.AddValue("prestige", Prestige.ToString());
            if (Reforms != null)
            {
                Reforms.AddData(data);
            }
            if (Technologies != null)
            {
                Technologies.ForEach(t => data.AddValue(t, "1"));
            }
            data.AddValue("consciousness", Consciousness.ToString());
            // todo
            data.AddValue("nonstate_consciousness", (Consciousness / 3).ToString());
            if (RulingParty != null)
            {
                data.AddValue("ruling_party", RulingParty.Name);
            }
            data.AddDate("last_election", LastElection);
            if (UpperHouse != null)
            {
                data.AddSublist("upper_house", UpperHouse.GetData(data));
            }
            if (TechSchools != null)
            {
                data.AddValue("schools", Enum.GetName(typeof(TechSchool), TechSchools.TechSchool));
            }

            if (FemaleLeaders && (Reforms.vote_franschise == vote_franschise.universal_voting || Reforms.vote_franschise == vote_franschise.universal_weighted_voting))
            {
                var entry = new PdxSublist();
                entry.AddValue("decision", "enact_female_suffrage");

                data.AddSublist(world.StartDate, entry);
            }
            return(data);
        }
Ejemplo n.º 12
0
 public void UpdateTechnologiesDetails(Technologies objTechnologies)
 {
     try
     {
         Technologies Technologies = _context.Technologies.Where(u => u.TechnologyID == objTechnologies.TechnologyID).FirstOrDefault();
         Technologies.TechnologyName = objTechnologies.TechnologyName;
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 13
0
        public IHttpActionResult DeleteTechnologies(int id)
        {
            Technologies technologies = db.Technologies.Find(id);

            if (technologies == null)
            {
                return(NotFound());
            }

            db.Technologies.Remove(technologies);
            db.SaveChanges();

            return(Ok(technologies));
        }
Ejemplo n.º 14
0
        private Technology GetTechnology(Technologies choice)
        {
            switch (choice)
            {
            case Technologies.Empty:
                return(null);

            case Technologies.PopulationGrowth:
                return(new PopulationGrowthTechnology(1));

            default:
                throw new ArgumentException("Incorrect argument: no such technology");
            }
        }
 public HttpResponseMessage SaveTechnologiesDetails([FromBody] Technologies objTechnologies)
 {
     try
     {
         _technologiesService.SaveTechnologiesDetails(objTechnologies);
         var message = new HttpResponseMessage(HttpStatusCode.Created);
         return(message);
     }
     catch (Exception ex)
     {
         var message = new HttpResponseMessage(HttpStatusCode.BadRequest);
         return(message);
     }
 }
        public ActionResult AddEditTechnology(Technologies technologies)
        {
            if (Session["EmpName"] != null)
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        using (EmpDbContext Techdb = new EmpDbContext())
                        {
                            if (technologies.TechId > 0)
                            {
                                //update
                                Technologies techlist = Techdb.Technologies.SingleOrDefault(x => x.TechId == technologies.TechId);
                                techlist.Technology  = technologies.Technology;
                                techlist.Description = technologies.Description;
                                Techdb.SaveChanges();
                            }
                            else
                            {
                                //Insert
                                //Technologies techins = new Technologies();
                                //techins.Technology = technologies.Technology;
                                //techins.Description = technologies.Description;
                                technologies.Checkstatus = "Y";
                                Techdb.Technologies.Add(technologies);
                                Techdb.SaveChanges();
                            }
                        }
                        ModelState.Clear();
                        return(RedirectToAction("Index", technologies));
                    }



                    catch (Exception ex)
                    {
                        return(View("Error", new HandleErrorInfo(ex, "Technology", "Index")));
                    }
                }

                return(RedirectToAction("AddEditTechnology", technologies.TechId));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
        public ActionResult AddEditTechnology(int TechID)
        {
            Technologies model = new Technologies();

            using (EmpDbContext Techdb = new EmpDbContext())
            {
                if (TechID > 0)
                {
                    Technologies techlist = Techdb.Technologies.SingleOrDefault(x => x.TechId == TechID);
                    model.TechId      = techlist.TechId;
                    model.Technology  = techlist.Technology;
                    model.Description = techlist.Description;
                }
            }
            return(PartialView("_Create", model));
        }
        public TechnologiesViewModel(Technologies model)
        {
            this.CurrentlyResearching = model.CurrentlyResearching.ToString();
            this.EndTime = model.EndTime;
            this.StartTime = model.StartTime;

            if (model.EndTime.HasValue)
            {
                var mins = model.EndTime.Value - DateTime.Now;
                this.MinutesLeftToResearch = mins.TotalMinutes;

                var totalTime = model.EndTime.Value - model.StartTime.Value;
                var totalSegments = totalTime.TotalMinutes / 100;

                var percents = 100 - (this.MinutesLeftToResearch / totalSegments);
                this.PercentsResearched = percents;
            }
        }
Ejemplo n.º 19
0
        public IHttpActionResult PostTechnologies(Technologies technologies)
        {
            db.Technologies.Add(technologies);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TechnologiesExists(technologies.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = technologies.ID }, technologies));
        }
Ejemplo n.º 20
0
        private static void ReadFromFile(string path, Technologies techs)
        {
            var profs = File.ReadAllLines(path);

            foreach (var p in profs)
            {
                var item = new TechnologyItem();
                if (p.EndsWith("g"))
                {
                    item.Technology = p.Substring(0, p.Length - 1);
                    item.isBold     = true;
                    item.isMerged   = true;
                    item.Color      = 10079487;
                }
                else
                {
                    item.Technology = p;
                }

                item.Technology = item.Technology.Trim();

                techs.TechnologyList.Add(item);
            }
        }
Ejemplo n.º 21
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            base.HandleComponentState(curState, nextState);

            if (curState is not TechnologyDatabaseState state)
            {
                return;
            }

            Technologies.Clear();

            var protoManager = IoCManager.Resolve <IPrototypeManager>();

            foreach (var techID in state.Technologies)
            {
                if (!protoManager.TryIndex(techID, out TechnologyPrototype? technology))
                {
                    continue;
                }
                Technologies.Add(technology);
            }

            OnDatabaseUpdated?.Invoke();
        }
Ejemplo n.º 22
0
        public IHttpActionResult PutTechnologies(int id, Technologies technologies)
        {
            if (id != technologies.ID)
            {
                return(BadRequest());
            }

            string        procedure = "";
            int           number;
            string        connectionString = @"Data Source=DESKTOP-RDKB255\SQLEXPRESS;Initial Catalog=articles;Integrated Security=True";
            SqlConnection connection       = new SqlConnection(connectionString);

            try
            {
                string commandStr =
                    $"EXEC TechnologiesRating @id = '{technologies.ID}'," +
                    $" @rating = '{technologies.Rating}'";
                connection.Open();
                SqlCommand command = new SqlCommand(commandStr, connection);
                number = command.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                return(BadRequest(ex.Message));
            }
            finally
            {
                connection.Close();
            }
            if (number != null)
            {
                return(Ok());
            }

            return(null);
        }
Ejemplo n.º 23
0
 public Technologies Put(Technologies model)
 {
     return(_repository.Update(model));
 }
 public TechnologiesViewModel(int researchCentreLevel, Technologies model)
     : this(model)
 {
     this.ResearchCentreLevel = researchCentreLevel;
 }
 public void UpdateTechnologiesDetails([FromBody] Technologies objTechnologies)
 {
     _technologiesService.UpdateTechnologiesDetails(objTechnologies);
 }
 public ActionResult Index(Technologies technologies)
 {
     return(View());
 }
Ejemplo n.º 27
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value != null)
            {
                StringBuilder pathToImage = new StringBuilder();
                pathToImage.Append("Assets/TechIcons/");
                Technologies tech = (Technologies)Enum.Parse(typeof(Technologies), value.ToString());
                switch (tech)
                {
                case Technologies.Unknown:
                    pathToImage.Append("unknown.png");
                    break;

                case Technologies.WebApp:
                    pathToImage.Append("webapp.png");
                    break;

                case Technologies.WebSite:
                    pathToImage.Append("website.png");
                    break;

                case Technologies.ApiApp:
                    pathToImage.Append("api.png");
                    break;

                case Technologies.ConsoleApp:
                    pathToImage.Append("consoleapp.png");
                    break;

                case Technologies.WinFormApp:
                    pathToImage.Append("winform.png");
                    break;

                case Technologies.UwpApp:
                    pathToImage.Append("uwpapp.png");
                    break;

                case Technologies.WpfApp:
                    pathToImage.Append("wpfapp.png");
                    break;

                case Technologies.GeneralGuiApp:
                    pathToImage.Append("generalguiapp.png");
                    break;

                case Technologies.Driver:
                    pathToImage.Append("driverapp.png");
                    break;

                case Technologies.TestUnit:
                    pathToImage.Append("testUnit.png");
                    break;

                case Technologies.IoT:
                    pathToImage.Append("iotapp.png");
                    break;

                default:
                    break;
                }
                return(pathToImage.ToString());
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 28
0
 public Technology(Technologies tech)
 {
     currentTechnology = tech;
 }
Ejemplo n.º 29
0
 public void Dispose()
 {
     foreach (var r in AbilityRules.ToArray())
     {
         r.Dispose();
     }
     foreach (var sos in StellarObjectSizes.ToArray())
     {
         sos.Dispose();
     }
     foreach (var x in StellarAbilityTemplates.ToArray())
     {
         x.Dispose();
     }
     foreach (var sot in StellarObjectTemplates.ToArray())
     {
         sot.Dispose();
     }
     foreach (var t in Traits.ToArray())
     {
         t.Dispose();
     }
     foreach (var t in Technologies.ToArray())
     {
         t.Dispose();
     }
     foreach (var f in FacilityTemplates.ToArray())
     {
         f.Dispose();
     }
     foreach (var h in Hulls.ToArray())
     {
         h.Dispose();
     }
     foreach (var c in ComponentTemplates.ToArray())
     {
         c.Dispose();
     }
     foreach (var m in Mounts.ToArray())
     {
         m.Dispose();
     }
     foreach (var sst in StarSystemTemplates.ToArray())
     {
         sst.Dispose();
     }
     foreach (var gt in GalaxyTemplates.ToArray())
     {
         gt.Dispose();
     }
     foreach (var h in HappinessModels.ToArray())
     {
         h.Dispose();
     }
     foreach (var c in Cultures.ToArray())
     {
         c.Dispose();
     }
     foreach (var ai in EmpireAIs.ToArray())
     {
         ai.Dispose();
     }
     if (this == Current)
     {
         Current = null;
     }
 }
Ejemplo n.º 30
0
 public void addTechnology(string technology)
 {
     Technologies.Add(technology);
 }
Ejemplo n.º 31
0
 public TechnologyChoice(Technologies technology)
 {
     this.technology = this.GetTechnology(technology);
 }
Ejemplo n.º 32
0
 public void removeTechnology(string technology)
 {
     Technologies.Remove(technology);
 }