コード例 #1
0
ファイル: RIVaccinePanel.cs プロジェクト: x-plora/miakro911
        private void btAddVac_Click(object sender, EventArgs e)
        {
            AddRabVacForm dlg = new AddRabVacForm(_rab);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _rab.SetVaccine(dlg.VacID, dlg.VacDate, dlg.VacChildren);
                updateRabVac();
            }
        }
コード例 #2
0
        private DialogResult performJob(ZootehJob job, ref bool needUpdate)
        {
            DialogResult res = DialogResult.OK;

            switch (job.Type)
            {
            case JobType.NestOut:
                RabNetEngBuilding b = Engine.get().getBuilding(job.ID);
                b.setNest(false, (job.ID2 == 0 ? 0 : 1));
                needUpdate = false;
                break;

            case JobType.PreOkrol:
                Engine.get().preOkrol(job.ID);
                //_fullUpdate = false;
                break;

            case JobType.BoysOut:
            case JobType.GirlsOut:
                ReplaceForm rf = new ReplaceForm();
                rf.AddRabbit(job.ID);
                if (job.Type == JobType.BoysOut)
                {
                    rf.SetAction(ReplaceForm.Action.BOYSOUT);
                }
                res = rf.ShowDialog();
                break;

            case JobType.CountKids:
                RabNetEngRabbit rrr = Engine.get().getRabbit(job.ID);
                CountKids       ck  = new CountKids(job.ID);
                int             id2 = 0;
                for (int i = 0; i < rrr.Youngers.Count; i++)
                {
                    if (rrr.Youngers[i].ID == job.ID2)
                    {
                        id2 = i;
                    }
                }
                if (_makeFlag == 0)
                {
                    //rrr.CountKids(0, 0, 0, rrr.Youngers[id2].Group, rrr.Youngers[id2].Age, 0);
                    ck.MakeCount();
                    ck.Dispose();
                    needUpdate = false;
                }
                else
                {
                    //ck = new CountKids(job.ID, job.Flag == 1);
                    //ck.SetGroup(id2);
                    res = ck.ShowDialog();
                }
                break;

            case JobType.F**k:
                int id = job.ID;
                if (_makeFlag == -1)
                {
                    needUpdate = false;
                    Engine.db().SetRabbitVaccine(id, Vaccine.V_ID_LUST);
                    res = DialogResult.OK;
                    break;
                }

                if (job.Flag > 1)
                {
                    id = 0;
                    ReplaceBrideForm rb = new ReplaceBrideForm(job.ID);
                    res = rb.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        id = rb.getGirlOut();
                    }
                    res = DialogResult.Cancel;
                }
                if (id != 0)
                {
                    res = (new FuckForm(id)).ShowDialog();
                }
                break;

            case JobType.Okrol:
                res = (new OkrolForm(job.ID)).ShowDialog();
                break;

            case JobType.Vaccine:    //прививка
                RabNetEngRabbit rab = Engine.get().getRabbit(job.ID);
                AddRabVacForm   dlg = new AddRabVacForm(rab, false, job.ID2);
                res = dlg.ShowDialog();
                if (res == DialogResult.OK)
                {
                    rab.SetVaccine(dlg.VacID, dlg.VacDate, false);
                    if (rab.ParentID != 0 && Engine.opt().getBoolOption(Options.OPT_ID.VACC_MOTHER))
                    {
                        RabNetEngRabbit r2 = Engine.get().getRabbit(rab.ParentID);
                        r2.SetVaccine(dlg.VacID, dlg.VacDate, false);
                    }
                }
                needUpdate = false;
                break;

            case JobType.NestSet:    //установка гнездовья
                RabPlace rp = RabPlace.Parse(job.Rabplace);
                if (rp.CanHaveNest())
                {
                    RabNetEngBuilding rbe = RabNetEngBuilding.FromPlace(job.Rabplace, Engine.get());
                    rbe.setNest(true, rp.Section);
                    res        = DialogResult.OK;
                    needUpdate = false;
                    break;
                }
                ReplaceForm f = new ReplaceForm();
                f.AddRabbit(job.ID);
                f.SetAction(ReplaceForm.Action.SET_NEST);
                res = f.ShowDialog();
                break;

            case JobType.BoysByOne:
                f = new ReplaceForm();
                f.AddRabbit(job.ID);
                res = f.ShowDialog();
                break;

            case JobType.SpermTake:
                RabNetEngRabbit r = Engine.get().getRabbit(job.ID);
                r.SpermTake();
                needUpdate = false;
                break;
            }

            return(res);
        }