コード例 #1
0
        private XmlNode getNameXml(XmlElement tmpNode, XmlDocument doc, RabName n)
        {
            XmlElement oneName = doc.CreateElement("name");

            ReportHelper.Append(oneName, doc, "id", n.ID.ToString());
            ReportHelper.Append(oneName, doc, "name", n.Name);
            ReportHelper.Append(oneName, doc, "surname", n.Surname);
            ReportHelper.Append(oneName, doc, "sex", Rabbit.SexToString(n.Sex));
            return(oneName);
        }
コード例 #2
0
ファイル: Names.cs プロジェクト: x-plora/miakro911
 public RabName(int id, String name, String surname, String sex, int use, DateTime dt)
 {
     this.ID      = id;
     this.Name    = name;
     this.Surname = surname;
     this.Sex     = Rabbit.GetSexType(sex);
     //this.sex = sex;
     //if (sex == "male")
     //    this.Sex = "м";
     //else
     //    this.Sex = "ж";
     this.Use         = use;
     this.ReleaseDate = dt;
 }
コード例 #3
0
        private XmlElement getRabXml(XmlElement rabs, XmlDocument doc, OneRabbit r)
        {
            XmlElement oneRab = doc.CreateElement("rabbit");

            ReportHelper.Append(oneRab, doc, "id", r.ID.ToString());
            ReportHelper.Append(oneRab, doc, "sex", Rabbit.SexToString(r.Sex));
            ReportHelper.Append(oneRab, doc, "name", r.NameID.ToString());
            ReportHelper.Append(oneRab, doc, "fullname", r.NameFull);
            ReportHelper.Append(oneRab, doc, "breed", r.BreedID.ToString());
            ReportHelper.Append(oneRab, doc, "breedname", r.BreedName);
            ReportHelper.Append(oneRab, doc, "surname", r.SurnameID.ToString());
            ReportHelper.Append(oneRab, doc, "secname", r.SecnameID.ToString());
            ReportHelper.Append(oneRab, doc, "mother", r.MotherID.ToString());
            ReportHelper.Append(oneRab, doc, "father", r.FatherID.ToString());
            ReportHelper.Append(oneRab, doc, "birthday", r.BirthDay.ToShortDateString());
            ReportHelper.Append(oneRab, doc, "birthplace", r.BirthPlace.ToString());
            ReportHelper.Append(oneRab, doc, "group", r.Group.ToString());
            ReportHelper.Append(oneRab, doc, "status", r.Status.ToString());
            ReportHelper.Append(oneRab, doc, "okrol", r.Okrol.ToString());
            ReportHelper.Append(oneRab, doc, "weight", r.FWeight());
            ReportHelper.Append(oneRab, doc, "weightDate", r.WeightDate.ToShortDateString());
            ReportHelper.Append(oneRab, doc, "bon", r.Bon);
            return(oneRab);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: Rabbit.cs プロジェクト: x-plora/miakro911
 public virtual string FBon(bool s_short)
 {
     return(Rabbit.GetFBon(_bon, s_short));
 }
コード例 #6
0
ファイル: RabNetEngRabbit.cs プロジェクト: x-plora/miakro911
 /// <summary>
 /// Установить пол
 /// </summary>
 /// <param name="sex">Новый пол</param>
 public void SetSex(Rabbit.SexType sex)
 {
     _eng.logs().log(LogType.SET_SEX, _id, 0, "", "", Rabbit.SexToRU(sex));
     _eng.db().setRabbitSex(_id, sex);
 }
コード例 #7
0
ファイル: RabNetEngRabbit.cs プロジェクト: x-plora/miakro911
        /// <summary>
        /// Сохраняет изменение данных на сервере
        /// </summary>
        public void Commit()
        {
            if (_id == 0)
            {
                return;
            }

            if (this.WasNameID != this.NameID)
            {
                if (Group > 1)
                {
                    throw new ExNotOne("переименовать");
                }
                _eng.logs().log(LogType.RENAME, ID, 0, this.AddressSmall, "", _eng.db().makeName(this.WasNameID, 0, 0, 1, this.Sex));
            }
            if (_origin != null && _origin.Sex != this.Sex)
            {
                _eng.logs().log(LogType.SET_SEX, ID, 0, this.AddressSmall, "", String.Format("{0:s} -> {1:s}", Rabbit.SexToRU(_origin.Sex), Rabbit.SexToRU(this.Sex)));
            }
            if (_origin != null && _origin.BirthDay != this.BirthDay)
            {
                _eng.logs().log(LogType.CH_RAB_BIRTH, ID, 0, this.AddressSmall, "", String.Format("{0:s} -> {1:s}", _origin.BirthDay.ToShortDateString(), this.BirthDay.ToShortDateString()));
            }
            if (_origin != null && _origin.BreedID != this.BreedID)
            {
                _eng.logs().log(LogType.CH_RAB_BREED, ID, 0, this.AddressSmall, "", String.Format("{0:s} -> {1:s}", _origin.BreedName, this.BreedName));
            }
            if (_origin != null && _origin.Group != this.Group)
            {
                _eng.logs().log(LogType.CH_RAB_GROUP, ID, 0, this.AddressSmall, "", String.Format("{0:d} -> {1:d}", _origin.Group, this.Group));
            }
            if (_origin != null && _origin.SurnameID != this.SurnameID)
            {
                _eng.logs().log(LogType.CH_RAB_SURNAME, ID, 0, this.AddressSmall, "", String.Format("{0:d} -> {1:d}", _origin.SurnameID, this.SurnameID));
            }
            if (_origin != null && _origin.SecnameID != this.SecnameID)
            {
                _eng.logs().log(LogType.CH_RAB_SECNAME, ID, 0, this.AddressSmall, "", String.Format("{0:d} -> {1:d}", _origin.SecnameID, this.SecnameID));
            }
            if (_origin != null && _origin.Zone != this.Zone)
            {
                _eng.logs().log(LogType.CH_RAB_ZONE, ID, 0, this.AddressSmall, "", String.Format("{0:d} -> {1:d}", _origin.Zone, this.Zone));
            }
            if (_origin != null && _origin.Rate != this.Rate)
            {
                _eng.logs().log(LogType.CH_RAB_RATE, ID, 0, this.AddressSmall, "", String.Format("{0:d} -> {1:d}", _origin.Rate, this.Rate));
            }
            if (_origin != null && _origin.Status != this.Status)
            {
                _eng.logs().log(LogType.CH_RAB_STATE, ID, 0, this.AddressSmall, "", String.Format("{0:s} -> {1:s}", _origin.FStatus(), this.FStatus()));
            }
            //_eng.logs().log(RabNetLogs.LogType.RAB_CHANGE, ID);
            _eng.db().SetRabbit(this);
            loadData();
            //_origin = _eng.db().GetRabbit(_id);
        }