Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mf"></param>
        /// <param name="Close"></param>
        public frmSearchQuestion(frmMain mf, Search search, FormClosedEventHandler Close = null)
        {
            frmSplashScreen ss = new frmSplashScreen();

            ss.Show();
            Application.DoEvents();

            InitializeComponent();

            frmMain_Parent = mf;

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.pnlSummaryTabHeader);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.label1);
            controlsToMove.Add(this.label23);

            FormClosed += Close;

            CurrentSearchQuestion          = new SearchQuestion();
            CurrentSearchQuestion.SearchId = search.Id;
            txtSubject.Text = CurrentSearchQuestion.SubjectValue;
            cboAnswer.Text  = "No";

            ss.Close();
            this.Show();
        }
Ejemplo n.º 2
0
 internal static void FillTags(this SearchQuestion searchQuestion)
 {
     using (var db = new SovaContext())
     {
         searchQuestion.Tags = db.QuestionTags.Include(qt => qt.Tag).Where(x => x.QuestionId == searchQuestion.Id).Select(qt => qt.Tag).ToList();
     }
 }
        private void dgvQuestions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int               index             = dgvQuestions.CurrentRow.Index;
            Guid              searchQuestionId  = new Guid(dgvQuestions.Rows[index].Cells["SearchQuestionId"].Value.ToString());
            SearchQuestion    searchQuestion    = new SearchQuestion(searchQuestionId);
            frmSearchQuestion frmSearchQuestion = new frmSearchQuestion(frmMain_Parent, searchQuestion);

            frmSearchQuestion.FormClosed += frmSearchQuestion_FormClosed;
        }
Ejemplo n.º 4
0
        private void LoadDgvQuestions()
        {
            DataTable dataTable     = SearchBidQuestion.GetAssociated(CurrentSearchBid);
            var       dataTableEnum = dataTable.AsEnumerable();

            /// Set the datatable based on the SelectedIndex of <see cref="cboQuestionViews"/>.
            switch (cboQuestionViews.SelectedIndex)
            {
            case 0:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 0);
                break;

            case 1:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 1);
                break;

            default:
                return;
            }

            if (dataTableEnum.Any())
            {
                dataTable = dataTableEnum.CopyToDataTable();
            }
            else
            {
                dataTable.Rows.Clear();
            }

            dataTable.Columns.Add("Question", typeof(string));

            dgvQuestions.DataSource = dataTable;

            // Display/order the columns.
            dgvQuestions.Columns["SearchBidQuestionId"].Visible = false;
            dgvQuestions.Columns["SearchBidId"].Visible         = false;
            dgvQuestions.Columns["SearchQuestionId"].Visible    = false;
            dgvQuestions.Columns["ModifiedBy"].Visible          = false;
            dgvQuestions.Columns["ModifiedOn"].Visible          = false;
            dgvQuestions.Columns["CreatedBy"].Visible           = false;
            dgvQuestions.Columns["CreatedOn"].Visible           = false;
            dgvQuestions.Columns["StateCode"].Visible           = false;

            dgvQuestions.Columns["Question"].DisplayIndex    = 0;
            dgvQuestions.Columns["AnswerValue"].DisplayIndex = 1;

            int rowIndex = 0;

            foreach (DataGridViewRow dr in dgvQuestions.Rows)
            {
                Guid           searchQuestionId = new Guid(dr.Cells["SearchQuestionId"].Value.ToString());
                SearchQuestion searchQuestion   = new SearchQuestion(searchQuestionId);
                dgvQuestions.Rows[rowIndex].Cells["Question"].Value = searchQuestion.SubjectValue;
                rowIndex++;
            }
        }
        private void btnDeleteQuestion_Click(object sender, EventArgs e)
        {
            int            index            = dgvQuestions.CurrentRow.Index;
            Guid           searchQuestionId = new Guid(dgvQuestions.Rows[index].Cells["SearchQuestionId"].Value.ToString());
            SearchQuestion searchQuestion   = new SearchQuestion(searchQuestionId);

            DialogResult result = MessageBox.Show("Are you sure you wish to delete \"" + searchQuestion.SubjectValue + "\"?", "Attention", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                searchQuestion.DeleteRecordFromDatabase();
                LoadDgvQuestions();
            }
        }
Ejemplo n.º 6
0
    public void LoadSearchQuestions(Search search)
    {
        DataTable dataTable = SearchQuestion.GetAssociated(search);

        foreach (DataRow dr in dataTable.Rows)
        {
            var searchQuestionId = new Guid(dr["SearchQuestionId"].ToString());
            var searchQuestion   = new SearchQuestion(searchQuestionId);
            SearchQuestions.Add(searchQuestion);

            var searchBidQuestion = new SearchBidQuestion();
            searchBidQuestion.SearchBidId      = searchBid.Id;
            searchBidQuestion.SearchQuestionId = searchQuestion.Id;
            searchBidQuestions.Add(searchBidQuestion);
        }
    }
        private void LoadDgvQuestions()
        {
            DataTable dataTable     = SearchQuestion.GetAssociated(CurrentSearch);
            var       dataTableEnum = dataTable.AsEnumerable();

            /// Set the datatable based on the SelectedIndex of <see cref="cboResultsView"/>.
            switch (cboQuestionViews.SelectedIndex)
            {
            case 0:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 0);
                break;

            case 1:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 1);
                break;

            default:
                return;
            }

            if (dataTableEnum.Any())
            {
                dataTable = dataTableEnum.CopyToDataTable();
            }
            else
            {
                dataTable.Rows.Clear();
            }

            dgvQuestions.DataSource = dataTable;

            // Display/order the columns.
            dgvQuestions.Columns["SearchQuestionId"].Visible = false;
            dgvQuestions.Columns["SearchId"].Visible         = false;
            dgvQuestions.Columns["ModifiedBy"].Visible       = false;
            dgvQuestions.Columns["ModifiedOn"].Visible       = false;
            dgvQuestions.Columns["CreatedBy"].Visible        = false;
            dgvQuestions.Columns["CreatedOn"].Visible        = false;
            dgvQuestions.Columns["StateCode"].Visible        = false;

            dgvQuestions.Columns["SubjectValue"].DisplayIndex = 0;
            dgvQuestions.Columns["AnswerValue"].DisplayIndex  = 1;
        }
