private void CreatePermitMoving(string fullNumber) { long n; if (!long.TryParse(fullNumber, out n)) { tboxPermit.ForeColor = Color.Red; return; } else { tboxPermit.ForeColor = SystemColors.WindowText; } try { Permit permit = Permit.LoadByNumber(Database, fullNumber); if (!permit.CheckClosed(Database)) { if (permit.CheckPeriod()) { if (permit.CheckEntryPoint(EntryPoint)) { EntryPointPermitForm form = new EntryPointPermitForm(Database); form.EntryPoint = EntryPoint; form.Permit = permit; form.Show(); tboxPermit.Clear(); } else { string message = EntryControl.Resources.Doc.Permit.WrongEntryPoint; message = message.Replace("@EntryPoint", permit.EntryPoint.ToString()); MessageBox.Show(message, permit.FullNumber.ToString()); tboxPermit.Clear(); } } else { string periodMessage = EntryControl.Resources.Doc.Permit.WrongPeriod; periodMessage = periodMessage.Replace("@dateFrom", permit.DateFrom.ToShortDateString()); periodMessage = periodMessage.Replace("@dateTo", permit.DateTo.ToShortDateString()); MessageBox.Show(periodMessage); tboxPermit.Clear(); } } else { MessageBox.Show(EntryControl.Resources.Message.Error.PermitIsClosed); tboxPermit.Clear(); } } catch (Exception exc) { MessageBox.Show(exc.Message, fullNumber); } }