コード例 #1
0
        public void MonthController()
        {
            MonthCounter++;

            if (MonthCounter == 1)
            {
                IncomeOfPreviousMonth = income;
            }
            else
            {
                instance.DifferenceBetweenIncomes = instance.income - instance.IncomeOfPreviousMonth;

                instance.SellingBoostUp = Math.Abs(instance.DifferenceBetweenIncomes / instance.IncomeOfPreviousMonth);

                instance.Reward = false;

                if (instance.SellingBoostUp >= 0.3 && instance.DifferenceBetweenIncomes > 0)
                {
                    instance.deboostIncome(Filial.getInstance().Filials.Count *Filial.getInstance().RewardPerFelial);
                    instance.Reward = true;
                }



                instance.IncomeOfPreviousMonth = instance.income;
            }

            instance.income = 0;
        }
コード例 #2
0
 public static Filial getInstance()
 {
     if (instance == null)
     {
         instance = new Filial();
     }
     return(instance);
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        public Form1()
        {
            InitializeComponent();
            timer1.Enabled  = true;
            timer1.Interval = 1000;
            Pocket          = 750000;
            PocketLbl.Text  = Pocket.ToString() + '$';

            rnd = new Random();
            Filial.getInstance().ChoseCount       += CarNumbChoose;
            SoldCars.getInstance().ObserveProgram += RealizeObserveProgram;
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        private void ApproveBtn_Click(object sender, EventArgs e)
        {
            Filial.getInstance().CarsInGarage += trackBar1.Value;

            CarsLbl.Text = Filial.getInstance().CarsInGarage.ToString();

            Pocket -= trackBar1.Value * Filial.getInstance().CarPrice;

            DataCollecter.getInstance().deboostIncome(trackBar1.Value * Filial.getInstance().CarPrice);

            PocketLbl.Text = Pocket.ToString() + " $";

            choserStateChanger(false);

            trackBar1.Value = 0;
        }
コード例 #5
0
ファイル: B_logic.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        public static float DayActivity()
        {
            Random rnd = new Random();

            var filialsCount = Filial.getInstance().Filials.Count();

            int CarsBought = (rnd.Next() % 3) * filialsCount;

            float SoldGoodsIncome = (250 + rnd.Next() % 250) * filialsCount;

            float TechObservIncomes = ((2 - rnd.Next() % 2) * SoldCars.getInstance().TechObsserveCost) * filialsCount;

            float MoneyToChange = 0;

            int limit = CarsBought;


            if (CarsBought > Filial.getInstance().CarsInGarage)
            {
                limit = Filial.getInstance().CarsInGarage;
            }
            for (int i = 0; i < limit; i++)
            {
                SoldCars.getInstance().AddCarToObserveProgramm();
            }

            foreach (var filial in Filial.getInstance().Filials)
            {
                filial.DaysBeforeSalary--;
                if (filial.DaysBeforeSalary == 0)
                {
                    MoneyToChange          -= filial.SalaryFund;
                    filial.DaysBeforeSalary = 30;
                }
            }

            MoneyToChange += limit * (Filial.getInstance().CarPrice + 5000) + SoldGoodsIncome + TechObservIncomes;

            DataCollecter.getInstance().boostIncome(MoneyToChange);

            Filial.getInstance().CarsInGarage -= limit;

            SoldCars.getInstance().CheckForObserveDate();

            return(MoneyToChange);
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        //filials buy/sell buttons
        private void BuyFillialBtn_Click(object sender, EventArgs e)
        {
            if (Pocket > Filial.getInstance().FilialPrice)
            {
                Filial.getInstance().addFilial();

                FilialsLbl.Text = (Int32.Parse(FilialsLbl.Text) + 1).ToString();

                Pocket -= Filial.getInstance().FilialPrice;

                DataCollecter.getInstance().deboostIncome(Filial.getInstance().FilialPrice);

                PocketLbl.Text = Pocket.ToString() + " $";

                NotEnoughMoneyLbl.Visible = false;
            }
            else
            {
                NotEnoughMoneyLbl.Visible = true;
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        private void timer1_Tick(object sender, EventArgs e)
        {
            Date.Text = (Int32.Parse(Date.Text) + 1).ToString();


            if (Filial.getInstance().Filials.Count > 0)
            {
                Pocket += B_logic.DayActivity();

                PocketLbl.Text = Pocket.ToString() + " $";
            }


            StuffLbl.Text = (Filial.getInstance().StuffPerFilial *Filial.getInstance().Filials.Count).ToString();

            FilialsLbl.Text = Filial.getInstance().Filials.Count.ToString();

            CarsLbl.Text = Filial.getInstance().CarsInGarage.ToString();

            if (Int32.Parse(Date.Text) == 30)
            {
                Date.Text = "0";

                Month.Text = (Int32.Parse(Month.Text) + 1).ToString();

                Pocket += B_logic.MonthActivity();

                PocketLbl.Text = Pocket.ToString() + " $";
            }

            if (Int32.Parse(Month.Text) == 13)
            {
                Month.Text = "0";
                Year.Text  = (Int32.Parse(Year.Text) + 1).ToString();
            }
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
        private void CarNumbChoose()
        {
            trackBar1.Maximum = Filial.getInstance().MaxCarToBuy;

            choserStateChanger(true);
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: suNrisEinMyeYes/lab8_imit
 private void OrderBtn_Click(object sender, EventArgs e)
 {
     Filial.getInstance().OrderCars(Pocket);
 }
コード例 #10
0
ファイル: B_logic.cs プロジェクト: suNrisEinMyeYes/lab8_imit
 public static float MonthActivity()
 {
     DataCollecter.getInstance().deboostIncome(Filial.getInstance().CarsInGarage * 200);
     DataCollecter.getInstance().MonthController();
     return(-Filial.getInstance().CarsInGarage * 200);
 }