public ServiceSeasonalAddChangeForm(ServiceSeasonal serviceSeasonal) : this() { this.m_ServiceSeasonal = serviceSeasonal; if (this.m_ServiceSeasonal.FromDate != Constants.NullDate) { this.datePeriod.DateBegin = this.m_ServiceSeasonal.FromDate; } if (this.m_ServiceSeasonal.ToDate != Constants.NullDate) { this.datePeriod.DateEnd = this.m_ServiceSeasonal.ToDate; } this.m_ServiceSeasonal.BeginEdit(); if (this.m_ServiceSeasonal.IsNew) { this.set_Text("Добавление сезона действия услуги"); this.btnOK.set_Text("Добавить"); } else { this.set_Text("Изменение сезона действия услуги"); this.btnOK.set_Text("Изменить"); } }
private void addToolStripButton_Click(object sender, System.EventArgs e) { if (this._mServiceOld == ServiceOld.Null) { this.bsSeasonal.Clear(); } else { ServiceSeasonal serviceSeasonal = new ServiceSeasonal { ServiceId = this._mServiceOld.Id }; ServiceSeasonalAddChangeForm form = new ServiceSeasonalAddChangeForm(serviceSeasonal); if (form.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { this.bsSeasonal.Add(serviceSeasonal); this.bsSeasonal.set_Sort(this.bsSeasonal.get_Sort()); this.bsSeasonal.set_Position(this.bsSeasonal.IndexOf(serviceSeasonal)); } } }