public void setRepair(bool value)
 {
     if (b.Repair == value)
     {
         return;
     }
     if (value)
     {
         for (int i = 0; i < b.Sections; i++)
         {
             if (b.Busy[i].ID != 0)
             {
                 throw new ExFarmNotEmpty();
             }
         }
     }
     _eng.logs().log(value ? LogType.REPAIR_ON : LogType.REPAIR_OFF, 0, b.Farm.ToString());
     b.Repair = value;
     this.commit();
 }
Exemple #2
0
        /// <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);
        }