Ejemplo n.º 8
0
    protected void ButtonSubmit_OnClick(object sender, EventArgs e)
    {
        searchBid.FullName                   = fullname.Value;
        searchBid.Email                      = email.Value;
        searchBid.ConfirmInvestments         = SqlBoolean.Parse(confirminvestments.Checked.ToString());
        searchBid.ConfirmServices            = SqlBoolean.Parse(confirmservices.Checked.ToString());
        searchBid.RequiredRevenue            = decimal.Parse(requirerevenue.Value);
        searchBid.RequiredRevenueExplanation = requirerevenueexplanation.Value;
        searchBid.AncillaryServices          = ancillaryservices.Value;
        searchBid.SaveRecordToDatabase(new Guid("17F6FCEB-CF02-E411-9726-D8D385C29900"));

        foreach (RepeaterItem item in RepeaterSearchQuestions.Items)
        {
            HiddenField       hiddenField       = (HiddenField)item.FindControl("SearchQuestionId");
            SearchQuestion    searchQuestion    = new SearchQuestion(new Guid(hiddenField.Value.ToString()));
            SearchBidQuestion searchBidQuestion = searchBidQuestions.Find(x => x.SearchQuestionId == searchQuestion.Id);
            CheckBox          checkBox          = (CheckBox)item.FindControl("SearchQuestionAnswer");
            searchBidQuestion.AnswerValue = SqlBoolean.Parse(checkBox.Checked.ToString());
            searchBidQuestion.SaveRecordToDatabase(new Guid("17F6FCEB-CF02-E411-9726-D8D385C29900"));
        }
    }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mf"></param>
        /// <param name="accountId"></param>
        /// <param name="Close"></param>
        public frmSearchQuestion(frmMain mf, SearchQuestion searchQuestion, FormClosedEventHandler Close = null)
        {
            frmSplashScreen ss = new frmSplashScreen();

            ss.Show();
            Application.DoEvents();

            InitializeComponent();

            frmMain_Parent = mf;

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.pnlSummaryTabHeader);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.label1);
            controlsToMove.Add(this.label23);

            FormClosed += Close;

            CurrentSearchQuestion = searchQuestion;
            txtSubject.Text       = CurrentSearchQuestion.SubjectValue;

            if (CurrentSearchQuestion.AnswerValue == SqlBoolean.True)
            {
                cboAnswer.Text = "Yes";
            }
            else if (CurrentSearchQuestion.AnswerValue == SqlBoolean.False)
            {
                cboAnswer.Text = "No";
            }

            CurrentTabLabel = label46; // Summary tab label
            highlightSelectedTabLabel(CurrentTabLabel);

            ss.Close();
            this.Show();
        }
        private void LoadDgvQuestions()
        {
            int currentCellRow = 0;
            int currentCellCol = 0;

            if (dgvQuestions.CurrentCell != null)
            {
                currentCellRow = dgvQuestions.CurrentCell.RowIndex;
                currentCellCol = dgvQuestions.CurrentCell.ColumnIndex;
            }

            DataTable dataTable     = SearchQuestion.GetAssociated(CurrentSearch);
            var       dataTableEnum = dataTable.AsEnumerable();

            /// Set the datatable based on the SelectedIndex of <see cref="cboResultsView"/>.
            switch (cboQuestionViews.SelectedIndex)
            {
            case 0:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 0);
                break;

            case 1:
                dataTableEnum = dataTableEnum.Where(x => x.Field <int>("StateCode") == 1);
                break;

            default:
                return;
            }

            if (dataTableEnum.Any())
            {
                dataTable = dataTableEnum.CopyToDataTable();
            }
            else
            {
                dataTable.Rows.Clear();
            }

            dgvQuestions.DataSource = dataTable;

            // Display/order the columns.
            dgvQuestions.Columns["SearchQuestionId"].Visible = false;
            dgvQuestions.Columns["SearchId"].Visible         = false;
            dgvQuestions.Columns["ModifiedBy"].Visible       = false;
            dgvQuestions.Columns["ModifiedOn"].Visible       = false;
            dgvQuestions.Columns["CreatedBy"].Visible        = false;
            dgvQuestions.Columns["CreatedOn"].Visible        = false;
            dgvQuestions.Columns["StateCode"].Visible        = false;

            dgvQuestions.Columns["SubjectValue"].DisplayIndex = 0;
            dgvQuestions.Columns["AnswerValue"].DisplayIndex  = 1;

            if (dgvQuestions.RowCount > 0 && dgvQuestions.ColumnCount > 0)
            {
                DataGridViewCell selectedCell = dgvQuestions.Rows[currentCellRow].Cells[currentCellCol];
                if (selectedCell != null && selectedCell.Visible)
                {
                    dgvQuestions.CurrentCell = selectedCell;
                }
                else
                {
                    dgvQuestions.CurrentCell = dgvQuestions.FirstDisplayedCell;
                }
            }
        }