public EntityWorkforce Insert(EntityWorkforce data)
        {
            try
            {
                Workforce dataNew = new Workforce()
                {
                    PK_WorkforceID = data.PK_WorkforceID,
                    WorkforceID    = data.WorkforceID,
                    Description    = data.Description,
                    Status         = data.Status,
                    CreateDate     = data.CreateDate,
                    ModifyDate     = data.ModifyDate
                };
                base.DataContext.Workforce.Add(dataNew);
                base.DataContext.SaveChanges();

                data.PK_WorkforceID = dataNew.PK_WorkforceID;

                return(data);
            }
            catch (DbException dbex)
            {
                throw dbex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
 public Research(int rp, int mc, int cry, int bc, int cam, Workforce w, Production p)
 {
     researchPoints = rp;
     baseCosts      = new int[] { mc, cry, bc, cam };
     workforce      = w;
     production     = p;
 }
Beispiel #3
0
 public void SetObjects(WorldPopulation wp, Finances f, Workforce w, Production p, Research r)
 {
     worldPopulation = wp;
     finances        = f;
     workforce       = w;
     production      = p;
     research        = r;
 }
Beispiel #4
0
    void Start()
    {
        display = GetComponent <Display> ();

        worldPopulation = new WorldPopulation(1000000, 0.03f, 0.002f, 1500000, 500000);
        finances        = new Finances(1000, 0.3f, 0.03f, worldPopulation);
        workforce       = new Workforce(50, 10, 0, 0, finances, worldPopulation);
        production      = new Production(10, workforce, finances, this);
        research        = new Research(0, 40, 60, 60, 80, workforce, production);

        display.SetObjects(worldPopulation, finances, workforce, production, research);
    }
Beispiel #5
0
    public Production(int pr, Workforce w, Finances f, TurnManager tm)
    {
        productionRate     = pr;
        baseProductionRate = pr;
        workforce          = w;
        finances           = f;
        turnManager        = tm;

        rocketTypes     = new Rocket[4];
        rocketTypes [0] = new Rocket(2000, 250, 100, 50, 0, true);
        rocketTypes [1] = new Rocket(3000, 400, 200, 100, 50, false);
        rocketTypes [2] = new Rocket(5000, 800, 300, 200, 100, false);
        rocketTypes [3] = new Rocket(10000, 1500, 500, 500, 200, false);

        currentProduction = new CurrentProduction(0, -1);
    }
Beispiel #6
0
        public Workforce[] Get()
        {
            var collection = JsonConvert.DeserializeObject <List <Workforce> >(File.ReadAllText("C:/xampp/htdocs/dashboard/src/Controllers/workforce.json"));
            List <Workforce> aux_collection = new List <Workforce>();

            for (int i = 0; i < collection.Count; i++)
            {
                if (collection[i].Name.Contains(Search.GetInstance().query) || collection[i].Shift.Contains(Search.GetInstance().query))
                {
                    aux_collection.Add(collection[i]);
                }
            }

            Workforce[] workforceArray = new Workforce[aux_collection.Count];
            for (int i = 0; i < aux_collection.Count; i++)
            {
                workforceArray[i] = aux_collection[i];
            }

            return(workforceArray);
        }
        public Workforce[] Get()
        {
            var collection = JsonConvert.DeserializeObject <List <Workforce> >(File.ReadAllText("C:/Users/Arthur/source/repos/src/Challenge/data/workforce.json")); //Deserializando json em objetos do tipo correto
            List <Workforce> aux_collection = new List <Workforce>();                                                                                               //Lista auxiliar para armazenar a quantia certa do array para retornar.

            for (int i = 0; i < collection.Count; i++)
            {
                if (collection[i].Name.Contains(Search.GetInstance().query) || collection[i].Shift.Contains(Search.GetInstance().query)) //Condições de busca
                {
                    aux_collection.Add(collection[i]);
                }
            }

            Workforce[] workforceArray = new Workforce[aux_collection.Count]; //Criando array de valores para retornar
            for (int i = 0; i < aux_collection.Count; i++)
            {
                workforceArray[i] = aux_collection[i]; //Atribuindo todos os valores da lista auxiliar ao array de retorno.
            }

            return(workforceArray); //Retornando json
        }