private void cancelFuckEnd_Click(object sender, EventArgs e) { if (lvFucks.SelectedItems.Count != 1) { return; } try { F**k f = (lvFucks.SelectedItems[0].Tag as F**k); if (!isLastEvent(f)) { throw new Exception("Отменить прохолостание можно лишь последней записи"); } if (MessageBox.Show(String.Format("Данная функция отменит {0:s} текущей крольчихи и восстановит сукрольность.{1:s}Продолжить?", F**k.GetFuckEndTypeStr(f.FEndType, false), Environment.NewLine), "Отмена прохолоста", MessageBoxButtons.YesNo) == DialogResult.No) { return; } _rab.CancelFuckEnd(f); cancelUnable(); this.updateData(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public void CancelFuckEnd(F**k f) { if (f.FEndType == FuckEndType.Sukrol) { return; } if (DateTime.Now.Subtract(f.EndDate).TotalDays > 2) { throw new RabNetException("Отменять можно только в течение 2 дней"); } if (f.FEndType == FuckEndType.Okrol) { foreach (Rabbit y in _eng.db().GetDescendants(_id)) { if (y.BirthDay == f.EndDate) { ///todo по идее, надо удалять из базы совсем. _eng.db().KillRabbit(y.ID, 0, DeadReason_Static.CombineGroups, "Отмена окрола"); } } _eng.logs().log(LogType.OKROL, ID, 0, AddressSmall, "", "-=![[Отмена окрола]!=-"); } else { _eng.logs().log(LogType.PROHOLOST, ID, 0, AddressSmall, "", "-=![Отмена прохолоста]!=-"); } Engine.db().CancelFuckEnd(f.Id); }
public static int GetEventType(String eventType) { //int evtype = 0; //if (eventType == FuckType.Sluchka_ENG) evtype = 1; //if (eventType == FuckType.Vyazka_ENG) evtype = 2; //if (eventType == FuckType.Kuk_ENG) evtype = 3; //return evtype; return((int)F**k.ParceFuckType(eventType)); }
public static String GetEventName(int evtype) { //String ev = "none"; //if (evtype == 1) ev = FuckType.Sluchka_ENG; //if (evtype == 2) ev = FuckType.Vyazka_ENG; //if (evtype == 3) ev = FuckType.Kuk_ENG; //return ev; return(F**k.GetFuckTypeStr((FuckType)evtype, true)); }
private bool isLastEvent(F**k f) { foreach (ListViewItem lvi in lvFucks.Items) { if ((lvi.Tag as F**k).Id > f.Id) { return(false); } } return(true); }
private void btGens_Click(object sender, EventArgs e) { F**k f = lvFucks.SelectedItems[0].Tag as F**k; //String nm = lbName.Text.Split(':')[1]; //if (lbSecname.Text != "") // nm += " " + lbSecname.Text.Split(':')[1]; //if (lbSurname.Text != "") // nm += "-" + lbSurname.Text.Split(':')[1]; //(new GenomView(_rab.Breed, f.breed, _rab.Genom, f.rgenom, nm, f.partner)).ShowDialog(); (new GenomViewForm(_rab.ID, f.PartnerId)).ShowDialog(); }
private void btFuckHer_Click(object sender, EventArgs e) { F**k f = lvFucks.SelectedItems[0].Tag as F**k; FuckForm dlg = new FuckForm(_rab.ID, f.PartnerId); if (dlg.ShowDialog() == DialogResult.OK) { cancelUnable(); } cancelUnable(); updateData(); }
private void fucks_SelectedIndexChanged(object sender, EventArgs e) { btChangeWorker.Enabled = changeFucker.Enabled = btGens.Enabled = btFuckHer.Enabled = false; if (lvFucks.SelectedItems.Count != 1) { return; } bool dead = (lvFucks.SelectedItems[0].SubItems[3].Text == RABDEAD); btGens.Enabled = true; btFuckHer.Enabled = (_rab.EventDate != DateTime.MinValue) && !dead; changeFucker.Enabled = lvFucks.SelectedItems[0].SubItems[3].Text == F**k.GetFuckEndTypeStr(FuckEndType.Sukrol, false);//todo не правильно btCancelFuckEnd.Enabled = lvFucks.SelectedItems[0].SubItems[3].Text != F**k.GetFuckEndTypeStr(FuckEndType.Sukrol, false) && (lvFucks.SelectedItems[0].Index == lvFucks.Items.Count - 1); btChangeWorker.Enabled = true; }
private void changeWorker_Click(object sender, EventArgs e) { if (lvFucks.SelectedItems.Count != 1) { return; } F**k f = lvFucks.SelectedItems[0].Tag as F**k; SelectUserForm sf = new SelectUserForm(f.Worker); if (sf.ShowDialog() == DialogResult.OK && sf.SelectedUser != 0 && sf.SelectedUserName != f.Worker) { Engine.db().changeWorker(f.Id, sf.SelectedUser); } cancelUnable(); updateData(); }
private void changeFucker_Click(object sender, EventArgs e) { if (lvFucks.SelectedItems.Count != 1) { return; } F**k f = lvFucks.SelectedItems[0].Tag as F**k; FuckForm mf = new FuckForm(_rab, f.PartnerId, false); if (mf.ShowDialog() == DialogResult.OK && mf.SelectedFucker != f.Id) { Engine.get().ChangeFucker(f, mf.SelectedFucker, mf.FuckDate); } cancelUnable(); updateData(); }
public void ChangeFucker(F**k f, int newFucker, DateTime newFuckDate) { this._data.changeFucker(f.Id, newFucker, newFuckDate); // меняем крольчихе дату случки RabNetEngRabbit rabFemale = this.getRabbit(f.FemaleId); rabFemale.EventDate = newFuckDate; rabFemale.Commit(); if (newFucker != f.PartnerId) { RabNetEngRabbit eFucker = this.getRabbit(f.PartnerId); F***s f***s = this.db().GetFucks(new Filters(Filters.FIND_PARTNERS, f.PartnerId)); eFucker.LastFuckOkrol = f***s.LastFuck.EventDate; eFucker.Commit(); } }
public void UpdateData() { if (_rab == null) { return; } ///Заполнение списка случек lvFucks.Items.Clear(); if (_rab.ID > 0) { foreach (F**k f in Engine.db().GetFucks(new Filters(Filters.RAB_ID + "=" + _rab.ID))) { ListViewItem li = lvFucks.Items.Add(f.EventDate == DateTime.MinValue ? "-" : f.EventDate.ToShortDateString()); li.SubItems.Add(F**k.GetFuckTypeStr(f.FType, false)); li.SubItems.Add(string.IsNullOrEmpty(f.PartnerName) ? "-" : f.PartnerName); li.SubItems.Add(F**k.GetFuckEndTypeStr(f.FEndType, false)); if (f.IsPartnerDead) { li.UseItemStyleForSubItems = false; li.SubItems[IND_PARTNER].ForeColor = Color.Brown; } li.SubItems.Add(f.EndDate == DateTime.MinValue ? "-" : f.EndDate.ToShortDateString()); li.SubItems.Add(f.Children.ToString()); li.SubItems.Add(f.Dead.ToString()); li.SubItems.Add(f.Killed.ToString()); li.SubItems.Add(f.Added.ToString()); li.SubItems.Add(f.Breed == _rab.BreedID ? "-" : "Да"); li.SubItems.Add(RabNetEngHelper.inbreeding(f.rGenom, _rab.Genoms) ? "Да" : "-"); li.SubItems.Add(f.Worker); li.Tag = f; } } changeFucker.Enabled = false; }
private OneRabbit fillOneRabbit(XmlNode oneRab, int exportFrom) { return(new OneRabbit( int.Parse(ReportHelper.GetChildNodeVal(oneRab, "id")), ReportHelper.GetChildNodeVal(oneRab, "sex"), DateTime.Parse(ReportHelper.GetChildNodeVal(oneRab, "birthday")), 0, Rabbit.NULL_FLAGS, int.Parse(ReportHelper.GetChildNodeVal(oneRab, "name")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "surname")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "secname")), Rabbit.NULL_ADDRESS, int.Parse(ReportHelper.GetChildNodeVal(oneRab, "group")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "breed")), 0, "", "", int.Parse(ReportHelper.GetChildNodeVal(oneRab, "status")), DateTime.MinValue, F**k.GetFuckTypeStr(FuckType.None), DateTime.MinValue, 0, 0, ReportHelper.GetChildNodeVal(oneRab, "fullname"), ReportHelper.GetChildNodeVal(oneRab, "breedname"), ReportHelper.GetChildNodeVal(oneRab, "bon"), 0, int.Parse(ReportHelper.GetChildNodeVal(oneRab, "okrol")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "weight")), DateTime.Parse(ReportHelper.GetChildNodeVal(oneRab, "weightDate")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "mother")), int.Parse(ReportHelper.GetChildNodeVal(oneRab, "father")), exportFrom)); }