Esempio n. 1
0
        private void SearchOnDialog()
        {
            try
            {
                switch (SearchType)
                {
                case eSearchType.None:
                    break;

                case eSearchType.User:
                    #region User
                    using (UserDialog dlgu = new UserDialog(null))
                    {
                        if (dlgu.RowCount == 1)
                        {
                            this.selectedrow = dlgu.SelectedData;
                            this.StringValue = dlgu.SelectedData.ID;
                        }
                        else if (dlgu.RowCount > 1)
                        {
                            if (dlgu.ShowDialog(this) == DialogResult.OK)
                            {
                                this.selectedrow = dlgu.SelectedData;
                                this.StringValue = dlgu.SelectedData.ID;
                            }
                        }
                        else
                        {
                            this.selectedrow = null;
                            this.StringValue = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.Customer:
                    #region Customer
                    using (CustomerDialog dlgc = new CustomerDialog(null))
                    {
                        if (dlgc.RowCount == 1)
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = dlgc.SelectedData.ADDR;
                            }
                            IntV             = dlgc.SelectedData.ID;
                            this.selectedrow = dlgc.SelectedData;
                        }
                        else if (dlgc.RowCount > 1)
                        {
                            if (dlgc.ShowDialog(this) == DialogResult.OK)
                            {
                                if (OptionalTextBox != null)
                                {
                                    OptionalTextBox.Text = dlgc.SelectedData.ADDR;
                                }
                                IntV             = dlgc.SelectedData.ID;
                                this.selectedrow = dlgc.SelectedData;
                            }
                        }
                        else
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = null;
                            }
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.Project:
                    #region Project
                    using (ProjectDialog dlgp = new ProjectDialog(null))
                    {
                        if (dlgp.RowCount == 1)
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = dlgp.SelectedData.ADDR;
                            }
                            IntV             = dlgp.SelectedData.ID;
                            this.selectedrow = dlgp.SelectedData;
                        }
                        else if (dlgp.RowCount > 1)
                        {
                            if (dlgp.ShowDialog(this) == DialogResult.OK)
                            {
                                if (OptionalTextBox != null)
                                {
                                    OptionalTextBox.Text = dlgp.SelectedData.ADDR;
                                }
                                IntV             = dlgp.SelectedData.ID;
                                this.selectedrow = dlgp.SelectedData;
                            }
                        }
                        else
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = null;
                            }
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.Instrument:
                    #region Instrument
                    using (InstrumentDialog dlgi = new InstrumentDialog(null))
                    {
                        if (dlgi.RowCount == 1)
                        {
                            IntV             = dlgi.SelectedData.ID;
                            this.selectedrow = dlgi.SelectedData;
                        }
                        else if (dlgi.RowCount > 1)
                        {
                            if (dlgi.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgi.SelectedData.ID;
                                this.selectedrow = dlgi.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.MethodAnalysis:
                    #region MethodAnalysis
                    using (MethodAnalysisDialog dlgm = new MethodAnalysisDialog(null))
                    {
                        if (dlgm.RowCount == 1)
                        {
                            IntV             = dlgm.SelectedData.ID;
                            this.selectedrow = dlgm.SelectedData;
                        }
                        else if (dlgm.RowCount > 1)
                        {
                            if (dlgm.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgm.SelectedData.ID;
                                this.selectedrow = dlgm.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.ParameterAnalysis:
                    #region ParameterAnalysis
                    using (ParameterAnalysisDialog dlgm = new ParameterAnalysisDialog(null))
                    {
                        if (dlgm.RowCount == 1)
                        {
                            IntV             = dlgm.SelectedData.ID;
                            this.selectedrow = dlgm.SelectedData;
                        }
                        else if (dlgm.RowCount > 1)
                        {
                            if (dlgm.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgm.SelectedData.ID;
                                this.selectedrow = dlgm.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.ToolPick:
                    #region ToolPick
                    using (ToolPickDialog dlgm = new ToolPickDialog(null))
                    {
                        if (dlgm.RowCount == 1)
                        {
                            IntV             = dlgm.SelectedData.ID;
                            this.selectedrow = dlgm.SelectedData;
                        }
                        else if (dlgm.RowCount > 1)
                        {
                            if (dlgm.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgm.SelectedData.ID;
                                this.selectedrow = dlgm.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.ToolAnalysis:
                    #region ToolAnalysis
                    using (ToolAnalysisDialog dlgm = new ToolAnalysisDialog(null))
                    {
                        if (dlgm.RowCount == 1)
                        {
                            IntV             = dlgm.SelectedData.ID;
                            this.selectedrow = dlgm.SelectedData;
                        }
                        else if (dlgm.RowCount > 1)
                        {
                            if (dlgm.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgm.SelectedData.ID;
                                this.selectedrow = dlgm.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;

                case eSearchType.StandardLight:
                    #region StandardLight
                    using (StandardLightDialog dlgm = new StandardLightDialog(null))
                    {
                        if (dlgm.RowCount == 1)
                        {
                            IntV             = dlgm.SelectedData.ID;
                            this.selectedrow = dlgm.SelectedData;
                        }
                        else if (dlgm.RowCount > 1)
                        {
                            if (dlgm.ShowDialog(this) == DialogResult.OK)
                            {
                                IntV             = dlgm.SelectedData.ID;
                                this.selectedrow = dlgm.SelectedData;
                            }
                        }
                        else
                        {
                            IntV             = null;
                            this.selectedrow = null;
                        }
                    }
                    #endregion
                    break;
                }
                if (OnSelected != null)
                {
                    OnSelected(this, null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        private void TextChange()
        {
            int?tmp = this.IntV;

            if (this.Text.IsNull())
            {
                this.IntV = null;
                return;
            }
            if (this.Text == GetTextDisplay())
            {
                return;
            }

            switch (SearchType)
            {
            case eSearchType.None:
                break;

            case eSearchType.User:
                #region User
                using (UserDialog dlg = new UserDialog(this.TextValue))
                {
                    if (dlg.RowCount == 1)
                    {
                        this.StringValue = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            this.StringValue = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        this.StringValue = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.Customer:
                #region Customer
                using (CustomerDialog dlg = new CustomerDialog(this.TextValue))
                {
                    if (dlg.RowCount == 1)
                    {
                        if (OptionalTextBox != null)
                        {
                            OptionalTextBox.Text = dlg.SelectedData.ADDR;
                        }
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = dlg.SelectedData.ADDR;
                            }
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        if (OptionalTextBox != null)
                        {
                            OptionalTextBox.Text = null;
                        }
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.Project:
                #region Project
                using (ProjectDialog dlg = new ProjectDialog(this.TextValue))
                {
                    if (dlg.RowCount == 1)
                    {
                        if (OptionalTextBox != null)
                        {
                            OptionalTextBox.Text = dlg.SelectedData.ADDR;
                        }
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            if (OptionalTextBox != null)
                            {
                                OptionalTextBox.Text = dlg.SelectedData.ADDR;
                            }
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        if (OptionalTextBox != null)
                        {
                            OptionalTextBox.Text = null;
                        }
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.Instrument:
                #region Instrument
                using (InstrumentDialog dlg = new InstrumentDialog(this.TextValue))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.MethodAnalysis:
                #region MethodAnalysis
                using (MethodAnalysisDialog dlg = new MethodAnalysisDialog(this.Text))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.ParameterAnalysis:
                #region ParameterAnalysis
                using (ParameterAnalysisDialog dlg = new ParameterAnalysisDialog(this.Text))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.ToolPick:
                #region ToolPick
                using (ToolPickDialog dlg = new ToolPickDialog(this.Text))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.ToolAnalysis:
                #region ToolAnalysis
                using (ToolAnalysisDialog dlg = new ToolAnalysisDialog(this.Text))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;

            case eSearchType.StandardLight:
                #region StandardLight
                using (StandardLightDialog dlg = new StandardLightDialog(this.Text))
                {
                    if (dlg.RowCount == 1)
                    {
                        IntV             = dlg.SelectedData.ID;
                        this.selectedrow = dlg.SelectedData;
                    }
                    else if (dlg.RowCount > 1)
                    {
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            IntV             = dlg.SelectedData.ID;
                            this.selectedrow = dlg.SelectedData;
                        }
                    }
                    else
                    {
                        IntV             = null;
                        this.selectedrow = null;
                    }
                }
                #endregion
                break;
            }
            if (OnSelected != null)
            {
                OnSelected(this, null);
            }
        }