示例#1
0
        public void SetID(int id)
        {
            _rabbitID = id;
            _rabbit   = Engine.db().getRabbitGen(id);

            this.Text = string.Format("Родословная '{0}' ({1:D})", _rabbit.Fullname, _rabbit.ID);
        }
示例#2
0
        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);
        }
示例#3
0
        public override void MakeReport()
        {
            PeriodForm dlg = new PeriodForm(MenuText);

            dlg.PeriodConstrain = 4;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                int         year = int.Parse(dlg.PeriodValue);
                XmlDocument doc  = new XmlDocument();
                DateTime    dt   = new DateTime(year, 1, 1);
                while (dt.Year == year && dt.Date <= DateTime.Now.Date)
                {
                    if ((dlg.MinDate.Year == dt.Year && dlg.MinDate.Month > dt.Month))
                    {
                        dt = dt.AddMonths(1);
                        continue;
                    }
                    Filters f = new Filters("date", dt.ToString("yyyy-MM-dd"));
                    if (doc.ChildNodes.Count == 0)
                    {
                        doc = Engine.db().makeReport(getSQL(f));
                    }
                    else
                    {
                        doc.FirstChild.AppendChild(doc.ImportNode(Engine.db().makeReport(getSQL(f)).SelectSingleNode("Rows/Row"), true));
                    }
                    dt = dt.AddMonths(1);
                }
                ReportViewForm rvf = new ReportViewForm(MenuText, FileName, new XmlDocument[] { doc }, XCL_HEADERS);

                rvf.Show();
            }
        }
示例#4
0
        internal static XmlDocument[] GetRabbitPlem(int rId)
        {
            XmlDocument[]   docs = new XmlDocument[7];
            RabNetEngRabbit r    = Engine.get().getRabbit(rId);

            docs[0] = ReportHelperExt.rabToXml(r, null);
            OneRabbit[] p1 = Engine.db().getParents(r.ID, r.Age);
            docs[1] = ReportHelperExt.rabToXml(null, p1[0]);
            docs[2] = ReportHelperExt.rabToXml(null, p1[1]);
            OneRabbit[] p2;
            if (p1[0] != null)
            {
                p2 = Engine.db().getParents(p1[0].ID, p1[0].Age);
            }
            else
            {
                p2 = new OneRabbit[] { null, null };
            }

            docs[3] = ReportHelperExt.rabToXml(null, p2[0]);
            docs[4] = ReportHelperExt.rabToXml(null, p2[1]);
            if (p1[1] != null)
            {
                p2 = Engine.db().getParents(p1[1].ID, p1[1].Age);
            }
            else
            {
                p2 = new OneRabbit[] { null, null };
            }

            docs[5] = ReportHelperExt.rabToXml(null, p2[0]);
            docs[6] = ReportHelperExt.rabToXml(null, p2[1]);

            return(docs);
        }
示例#5
0
        public override void MakeReport()
        {
            XmlDocument doc = Engine.db().makeReport(getSQL(null));

            ReportViewForm rvf = new ReportViewForm(MenuText, FileName, new XmlDocument[] { doc });

            rvf.ExcelEnabled = false;
            rvf.ShowDialog();
        }
示例#6
0
 public void SpermTake()
 {
     if (this.Sex != SexType.MALE)
     {
         throw new ExNotMale(this);
     }
     Engine.db().SpermTake(this.ID);
     ///todo логи на забор спермы
 }
示例#7
0
        public BuildTreeForm()
        {
            InitializeComponent();
            BldTreeData buildTree = Engine.db().buildingsTree();
            TreeNode    n         = makenode(null, "Ферма", buildTree);

            n.Tag = new BldTreeData(0, 0, "Ферма");
            n.Expand();
            treeView1.Sort();
        }
