public DebtActionNoticeAddChangeForm()
 {
     this.m_DebtActionNotice = DebtActionNotice.Null;
     this.m_DebtRecoveredAmount = DebtRecoveredAmount.Null;
     this.InitializeComponent();
 }
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     string text = string.Empty;
     if (this.dbFromDate.IsNull)
     {
         text = text + "Введите дату" + System.Environment.get_NewLine();
     }
     if (this.sfNoticeType.SelectedFasetItem == FasetItem.Null)
     {
         text = text + "Выберите тип уведомления" + string.Empty;
     }
     if (text != string.Empty)
     {
         BalloonWindow.Show(this.btnOk, text);
     }
     else
     {
         bool flag = (bool) (this.m_DebtActionNotice.TypeId != this.sfNoticeType.SelectedFasetItem.Id);
         this.m_DebtActionNotice.ResultComment = this.tbResultComment.get_Text();
         this.m_DebtActionNotice.FromDate = this.dbFromDate.Value;
         this.m_DebtActionNotice.TypeId = this.sfNoticeType.SelectedFasetItem.Id;
         this.m_DebtActionNotice.TypeName = this.sfNoticeType.SelectedFasetItem.Name;
         this.m_DebtActionNotice.Creared = this.m_DebtActionNotice.IsNew ? System.DateTime.Now : this.m_DebtActionNotice.Creared;
         this.m_DebtActionNotice.ExecutionTime = (int) this.nudExecutionTime.Value;
         this.m_DebtActionNotice.ScanPath = this.tbScanPath.get_Text().Trim();
         this.m_DebtActionNotice.NameNotice = this.tbName.get_Text().Trim();
         this.m_DebtActionNotice.Served = this.cbServed.get_Checked();
         this.m_DebtActionNotice.Court = this.cbCourt.get_Checked();
         this.m_DebtActionNotice.NotReportExecutionTime = this.cbNotReportExecutionTime.get_Checked();
         this.m_DebtActionNotice.SaveChanges();
         decimal num = this.nudRecoveredAmountSumm.Value;
         if (this.m_DebtRecoveredAmount.Summ != num)
         {
             if (this.m_DebtRecoveredAmount == DebtRecoveredAmount.Null)
             {
                 this.m_DebtRecoveredAmount = new DebtRecoveredAmount();
                 this.m_DebtRecoveredAmount.DebtActionNoticeId = this.m_DebtActionNotice.Id;
                 this.m_DebtRecoveredAmount.DebtAccountId = this.m_DebtActionNotice.DebtAccountId;
             }
             this.m_DebtRecoveredAmount.Summ = num;
             this.m_DebtRecoveredAmount.SaveChanges();
             this.m_DebtActionNotice.RecoveredAmountSumm = this.m_DebtRecoveredAmount.Summ;
         }
         if (flag && (Messages.QuestionYesNo(this, "Запись сохранена. Сменить автоматически статус процесса, если это необходимо?") == System.Windows.Forms.DialogResult.Yes))
         {
             DebtAction.UpdateStatusOnNotices(this.m_DebtActionNotice.DebtAccountId);
         }
         base.set_DialogResult(System.Windows.Forms.DialogResult.Yes);
     }
 }
 private void DebtActionNoticeAddChangeForm_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     this.sfNoticeType.Faset = FasetsEnum.NoticeType;
     this.sfNoticeType.RefreshValuesWithNull();
     if (this.m_DebtActionNotice.IsNew)
     {
         this.set_Text("Добавление извещения");
         this.btnOk.set_Text("Добавить");
         this.sfNoticeType.SelectedFasetItem = FasetItem.Null;
     }
     else
     {
         this.set_Text("Изменение извещения");
         this.btnOk.set_Text("Изменить");
         this.sfNoticeType.SelectedFasetItem = this.m_DebtActionNotice.GetFasetItem();
         this.dbFromDate.Value = this.m_DebtActionNotice.FromDate;
         this.tbResultComment.set_Text(this.m_DebtActionNotice.ResultComment);
         ObjectList<DebtRecoveredAmount> debtRecoveredAmounts = this.m_DebtActionNotice.GetDebtRecoveredAmounts();
         if ((debtRecoveredAmounts != null) && (debtRecoveredAmounts.get_Count() > 0))
         {
             this.m_DebtRecoveredAmount = debtRecoveredAmounts.get_Item(0);
         }
         this.nudRecoveredAmountSumm.set_Value(this.m_DebtRecoveredAmount.Summ);
         this.nudExecutionTime.set_Value((decimal) this.m_DebtActionNotice.ExecutionTime);
         this.tbScanPath.set_Text(this.m_DebtActionNotice.ScanPath);
         this.tbName.set_Text(this.m_DebtActionNotice.NameNotice);
         this.cbServed.set_Checked(this.m_DebtActionNotice.Served);
         this.cbCourt.set_Checked(this.m_DebtActionNotice.Court);
         this.cbNotReportExecutionTime.set_Checked(this.m_DebtActionNotice.NotReportExecutionTime);
     }
 }