private void btnSave_Click(object sender, System.EventArgs e)
 {
     string text = string.Empty;
     if (this.datePeriod.DateBeginIsNull)
     {
         text = text + "Введите дату начала действия" + System.Environment.get_NewLine();
     }
     if (text != string.Empty)
     {
         BalloonWindow.Show(this.btnSave, text);
     }
     else
     {
         System.Collections.Generic.List<ServiceOld> list = ServiceOld.FindByServiceProvider(this.m_Organization);
         ServicePenalty penalty = new ServicePenalty();
         OrgDocument document = this.selectOrgDocument.SelectedOrgDocument ?? OrgDocument.Null;
         foreach (ServiceOld old in list)
         {
             new ServicePenalty { ServiceId = old.Id, FromDate = this.datePeriod.DateBegin, ToDate = this.datePeriod.DateEndIsNull ? Constants.NullDate : this.datePeriod.DateEnd, PenaltyPercent = this.numPercent.Value, DocId = (document == OrgDocument.Null) ? ((long) 0L) : document.Id }.SaveChanges();
         }
     }
 }
Esempio n. 2
0
 private void btnAdd_Click(object sender, System.EventArgs e)
 {
     if (this._mServiceOld == ServiceOld.Null)
     {
         Messages.ShowMessage("Не выбрана услуга");
     }
     ServicePenalty servicePenalty = new ServicePenalty {
         ServiceId = this._mServiceOld.Id
     };
     if (new ServicePenaltiesAddChangeForm(servicePenalty).ShowDialog(this) == System.Windows.Forms.DialogResult.Yes)
     {
         this.bsServicePenalties.Add(servicePenalty);
         this.bsServicePenalties.set_Sort(this.bsServicePenalties.get_Sort());
     }
 }
 public ServicePenaltiesAddChangeForm(ServicePenalty servicePenalty)
     : this()
 {
     this.m_ServicePenalty = servicePenalty;
     this.set_Font(Manager.WindowFont);
 }
 public ServicePenaltiesAddChangeForm()
 {
     this.m_ServicePenalty = ServicePenalty.Null;
     this.InitializeComponent();
 }