示例#8
0
        public override void MakeReport()
        {
            BuildTreeForm dlg = new BuildTreeForm();

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Filters     f   = new Filters("build", dlg.Build.ToString());
            XmlDocument doc = Engine.db().makeReport(getSQL(f));
            Dictionary <String, int> dict = new Dictionary <string, int>();
            int total = 0;

            foreach (XmlNode nd in doc.FirstChild.ChildNodes)
            {
                nd.SelectSingleNode("address").InnerText = Building.FullPlaceName(nd.SelectSingleNode("address").InnerText);
                if (!dict.ContainsKey(nd.SelectSingleNode("dt").InnerText))
                {
                    dict.Add(nd.SelectSingleNode("dt").InnerText, 0);
                }
                dict[nd.SelectSingleNode("dt").InnerText]++;
                total++;
            }
            XmlElement newND, tmp;

            foreach (KeyValuePair <string, int> kvp in dict)
            {
                newND = doc.CreateElement("Row");

                tmp           = doc.CreateElement("name");
                tmp.InnerText = "итого";
                newND.AppendChild(tmp);

                tmp           = doc.CreateElement("dt");
                tmp.InnerText = kvp.Key;
                newND.AppendChild(tmp);

                tmp           = doc.CreateElement("address");
                tmp.InnerText = total.ToString();
                newND.AppendChild(tmp);

                tmp           = doc.CreateElement("plus");
                tmp.InnerText = kvp.Value.ToString();
                newND.AppendChild(tmp);

                doc.FirstChild.AppendChild(newND);
            }
            ReportViewForm rvf = new ReportViewForm(MenuText, FileName, new XmlDocument[] { doc });

            rvf.ExcelEnabled = false;
            rvf.ShowDialog();
        }
示例#9
0
        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();
        }
示例#10
0
        private void miCancelRabVac_Click(object sender, EventArgs e)
        {
            if (lvVaccine.SelectedItems.Count == 0)
            {
                return;
            }
            RabVac rv = lvVaccine.SelectedItems[0].Tag as RabVac;

            if (rv.vid < 0)
            {
                return;
            }

            rv.unabled = (int)miCancelRabVac.Tag == 1;
            Engine.db().RabVacUnable(_rab.ID, rv.vid, rv.unabled);

            updateRabVac();
        }
示例#11
0
        public override void MakeReport()
        {
#if RELEASE || DEBUG
            PeriodForm dlg = new PeriodForm(this.MenuText);
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            Filters f = new Filters(Filters.MAKE_CANDIDATE, Engine.get().candidateAge(),
                                    Filters.MAKE_BRIDE, Engine.get().brideAge(),
                                    Filters.DATE_PERIOD, dlg.PeriodChar,
                                    Filters.DATE_VALUE, dlg.PeriodValue);
            string      s   = getSQL(f);
            XmlDocument doc = Engine.db().makeReport(s);

            ReportViewForm rvf = new ReportViewForm(MenuText, FileName, new XmlDocument[] { doc, dlg.GetXml() });
            rvf.ExcelEnabled = false;
            rvf.Show();
#endif
        }
示例#12
0
        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;
        }
