Пример #1
0
        private void replaceMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }

            Building    b  = null;
            ReplaceForm rf = new ReplaceForm();

            foreach (ListViewItem li in listView1.SelectedItems)
            {
                Building b2 = li.Tag as Building;
                if (b2 != b)
                {
                    b = b2;
                    for (int i = 0; i < b.Sections; i++)
                    {
                        if (b.Busy[i].ID > 0)
                        {
                            rf.AddRabbit(b.Busy[i].ID);
                        }
                    }
                }
            }
            if (rf.ShowDialog() == DialogResult.OK)
            {
                _rsb.Run();
            }
        }
Пример #2
0
        private void miReplace_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }

#if !NOCATCH
            try {
#endif
            ReplaceForm rpf = new ReplaceForm();
            foreach (ListViewItem li in listView1.SelectedItems)
            {
                rpf.AddRabbit((li.Tag as AdultRabbit).ID);
            }
            if (rpf.ShowDialog() == DialogResult.OK && !MainForm.MustClose)
            {
                _rsb.Run();
            }
#if !NOCATCH
        }

        catch (Exception exc) {
            MessageBox.Show(exc.Message);
            _logger.Warn(exc);
            _rsb.Run();
        }
#endif
        }
Пример #3
0
        private void miPlaceGhange_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 2)
            {
                return;
            }

            try {
                ReplaceForm rpf = new ReplaceForm();
                rpf.AddRabbit((listView1.SelectedItems[0].Tag as AdultRabbit).ID);
                rpf.AddRabbit((listView1.SelectedItems[1].Tag as AdultRabbit).ID);
                rpf.SetAction(ReplaceForm.Action.CHANGE);
                if (rpf.ShowDialog() == DialogResult.OK && !MainForm.MustClose)
                {
                    _rsb.Run();
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                _logger.Warn(exc);
                _rsb.Run();
            }
        }
Пример #4
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);
        }