public HouseServiceSeasonsAddChangeForm(HouseServiceSeason houseServiceSeason)
     : this()
 {
     this.m_HouseServiceSeason = houseServiceSeason;
     if (this.m_HouseServiceSeason.FromDate != Constants.NullDate)
     {
         this.datePeriod.DateBegin = this.m_HouseServiceSeason.FromDate;
     }
     if (this.m_HouseServiceSeason.ToDate != Constants.NullDate)
     {
         this.datePeriod.DateEnd = this.m_HouseServiceSeason.ToDate;
     }
     this.bsServices.set_DataSource(ServiceOld.FindByHouseId(this.m_HouseServiceSeason.HouseId, true));
     this.cbService.set_SelectedValue((long) this.m_HouseServiceSeason.ServiceId);
     this.m_HouseServiceSeason.BeginEdit();
     if (this.m_HouseServiceSeason.IsNew)
     {
         this.set_Text("Добавление сезона действия услуги");
         this.btnOK.set_Text("Добавить");
     }
     else
     {
         this.set_Text("Изменение сезона действия услуги");
         this.btnOK.set_Text("Изменить");
     }
 }
 private void tsbAdd_Click(object sender, System.EventArgs e)
 {
     if (System.Windows.Forms.Application.OpenForms.get_Item(0).GetType().ToString() == "AIS.SN.UI.Provider.ProviderMainForm")
     {
         string valueByName = Setting.GetValueByName("Работа с приборами учета", "Диапазон в который разрешено редактирование в Поставщике");
         if ((System.Convert.ToInt32(valueByName.Substring(0, valueByName.IndexOf('-'))) > System.DateTime.Now.get_Day()) || (System.Convert.ToInt32(valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1))) < System.DateTime.Now.get_Day()))
         {
             System.Windows.Forms.MessageBox.Show(string.Concat((string[]) new string[] { "Вам разрешено редактирование данных только с ", valueByName.Substring(0, valueByName.IndexOf('-')), " по ", valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1)), " числа месяца" }), "Редактирование запрещено", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
             return;
         }
     }
     if (this.m_House != House.Null)
     {
         HouseServiceSeason houseServiceSeason = new HouseServiceSeason {
             HouseId = this.m_House.Id
         };
         HouseServiceSeasonsAddChangeForm form = new HouseServiceSeasonsAddChangeForm(houseServiceSeason);
         if (form.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
         {
             this.bsHouseServiceSeasons.Add(houseServiceSeason);
             this.bsHouseServiceSeasons.set_Sort(this.bsHouseServiceSeasons.get_Sort());
             this.bsHouseServiceSeasons.set_Position(this.bsHouseServiceSeasons.IndexOf(houseServiceSeason));
         }
     }
 }