示例#13
0
        /// <summary>
        /// Нужно для отчета Племенное свидетельство
        /// </summary>
        /// <param name="er"></param>
        /// <param name="or"></param>
        /// <param name="hasdoc"></param>
        /// <returns></returns>
        internal static XmlDocument rabToXml(OneRabbit er, OneRabbit or, XmlDocument hasdoc)
        {
            XmlDocument doc = null;

            if (hasdoc == null)
            {
                doc = new XmlDocument();
                doc.AppendChild(doc.CreateElement("Rows"));
            }
            else
            {
                doc = hasdoc;
            }

            XmlElement rw = doc.CreateElement("Row");

            doc.DocumentElement.AppendChild(rw);
            if (er != null)
            {
                or = Engine.db().getLiveDeadRabbit(er.ID);
                if (hasdoc == null)
                {
                    ReportHelper.Append(rw, doc, "header", Engine.opt().getOption(Options.OPT_ID.SVID_HEAD));
                    ReportHelper.Append(rw, doc, "num", Engine.opt().getOption(Options.OPT_ID.NEXT_SVID));
                    ReportHelper.Append(rw, doc, "date", DateTime.Now.Date.ToShortDateString());
                    ReportHelper.Append(rw, doc, "director", Engine.opt().getOption(Options.OPT_ID.SVID_GEN_DIR));
                    //rw.AppendChild(doc.CreateElement("header")).AppendChild(doc.CreateTextNode(Engine.opt().getOption(Options.OPT_ID.SVID_HEAD)));
                    //rw.AppendChild(doc.CreateElement("num")).AppendChild(doc.CreateTextNode(Engine.opt().getOption(Options.OPT_ID.NEXT_SVID)));
                    //rw.AppendChild(doc.CreateElement("date")).AppendChild(doc.CreateTextNode(DateTime.Now.Date.ToShortDateString()));
                    //rw.AppendChild(doc.CreateElement("director")).AppendChild(doc.CreateTextNode(Engine.opt().getOption(Options.OPT_ID.SVID_GEN_DIR)));
                }
                else
                {
                    rw.AppendChild(doc.CreateElement("group")).AppendChild(doc.CreateTextNode(er.Group.ToString()));
                }

                ReportHelper.Append(rw, doc, "sex", er.Sex == Rabbit.SexType.MALE ? "male" : (er.Sex == Rabbit.SexType.FEMALE ? "female" : "void"));
                ReportHelper.Append(rw, doc, "class", Rabbit.GetFBon(er.Bon));
                ReportHelper.Append(rw, doc, "name", er.NameFull);
                ReportHelper.Append(rw, doc, "breed", er.BreedName);
                if (er.BirthPlace != 0)
                {
                    //todo по хорошему надо писать born_place кролику при рождении на данной ферме
                    ClientsList list = Engine.db().GetClients();
                    foreach (Client c in list)
                    {
                        if (c.ID == er.BirthPlace)
                        {
                            ReportHelper.Append(rw, doc, "born_place", c.Name);
                            break;
                        }
                    }
                }
                else
                {
                    Catalog zones = Engine.db().catalogs().getZones();
                    ReportHelper.Append(rw, doc, "born_place", zones[er.Zone]);
                }

                ReportHelper.Append(rw, doc, "born_date", er.BirthDay.ToShortDateString());
                ReportHelper.Append(rw, doc, "age", er.Age.ToString());
                ReportHelper.Append(rw, doc, "address", er.AddressSmall);
                ReportHelper.Append(rw, doc, "weight", or.FWeight().ToString());
                ReportHelper.Append(rw, doc, "weight_date", or.WeightDate.Date.ToShortDateString());
                ReportHelper.Append(rw, doc, "weight_age", or.WeightAge.ToString());
                ReportHelper.Append(rw, doc, "born", or.KidsOverAll.ToString());//сколько родила
                ReportHelper.Append(rw, doc, "okrol", or.Okrol.ToString());
                ReportHelper.Append(rw, doc, "genom", er.Genoms.Replace(' ', ','));
                ReportHelper.Append(rw, doc, "wclass", er.Bon_Weight);
                ReportHelper.Append(rw, doc, "bclass", er.Bon_Body);
                ReportHelper.Append(rw, doc, "hclass", er.Bon_Hair);
                ReportHelper.Append(rw, doc, "cclass", er.Bon_Color);
            }
            else if (or != null)
            {
                ReportHelper.Append(rw, doc, "sex", or.Sex == Rabbit.SexType.MALE ? "male" : "female");
                //ReportHelper.Append(rw, doc, "age", or.Status.ToString()+(or.Zone==1?"(списан)":""));
                ReportHelper.Append(rw, doc, "age", or.Age.ToString());
                ReportHelper.Append(rw, doc, "weight", or.FWeight());
                ReportHelper.Append(rw, doc, "class", Rabbit.GetFBon(or.Bon));
                ReportHelper.Append(rw, doc, "name", or.NameFull);
                ReportHelper.Append(rw, doc, "wclass", Rabbit.GetFBon("" + or.Bon[1]));
                ReportHelper.Append(rw, doc, "bclass", Rabbit.GetFBon("" + or.Bon[1]));
                ReportHelper.Append(rw, doc, "hclass", Rabbit.GetFBon("" + or.Bon[3]));
                ReportHelper.Append(rw, doc, "cclass", Rabbit.GetFBon("" + or.Bon[4]));
            }
            else
            {
                ReportHelper.Append(rw, doc, "sex", "none");
                ReportHelper.Append(rw, doc, "age", "");
                ReportHelper.Append(rw, doc, "weight", "");
                ReportHelper.Append(rw, doc, "class", "");
                ReportHelper.Append(rw, doc, "name", "");
                ReportHelper.Append(rw, doc, "wclass", "");
                ReportHelper.Append(rw, doc, "bclass", "");
                ReportHelper.Append(rw, doc, "hclass", "");
                ReportHelper.Append(rw, doc, "cclass", "");
            }
            return(doc);
        }
示例#14
0
 /// <summary>
 /// Обновляет данные с сервера по подсосным
 /// </summary>
 public void YoungersUpdate()
 {
     _youngers = Engine.db().GetYoungers(_id);
 }