Example #1
0
        /// <summary>
        /// Показать справочник в зависимости от выбранного пункта меню
        /// </summary>
        private void selectReferences(object sender, EventArgs e)
        {
            CurrentReference     = (sender as ToolStripMenuItem).Tag.ToString();
            CurrentReferenceName = (sender as ToolStripMenuItem).Text;
            frmReferencesDetail frmReferencesDetail = new frmReferencesDetail();

            if (frmReferencesDetail.ShowDialog() == DialogResult.OK)
            {
            }
        }
        /// <summary>
        /// Открывает форму "дополнительные справочники" для выбора и подстановки значений в соответствующие поля
        /// </summary>
        private void selectSubstitution(object sender, EventArgs e)
        {
            IsSubstitute = true;
            // проверка условия для выбора соответствующего справочника для подстановки
            switch ((sender as TextBox).Tag.ToString())
            {
            case "Agreed":
                CurrentReference     = "Agreeds";
                CurrentReferenceName = "Рішення";
                break;

            case "Organization":
                CurrentReference     = "Organizations";
                CurrentReferenceName = "Звідки отримано";
                break;

            case "Executant":
                CurrentReference     = "Executants";
                CurrentReferenceName = "Виконавці";
                break;

            case "Summary":
                CurrentReference     = "Summarys";
                CurrentReferenceName = "Короткий зміст";
                break;

            case "Resolution":
                CurrentReference     = "Resolutions";
                CurrentReferenceName = "Резолюції";
                break;

            case "TreatmentType":
                CurrentReference     = "TreatmentTypes";
                CurrentReferenceName = "Вид звернення";
                break;

            case "CorrespondentType":
                CurrentReference     = "CorrespondentTypes";
                CurrentReferenceName = "Тип кореспондента (за суб'єктом)";
                break;

            case "RecieveType":
                CurrentReference     = "RecieveTypes";
                CurrentReferenceName = "Форма надходження";
                break;

            case "CorrespondentCategory":
                CurrentReference     = "CorrespondentCategories";
                CurrentReferenceName = "Категорія заявника";
                break;

            case "SubquestionsIndex":
                CurrentReference     = "SubquestionsIndexes";
                CurrentReferenceName = "Підпитання";
                break;

            case "RecieveSign":
                CurrentReference     = "RecieveSigns";
                CurrentReferenceName = "Ознака надходження";
                break;

            case "CorrespondentSocialStatus":
                CurrentReference     = "CorrespondentSocialStatuses";
                CurrentReferenceName = "Соціальний стан заявника";
                break;
            }
            // открыть соответствующий справочник для подстановки
            // если выбрано значение для подстановки,то подставить соответствующее значение
            frmReferencesDetail frmReferencesDetail = new frmReferencesDetail();

            if (frmReferencesDetail.ShowDialog() == DialogResult.OK)
            {
                switch ((sender as TextBox).Tag.ToString())
                {
                case "Agreed":
                    txtAgreed.Text = SubstituteValue;
                    break;

                case "Organization":
                    txtRecievedFrom.Text = SubstituteValue;
                    break;

                case "Executant":
                    switch ((sender as TextBox).Name)
                    {
                    case "txtExecutor":
                        txtExecutor.Text = SubstituteValue;
                        break;

                    case "txtWorkerChecked":
                        txtWorkerChecked.Text = SubstituteValue;
                        break;

                    case "txtController":
                        txtController.Text = SubstituteValue;
                        break;

                    case "txtResolutionAuthor":
                        txtResolutionAuthor.Text = SubstituteValue;
                        break;
                    }
                    break;

                case "Summary":
                    txtSummary.Text = SubstituteValue;
                    break;

                case "Resolution":
                    txtResolution.Text = SubstituteValue;
                    break;

                case "TreatmentType":
                    txtTreatmentType.Text = SubstituteValue;
                    break;

                case "CorrespondentType":
                    txtCorrespondentType.Text = SubstituteValue;
                    break;

                case "RecieveType":
                    txtRecieveType.Text = SubstituteValue;
                    break;

                case "CorrespondentCategory":
                    txtCorrespondentCategory.Text = SubstituteValue;
                    break;

                case "SubquestionsIndex":
                    txtSubquestion.Text = SubstituteValue;
                    break;

                case "RecieveSign":
                    txtReceiveSign.Text = SubstituteValue;
                    break;

                case "CorrespondentSocialStatus":
                    txtCorrespondentSocialStatus.Text = SubstituteValue;
                    break;

                    //case "Executant":
                    //    if (txtMessageExecutant.Text.Length < 1)
                    //        txtMessageExecutant.Text = SubstituteValue;
                    //    else
                    //        txtMessageExecutant.Text += "," + SubstituteValue;
                    //    break;
                }
            }
            IsSubstitute    = false;
            SubstituteValue = null;
        }