示例#1
0
        private void SelectedIndexChanged_ProcessIdComboBox(object sender, EventArgs e)
        {
            int processId = -1;

            if (((ComboBox)sender).SelectedItem != null)
            {
                DataRow selectedRow = ((DataRowView)((ComboBox)sender).SelectedItem).Row;
                processId = (int)selectedRow[0];
            }
            try
            {
                Cursor = Cursors.WaitCursor;

                //ApplicantProcessIdsLabel.Text = string.Format(APPLICANT_PROCESS_FORMAT, "");
                fileCountLinkLabel.Text = WORKING;

                state.ProcessId = processId;

                try
                {
                    if (string.IsNullOrEmpty(state.FileType) || state.FileType == "All")
                    {
                        if (processId == -999)
                        {
                            state.RequestFiles           = RequestQuery.RetrieveAllRequestInfo(state.FoundationId);
                            state.RequestSupportingFiles = RequestQuery.RetrieveAllRequestSupportingInfo(state.FoundationId);
                        }
                        else
                        {
                            state.RequestFiles           = RequestQuery.RetrieveRequestInfo(processId);
                            state.RequestSupportingFiles = RequestQuery.RetrieveRequestSupportingInfo(processId);
                        }
                        state.OrganizationSupportingFiles = RequestQuery.RetrieveAllOrganizationSupportingInfo(state.FoundationId);
                        state.MergeTemplateFiles          = RequestQuery.RetrieveAllMergeTemplateInfoByFoundation(state.FoundationId);
                        state.AttachmentFiles             = RequestQuery.RetrieveAllAttachmentInfo(state.FoundationId);
                        state.SharedFiles = RequestQuery.RetrieveAllSharedInfo(state.FoundationId);
                    }
                    else
                    {
                        switch (state.FileType)
                        {
                        case "requests":
                            if (processId == -999)
                            {
                                state.RequestFiles           = RequestQuery.RetrieveAllRequestInfo(state.FoundationId);
                                state.RequestSupportingFiles = RequestQuery.RetrieveAllRequestSupportingInfo(state.FoundationId);
                            }
                            else
                            {
                                state.RequestFiles           = RequestQuery.RetrieveRequestInfo(processId);
                                state.RequestSupportingFiles = RequestQuery.RetrieveRequestSupportingInfo(processId);
                            }
                            break;

                        case "organizations":
                            state.OrganizationSupportingFiles = RequestQuery.RetrieveAllOrganizationSupportingInfo(state.FoundationId);
                            break;

                        case "mergetemplates":
                            state.MergeTemplateFiles = RequestQuery.RetrieveAllMergeTemplateInfoByFoundation(state.FoundationId);
                            break;

                        case "attachments":
                            state.AttachmentFiles = RequestQuery.RetrieveAllAttachmentInfo(state.FoundationId);
                            break;

                        case "shareddocuments":
                            state.SharedFiles = RequestQuery.RetrieveAllAttachmentInfo(state.FoundationId);
                            break;
                        }
                    }
                }
                catch (Exception eError)
                {
                    MessageBox.Show(this, string.Format(FILE_COPY_ERROR_FORMAT, eError.Message), FILE_COPY_CAPTION,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                //ApplicantProcessIdsLabel.Text = string.Format(APPLICANT_PROCESS_FORMAT, state.FoundationApplicantProcessCodes.Count);

                FileProcessing.SetFileList(state);

                if (state.Files != null && state.Files.Count > 0)
                {
                    fileCountLinkLabel.Text = string.Format(FILE_COUNT_FORMAT, state.Files.Count,
                                                            (float)state.TotalSize / (1024 * 1024));
                }
                else
                {
                    fileCountLinkLabel.Text = NO_FILE_COUNT;
                }
            }
            catch (Exception eError)
            {
                MessageBox.Show(this, string.Format(FILE_COPY_ERROR_FORMAT, eError.Message), FILE_COPY_CAPTION, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }