private void Ok_Click(object sender, RoutedEventArgs e)
        {
            var security = Security;

            var mbBuilder = new MessageBoxBuilder()
                            .Owner(this)
                            .Error();

            if (security.PriceStep == 0)
            {
                mbBuilder.Text(LocalizedStrings.Str1546).Show();
                return;
            }

            if (security.Board == null)
            {
                mbBuilder.Text(LocalizedStrings.Str1547).Show();
                return;
            }

            if (security.Id.IsEmpty())
            {
                var errorMsg = _validateId(SecurityId.Text) ?? SecurityId.ValidateId();
                if (!errorMsg.IsEmpty())
                {
                    mbBuilder.Text(errorMsg).Show();
                    return;
                }

                security.Id = SecurityId.Text;
            }

            DialogResult = true;
            Close();
        }
Example #2
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            var continuousSecurity = ContinuousSecurity;

            var errorMsg = _validateId(SecurityId.Text) ?? SecurityId.ValidateId() ?? JumpsGrid.Validate();

            if (!errorMsg.IsEmpty())
            {
                new MessageBoxBuilder()
                .Owner(this)
                .Error()
                .Text(errorMsg)
                .Show();

                return;
            }

            continuousSecurity.Id = SecurityId.Text;

            var underlyingSecurity = JumpsGrid.Jumps[0].Security;

            continuousSecurity.Board     = underlyingSecurity.Board;
            continuousSecurity.PriceStep = underlyingSecurity.PriceStep;
            continuousSecurity.Type      = underlyingSecurity.Type;

            continuousSecurity.ExpirationJumps.Clear();
            continuousSecurity.ExpirationJumps.AddRange(JumpsGrid.Jumps.Select(j => new KeyValuePair <Security, DateTimeOffset>(j.Security, j.Date.ApplyTimeZone(underlyingSecurity.Board.TimeZone))));

            DialogResult = true;
            Close();
        }
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            var exp = IndexEditor.Expression;

            var mbBuilder = new MessageBoxBuilder()
                            .Owner(this)
                            .Error();

            if (exp.HasErrors())
            {
                mbBuilder.Text(LocalizedStrings.Str1523Params.Put(exp.Error)).Show();
                return;
            }

            if (IndexSecurity.Id.IsEmpty())
            {
                var errorMsg = _validateId(SecurityId.Text) ?? SecurityId.ValidateId();
                if (!errorMsg.IsEmpty())
                {
                    mbBuilder.Text(errorMsg).Show();
                    return;
                }

                IndexSecurity.Id = SecurityId.Text;
            }

            IndexSecurity.Expression = IndexEditor.Text;

            DialogResult = true;
        }