Example #1
0
        private void BindControl()
        {
            IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                dropDownSource = db.CollabCtr
                                 .OrderBy(c => c.Id)
                                 .Where(c => c.Id > 0)
                                 .Select(x => new { x.Id, FullName = (x.NameAbbrv + " | " + x.Name) })
                                 .ToDictionary(c => c.Id, c => c.FullName);

                PageUtility.BindDropDownList(ddlCollab, dropDownSource, string.Empty);

                dropDownSource = db.Project2
                                 .OrderByDescending(d => d.Id)
                                 .Select(x => new { x.Id, FullName = (x.Id + " " + x.Title).Substring(0, 118) })
                                 .ToDictionary(c => c.Id, c => c.FullName);
            }

            PageUtility.BindDropDownList(ddlProject, dropDownSource, string.Empty);

            //phase
            dropDownSource = new Dictionary <int, string>();
            for (int p = 1; p < 10; p++)
            {
                string s = string.Format("Phase-{0}", p);
                dropDownSource.Add(p, s);
            }
            PageUtility.BindDropDownList(ddlProjectPhaseHdn, dropDownSource, "");
            PageUtility.BindDropDownList(ddlProjectPhase, dropDownSource, "");

            BindRptClientAgmt();
        }
Example #2
0
        private void BindControl()
        {
            IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                dropDownSource = db.BioStats
                                 .Where(b => b.EndDate > DateTime.Now)
                                 .OrderBy(b => b.Name)
                                 .Distinct()
                                 .ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlBiostat, dropDownSource, "--- Select ---");
                PageUtility.BindDropDownList(ddlAssignTo, dropDownSource, "--- Select ---");

                dropDownSource = db.TaskFields
                                 .Where(t => t.FieldType == "Status")
                                 .ToDictionary(c => c.Id, c => c.FieldName);
                PageUtility.BindDropDownList(ddlStatus, dropDownSource, "--- Select ---");
                PageUtility.BindDropDownList(ddlTaskStatus, dropDownSource, "--- Select ---");


                dropDownSource = db.TaskFields
                                 .Where(t => t.FieldType == "Priority")
                                 .ToDictionary(c => c.Id, c => c.FieldName);
                PageUtility.BindDropDownList(ddlPriority, dropDownSource, "--- Select ---");
                PageUtility.BindDropDownList(ddlTaskPriority, dropDownSource, "--- Select ---");
            }
        }
Example #3
0
        /// <summary>
        /// Binds the dropdown options on page load.
        /// </summary>
        private void BindControl()
        {
            if (!Creator.Equals(string.Empty))
            {
                IDictionary <string, IDictionary <int, string> > controlSource = mgr.GetControlSource();

                PageUtility.BindDropDownList(ddlInvestor, controlSource["ddlInvestor"], String.Empty);

                PageUtility.BindDropDownList(ddlGrantStatus, controlSource["ddlGrantStatus"], String.Empty);
                PageUtility.BindDropDownList(ddlFundStatus, controlSource["ddlFundStatus"], String.Empty);
                PageUtility.BindDropDownList(ddlFundStatus1, controlSource["ddlFundStatus"], "--- Select ---");

                PageUtility.BindDropDownList(ddlProject, controlSource["ddlProject"], string.Empty);

                PageUtility.BindDropDownList(ddlBiostat, controlSource["ddlBiostat"], "--- Select ---");

                PageUtility.BindDropDownList(ddlInternal, controlSource["ddlInternal"], "--- Select ---");

                //GridViewBioStat.DataSource = controlSource["ddlBiostat"];
                //GridViewBioStat.DataBind();

                //GridViewGrant.DataSource = controlSource["GridViewGrant"];
                //GridViewGrant.DataBind();
                BindGridViewBiostat(-1);
            }
        }
Example #4
0
        /// <summary>
        /// Prepopulates the Academic Type and Events dropdowns, as well as staff list
        /// for the Academic Form.
        /// </summary>
        private void BindControl()
        {
            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                var dropDownSource  = new Dictionary <int, string>();
                var dropDownSource2 = new Dictionary <long, string>();


                dropDownSource = db.Academic
                                 .Where(a => a.Id > 0)
                                 .OrderByDescending(d => d.Id)
                                 .Select(x => new { x.Id, FullName = (x.Id + " " + x.Title).Substring(0, 99) })
                                 .ToDictionary(c => c.Id, c => c.FullName);

                PageUtility.BindDropDownList(ddlEvent, dropDownSource, "Add new event");

                dropDownSource = db.Academic
                                 .Join(db.AcademicField, a => a.AcademicTypeId, f => f.Id, (a, f) => new { a.Id, f.Name, f.Category })
                                 .Where(a => a.Id > 0 && a.Category == "AcademicType")
                                 .OrderByDescending(d => d.Id)
                                 .Select(x => new { x.Id, FullName = (x.Id + " " + x.Name) })
                                 .ToDictionary(c => c.Id, c => c.FullName);

                PageUtility.BindDropDownList(ddlEventHdn, dropDownSource, "Add new event");

                dropDownSource2 = db.BioStats
                                  .Where(b => b.BitValue > 0 && b.EndDate >= DateTime.Now && b.Name != "N/A")
                                  .OrderBy(b => b.Id)
                                  .ToDictionary(c => (long)c.BitValue, c => c.Name);

                BindTable2(dropDownSource2, rptBiostat);

                //dropDownSource = db.AcademicField.OfType<AcademicType>().OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                dropDownSource = db.AcademicField.Where(f => f.Category == "AcademicType").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlAcademicType, dropDownSource, "--- please select ---");

                //dropDownSource = db.AcademicField.OfType<AcademicSemester>().OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                dropDownSource = db.AcademicField.Where(f => f.Category == "Semester").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlSemester, dropDownSource, string.Empty);
                PageUtility.BindDropDownList(ddlStartSemester, dropDownSource, string.Empty);
                PageUtility.BindDropDownList(ddlEndSemester, dropDownSource, string.Empty);

                dropDownSource = db.AcademicField.Where(f => f.Category == "CommitteeType").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlCommitteeType, dropDownSource, string.Empty);

                dropDownSource = db.AcademicField.Where(f => f.Category == "RoleInCommittee").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlPanelCommittee, dropDownSource, string.Empty);

                dropDownSource = db.AcademicField.Where(f => f.Category == "Agency").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlGrantAgency, dropDownSource, string.Empty);

                dropDownSource = db.AcademicField.Where(f => f.Category == "TypeOfTraining").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlTrainingType, dropDownSource, string.Empty);
            }

            //var random = new Random();
            //int randomNum = random.Next(100, 999);
            //txtConfirmCode.Value = randomNum.ToString();
        }
Example #5
0
        /// <summary>
        /// Preloads grant dropdown (selection between Ola HAWAII and RMATRIX)
        /// </summary>
        private void BindControl()
        {
            /// Populates Grant type dropdown (RMATRIX/Ola Hawaii)
            Dictionary <int, string> grantTypeSource = new Dictionary <int, string>();

            grantTypeSource.Add(1, "RMATRIX");
            grantTypeSource.Add(2, "Ola HAWAII");
            PageUtility.BindDropDownList(ddlGrantType, grantTypeSource, null);
        }
Example #6
0
        protected void ddlAgreement_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)sender;

            int agmtId = 0;

            Int32.TryParse(ddl.SelectedValue, out agmtId);

            if (agmtId > 0)
            {
                GridViewRow row = (GridViewRow)ddl.Parent.Parent;
                //int idx = row.RowIndex;

                if (row != null)
                {
                    TextBox txtAgreementDate = row.FindControl("txtAgreementDate") as TextBox;
                    TextBox txtProjectId     = row.FindControl("txtProjectId") as TextBox;
                    //TextBox txtRate = row.FindControl("txtRate") as TextBox;
                    //TextBox txtCompletedHours = row.FindControl("txtCompletedHours") as TextBox;
                    //TextBox txtTotalCost = row.FindControl("txtTotalCost") as TextBox;

                    using (ProjectTrackerContainer db = new ProjectTrackerContainer())
                    {
                        var agmt = db.ClientAgmt.FirstOrDefault(t => t.Id == agmtId);

                        if (agmt != null)
                        {
                            txtAgreementDate.Text = agmt.ApprovalDate != null?Convert.ToDateTime(agmt.ApprovalDate).ToShortDateString() : "";

                            txtProjectId.Text = agmt.Project2Id.ToString();
                            //txtRate.Text = agmt.ApprovedPhdRate != null ? agmt.ApprovedPhdRate.ToString() : "";
                            //txtCompletedHours.Text = agmt.ApprovedPhdHr != null ? agmt.ApprovedPhdHr.ToString() : "";

                            if (agmt.Project2Id > 0)
                            {
                                DropDownList ddlBiostat = row.FindControl("ddlBiostat") as DropDownList;

                                if (ddlBiostat != null)
                                {
                                    var dropDownSource = new Dictionary <int, string>();
                                    ddlBiostat.ClearSelection();

                                    dropDownSource = db.BioStats
                                                     .Join(db.ProjectBioStats, b => b.Id, p => p.BioStats_Id, (b, p) => new { b.Id, b.Name, p.EndDate, p.Projects_Id })
                                                     .Where(b => b.EndDate > DateTime.Now && b.Projects_Id == agmt.Project2Id)
                                                     .ToDictionary(c => c.Id, c => c.Name);
                                    PageUtility.BindDropDownList(ddlBiostat, dropDownSource, "- Select -");
                                }
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        //private void BindGrid(ProjectTrackerContainer context, GridView GridViewTimeEntry)
        //{
        //    int bioStatId = Convert.ToInt32(ddlBioStat.SelectedValue);

        //    var query = context.TimeEntries
        //                .Join(context.Projects
        //                    , t => t.ProjectId
        //                    , p => p.Id
        //                    , (t, p) => new { t, p.Title }
        //                    )
        //                .Join(context.ServiceTypes
        //                    , tt => tt.t.ServiceTypeId
        //                    , s => s.Id
        //                    , (tt, s) => new { tt, s.Name }
        //                    )
        //                .Join(context.Date1
        //                    , ttt => ttt.tt.t.DateKey
        //                    , d => d.DateKey
        //                    , (ttt, d) => new {
        //                        ttt.tt.t.Id
        //                        ,ttt.tt.t.ProjectId
        //                        , ttt.tt.Title
        //                        , ttt.Name
        //                        , d.Date
        //                        , ttt.tt.t.Duration
        //                        , ttt.tt.t.BioStatId
        //                    }
        //                )
        //                .Where(a => a.BioStatId == bioStatId);

        //    GridViewTimeEntry.DataSource = query.ToList();
        //    GridViewTimeEntry.DataBind();
        //}


        protected void ddlBioStat_Changed(Object sender, EventArgs e)
        {
            //ddlPI.ClearSelection();
            ddlProject.ClearSelection();

            int biostatId;

            Int32.TryParse(ddlBioStat.SelectedValue, out biostatId);

            if (biostatId > 0)
            {
                using (ProjectTrackerContainer context = new ProjectTrackerContainer())
                {
                    var biostat = context.BioStats.First(x => x.Id == biostatId);

                    if (biostat != null)
                    {
                        //var projects = context.ProjectBioStats
                        //    .Where(p => p.BioStats_Id == biostat.Id
                        //                && (p.Project.ProjectCompletionDate == null || p.Project.ProjectCompletionDate > _leadDate));
                        var projects = context.vwProjectBiostat.Where(v => v.BiostatId == biostat.Id);

                        if (projects.Count() > 0)
                        {
                            IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                            dropDownSource = projects
                                             .OrderByDescending(d => d.FirstName)
                                             .Select(x => new { x.InvestId, FullName = x.FirstName + " " + x.LastName })
                                             .Distinct()
                                             .ToDictionary(c => c.InvestId, c => c.FullName);
                            //PageUtility.BindDropDownList(ddlPI, dropDownSource, string.Empty);

                            PageUtility.BindDropDownList(ddlBiostatChosen, dropDownSource, string.Empty);

                            dropDownSource = projects
                                             .OrderByDescending(d => d.ProjectId)
                                             .Select(x => new { x.ProjectId, FullName = (x.ProjectId + " " + x.FirstName + " " + x.LastName + " | " + x.Title).Substring(0, 188) })
                                             .Distinct()
                                             .ToDictionary(c => c.ProjectId, c => c.FullName);

                            PageUtility.BindDropDownList(ddlProject, dropDownSource, string.Empty);

                            //BindGrid(context, GridViewTimeEntry);
                            BindGridView();
                        }
                    }
                }

                BindrptPhase(-1);
            }
        }
Example #8
0
        /// <summary>
        /// Obtains a list newly-entered investigators and projects and binds them into a separate tables
        /// for review by the QHS Tracking Team.
        /// </summary>
        private void BindControl()
        {
            GridViewBindEmpty(GridViewProject);

            using (ProjectTrackerContainer context = new ProjectTrackerContainer())
            {
                // List of pending Investigators to review by QHS Tracking Team.
                var query = context.Invests
                            .Join(context.InvestStatus, i => i.InvestStatusId, s => s.Id,
                                  (i, s) => new { i.Id, i.FirstName, i.LastName, i.Email, i.Phone, s.StatusValue, i.IsApproved })
                            .Where(d => d.Id > 0 && !d.IsApproved)
                            .OrderByDescending(d => d.Id);

                // Bind list of pending Investigators to table.
                GridViewPI.DataSource = query.ToList();
                GridViewPI.DataBind();

                // List of pending Projects to review by QHS Tracking Team.
                var pending = context.Project2
                              .Join(context.Invests, p => p.Invests.Id, i => i.Id, ((p, i) => new { p.Id, p.Title, p.InitialDate, p.IsApproved, i.FirstName, i.LastName }))
                              .Where(a => a.IsApproved == false && a.Id > 0)
                              .OrderByDescending(d => d.Id);

                // Binds list of pending Projects to table.
                GridViewPending.DataSource = pending.ToList();
                GridViewPending.DataBind();

                //var project = context.Projects
                //            .Join(context.Invests, p => p.InvestId, i => i.Id, ((p, i) => new { p.Id, p.Title, p.InitialDate, p.IsApproved, i.FirstName, i.LastName }))
                //            .Where(a => a.IsApproved == true)
                //            .OrderByDescending(p => p.Id)
                //            .Take(10);

                //GridViewProject.DataSource = project.ToList();
                //GridViewProject.DataBind();

                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                //ddlInvestor
                dropDownSource = context.Invests
                                 .OrderBy(d => d.FirstName).ThenBy(l => l.LastName)
                                 .Select(x => new { x.Id, Name = x.FirstName + " " + x.LastName })
                                 .ToDictionary(c => c.Id, c => c.Name);

                PageUtility.BindDropDownList(ddlInvestor, dropDownSource, "------ Select All ------");

                DataTable clientRqstTable = GetClientRqstAll();

                rptClientRqst.DataSource = clientRqstTable;
                rptClientRqst.DataBind();
            }
        }
Example #9
0
        private void BindControl()
        {
            using (ProjectTrackerContainer context = new ProjectTrackerContainer())
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                dropDownSource = context.BiostatReports
                                 .Where(b => b.ReportType == "RmatrixSummary")
                                 .OrderBy(b => b.Id)
                                 .ToDictionary(c => c.Id, c => c.ReportName);

                PageUtility.BindDropDownList(ddlReport, dropDownSource, "--- Select Report ---");
            }
        }
Example #10
0
        private void LoadEditTimeEntry(GridViewRow row)
        {
            lblEditId.Text        = ((Label)row.FindControl("lblId")).Text;
            lblEditProjectId.Text = ((Label)row.FindControl("lblProjectId")).Text;
            lblEditProject.Text   = ((Label)row.FindControl("lblProjectName")).Text;
            lblEditPhase.Text     = ((Label)row.FindControl("lblPhase")).Text;

            int projectId = 0;

            if (Int32.TryParse(lblEditProjectId.Text, out projectId))
            {
                using (ProjectTrackerContainer context = new ProjectTrackerContainer())
                {
                    var projectPhases = context.ProjectPhase.Where(p => p.ProjectId == projectId).ToList();

                    IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                    dropDownSource = context.ProjectPhase.Where(p => p.ProjectId == projectId && p.IsDeleted == false)
                                     .OrderBy(d => d.Id)
                                     .Select(x => new { x.Id, x.Name })
                                     .Distinct()
                                     .ToDictionary(c => c.Id, c => c.Name);
                    //PageUtility.BindDropDownList(ddlPI, dropDownSource, string.Empty);

                    PageUtility.BindDropDownList(ddlPhaseEdit, dropDownSource, null);
                    ddlPhaseEdit.ClearSelection();
                    ddlPhaseEdit.Items.FindByText(lblEditPhase.Text).Selected = true;
                }
            }

            TextBoxEditDate.Text = Convert.ToDateTime(((Label)row.FindControl("lblDate")).Text).ToShortDateString();
            TextBoxEditTime.Text = ((Label)row.FindControl("lblTime")).Text;

            TextBoxEditDesc.Text = ((Label)row.FindControl("lblDesc")).Text;

            string serviceType = ((Label)row.FindControl("lblServiceType")).Text;

            ddlEditServiceType.ClearSelection();
            ddlEditServiceType.Items.FindByText(serviceType).Selected = true;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#editModal').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                    "ModalScript", sb.ToString(), false);
        }
Example #11
0
        /// <summary>
        /// Pre-loads dropdown list based on what the type of reports there are for the Ola Hawaii Summary reports.
        /// Uses Rmatrix Summary drop downs as they are the same for Ola Hawaii reports.
        /// </summary>
        private void BindControl()
        {
            using (ProjectTrackerContainer context = new ProjectTrackerContainer())
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                //11  RmatrixSummary Projects
                //12  RmatrixSummary HealthcareData
                //13  RmatrixSummary NonUH
                //14  RmatrixSummary Publications
                //15  RmatrixSummary AbstractsPresentations
                //16  RmatrixSummary Academic
                dropDownSource = context.BiostatReports
                                 .Where(b => b.ReportType == "RmatrixSummary")
                                 .OrderBy(b => b.Id)
                                 .ToDictionary(c => c.Id, c => c.ReportName);
                PageUtility.BindDropDownList(ddlReport, dropDownSource, "--- Select Report ---");

                /// Populates Grant type dropdown (RMATRIX/Ola Hawaii)
                Dictionary <int, string> grantTypeSource = new Dictionary <int, string>();
                grantTypeSource.Add(1, "RMATRIX");
                grantTypeSource.Add(2, "Ola Hawaii");
                PageUtility.BindDropDownList(ddlGrantType, grantTypeSource, null);

                /// Populates Collaboration Center dropdown (e.g., OBGYN, SONDH, etc.)
                Dictionary <int, string> collabCtrSource = new Dictionary <int, string>();
                collabCtrSource = context.CollabCtr
                                  .Where(d => d.Id > 0)
                                  .OrderBy(h => h.NameAbbrv)
                                  .ToDictionary(x => x.Id, x => x.NameAbbrv + " (" + x.Contact + ")");
                PageUtility.BindDropDownList(ddlCollabCenter, collabCtrSource, "--- Select Collaborative Center ---");


                /// Only Admin are allowed to view collaborative center report option.
                if (!Page.User.IsInRole("Admin"))
                {
                    collabCtrSectionTitle.Visible  = false;
                    collabCtrButtonSection.Visible = false;
                }
                else
                {
                    collabCtrSectionTitle.Visible  = true;
                    collabCtrButtonSection.Visible = true;
                }
            }
        }
Example #12
0
        /// <summary>
        /// Pre-loads dropdown list based on what the type of reports there are for the Ola Hawaii Summary reports.
        /// Uses Rmatrix Summary drop downs as they are the same for Ola Hawaii reports.
        /// </summary>
        private void BindControl()
        {
            using (ProjectTrackerContainer context = new ProjectTrackerContainer())
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                //11  RmatrixSummary Projects
                //12  RmatrixSummary HealthcareData
                //13  RmatrixSummary NonUH
                //14  RmatrixSummary Publications
                //15  RmatrixSummary AbstractsPresentations
                //16  RmatrixSummary Academic
                dropDownSource = context.BiostatReports
                                 .Where(b => b.ReportType == "RmatrixSummary")
                                 .OrderBy(b => b.Id)
                                 .ToDictionary(c => c.Id, c => c.ReportName);

                PageUtility.BindDropDownList(ddlReport, dropDownSource, "--- Select Report ---");
            }
        }
Example #13
0
        private void BindControl()
        {
            IDictionary <int, string> dropDownSource = new Dictionary <int, string>();
            int ccid = 0;

            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                //dropDownSource = db.BioStats
                //                //.Where(b => b.EndDate > DateTime.Now)
                //                .OrderByDescending(b => b.Id)
                //                .ToDictionary(c => c.Id, c => c.Name);

                //PageUtility.BindDropDownList(ddlBiostatHdn, dropDownSource, "- Select -");

                Int32.TryParse(Request.QueryString["CCId"], out ccid);

                txtCCId.Value = ccid.ToString();

                //dropDownSource = db.ClientAgmt
                //                .Where(a => a.CollabCtr.Id == ccid)
                //                .ToDictionary(c => c.Id, c => c.CollabCtr.NameAbbrv + "-" + c.Id);

                //PageUtility.BindDropDownList(ddlAgreementHdn, dropDownSource, "--- Select ---");

                dropDownSource = db.CollabCtr
                                 .OrderBy(c => c.Id)
                                 .Where(c => c.Id > 0)
                                 .Select(x => new { x.Id, FullName = (x.NameAbbrv + " | " + x.Name) })
                                 .ToDictionary(c => c.Id, c => c.FullName);

                PageUtility.BindDropDownList(ddlCollab, dropDownSource, string.Empty);
            }

            //BindgvInvoiceItem(-1);

            BindRptInvoice();

            //if (ccid > 0)
            //    BindRptNewInvoice(ccid);
        }
Example #14
0
        /// <summary>
        /// Populates dropdown fields with corresponding selections.
        /// </summary>
        private void BindControl()
        {
            using (ProjectTrackerContainer context = new ProjectTrackerContainer())
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                //ddlBioStat
                //if (Page.User.IsInRole("Admin"))
                //{
                //    dropDownSource = context.BioStats
                //                    .OrderBy(b => b.Name)
                //                    .ToDictionary(c => c.Id, c => c.Name);

                //    PageUtility.BindDropDownList(ddlBiostat, dropDownSource, "--- Select All ---");
                //}
                //else
                //{
                //    var biostat = context.BioStats.FirstOrDefault(b => b.LogonId == Page.User.Identity.Name);

                //    if (biostat != null)
                //    {
                //        dropDownSource.Add(biostat.Id, biostat.Name);

                //        PageUtility.BindDropDownList(ddlBiostat, dropDownSource, null);
                //    }
                //}
                dropDownSource = context.BioStats
                                 .Where(b => b.Name != "N/A" && b.Name != "Unknown")
                                 .OrderByDescending(b => b.EndDate)
                                 .ThenBy(b => b.Name)
                                 .ToDictionary(c => c.Id, c => c.Name);

                PageUtility.BindDropDownList(ddlBiostat, dropDownSource, "--- Select All ---");

                dropDownSource = context.BioStats
                                 //.Where(b => b.EndDate > currentDate)
                                 .OrderBy(b => b.Name)
                                 .ToDictionary(c => c.Id, c => c.Name);

                //PageUtility.BindDropDownList(ddlBiostat, dropDownSource, "--- Select All ---");
                PageUtility.BindDropDownList(ddlMember, dropDownSource, "--- Select All ---");

                dropDownSource = context.BiostatReports
                                 .Where(b => b.ReportType == "TimeEntry")
                                 .OrderBy(b => b.Id)
                                 .ToDictionary(c => c.Id, c => c.ReportName);

                PageUtility.BindDropDownList(ddlReport, dropDownSource, "--- Select Report ---");

                int biostatId;
                Int32.TryParse(ddlBiostat.SelectedValue, out biostatId);
                if (biostatId > 0)
                {
                    dropDownSource = context.ProjectBioStats
                                     .Where(p => p.BioStats_Id == biostatId)
                                     .OrderByDescending(d => d.Project.Id)
                                     .Select(x => new { x.Project.Id, FullName = (x.Project.Id + " " + x.Project.Title).Substring(0, 99) })
                                     .Distinct()
                                     .ToDictionary(c => c.Id, c => c.FullName);
                }
                else
                {
                    dropDownSource = context.Project2
                                     .Where(p => p.Id > 0)
                                     .OrderByDescending(d => d.Id)
                                     .Select(x => new { x.Id, FullName = (x.Id + " " + x.Title).Substring(0, 99) })
                                     .ToDictionary(c => c.Id, c => c.FullName);
                }
                PageUtility.BindDropDownList(ddlProject, dropDownSource, "--- Select All ---");


                dropDownSource = context.PublishStatus
                                 .Where(p => p.Id > 0)
                                 .OrderBy(d => d.Id)
                                 .ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlPaperStatus, dropDownSource, string.Empty);

                /*Added "Funding Source" dropdown*/
                dropDownSource = context.ProjectField
                                 .Where(p => p.IsFundingSource == true)
                                 .ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlFundingSource, dropDownSource, string.Empty);

                dropDownSource.Clear();
                dropDownSource.Add(new KeyValuePair <int, string>(1, "Small"));
                dropDownSource.Add(new KeyValuePair <int, string>(2, "Large"));
                PageUtility.BindDropDownList(ddlServiceType, dropDownSource, "--- Select All ---");

                dropDownSource.Clear();
                for (int i = 1; i <= 10; i++)
                {
                    dropDownSource.Add(new KeyValuePair <int, string>(i, i.ToString()));
                }
                PageUtility.BindDropDownList(ddlThreshold, dropDownSource, "default");

                dropDownSource = context.JabsomAffils
                                 .Where(a => a.Type != "Other" && a.Type != "Degree" && a.Type != "Unknown" && a.Name != "Other")
                                 .OrderBy(a => a.Name)
                                 .ToDictionary(c => c.Id, c => c.Name);
                var affilsJson = dropDownSource.Select(x => new { Id = x.Key, Name = x.Value });
                textAreaAffil.Value = Newtonsoft.Json.JsonConvert.SerializeObject(affilsJson);

                dropDownSource = context.AcademicField.Where(f => f.Category == "AcademicType").OrderBy(f => f.DisplayOrder).ToDictionary(c => c.Id, c => c.Name);
                PageUtility.BindDropDownList(ddlAcademicType, dropDownSource, string.Empty);
            }
        }
Example #15
0
        //protected void ddlPI_Changed(Object sender, EventArgs e)
        //{
        //    int biostatId;
        //    bool result = Int32.TryParse(ddlBioStat.SelectedValue, out biostatId);

        //    int investId;
        //    bool piResult = Int32.TryParse(ddlPI.SelectedValue, out investId);

        //    if (biostatId > 0)
        //    {
        //        using (ProjectTrackerContainer context = new ProjectTrackerContainer())
        //        {
        //            IDictionary<int, string> dropDownSource = new Dictionary<int, string>();
        //            var projects = context.ProjectBioStats
        //                           .Where(p => p.BioStats_Id == biostatId && p.Project.IsApproved && p.Project.IsProject && (p.Project.ProjectCompletionDate == null || p.Project.ProjectCompletionDate > _leadDate));

        //            if (investId > 0)
        //            {
        //                projects = projects
        //                            .Where(p => p.Project.InvestId == investId);
        //            }

        //            dropDownSource = projects
        //                                .OrderByDescending(d => d.Project.Id)
        //                                .Select(x => new { x.Project.Id, FullName = (x.Project.Id + " " + x.Project.Invest.FirstName + " " + x.Project.Invest.LastName + " | " + x.Project.Title).Substring(0, 108) })
        //                                .ToDictionary(c => c.Id, c => c.FullName);

        //            if (projects.Count() > 0)
        //            {
        //                PageUtility.BindDropDownList(ddlProject, dropDownSource, string.Empty);
        //            }

        //        }
        //    }
        //}

        private void BindControl(string projectId)
        {
            string userName = Page.User.Identity.Name;

            _currentDate = DateTime.Now.ToShortDateString();

            if (!userName.Equals(string.Empty))
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();
                using (ProjectTrackerContainer context = new ProjectTrackerContainer())
                {
                    //var dbQuery = ((IObjectContextAdapter)context).ObjectContext.CreateQuery<DateTime>("CurrentDateTime() ");
                    //HiddenFieldCurrentDate.Value = dbQuery.AsEnumerable().First().ToString();
                    //_currentDate = HiddenFieldCurrentDate.Value;

                    _leadDate = DateTime.Now.AddDays(-50);

                    //ddlBioStat
                    var biostat = context.BioStats.FirstOrDefault(b => b.LogonId == userName);
                    if (biostat != null)
                    {
                        if (Page.User.IsInRole("Admin"))
                        {
                            dropDownSource = context.BioStats
                                             .Where(b => b.Id > 0 && b.Id < 90)
                                             .OrderBy(b => b.Id)
                                             .ToDictionary(c => c.Id, c => c.Name);

                            PageUtility.BindDropDownList(ddlBioStat, dropDownSource, string.Empty);
                            ddlBioStat.Items.FindByText(biostat.Name).Selected = true;
                        }
                        else
                        {
                            dropDownSource.Add(biostat.Id, biostat.Name);

                            PageUtility.BindDropDownList(ddlBioStat, dropDownSource, null);
                        }

                        int biostatId;
                        Int32.TryParse(ddlBioStat.SelectedValue, out biostatId);

                        if (biostatId > 0)
                        {
                            //var projects = context.ProjectBioStats
                            //                .Where(p => p.BioStats_Id == biostatId && (p.Project.ProjectCompletionDate == null || p.Project.ProjectCompletionDate > _leadDate));
                            var projects = context.vwProjectBiostat.Where(v => v.BiostatId == biostatId);

                            if (projects.Count() > 0)
                            {
                                dropDownSource = projects
                                                 .OrderByDescending(d => d.InvestId)
                                                 .Select(x => new { x.InvestId, FullName = x.FirstName + " " + x.LastName })
                                                 .Distinct()
                                                 .ToDictionary(c => c.InvestId, c => c.FullName);

                                PageUtility.BindDropDownList(ddlBiostatChosen, dropDownSource, "Search PI");


                                int piId = 0;
                                Int32.TryParse(ddlBiostatChosen.SelectedValue, out piId);

                                if (piId > 0)
                                {
                                    projects = projects.Where(p => p.InvestId == piId);
                                }

                                dropDownSource = projects
                                                 .OrderByDescending(d => d.ProjectId)
                                                 .Select(x => new { x.ProjectId, FullName = (x.ProjectId + " " + x.FirstName + " " + x.LastName + " | " + x.Title).Substring(0, 108) })
                                                 .Distinct()
                                                 .ToDictionary(c => c.ProjectId, c => c.FullName);

                                PageUtility.BindDropDownList(ddlProject, dropDownSource, string.Empty);

                                ddlProject.SelectedValue = projectId;

                                int  _projectId;
                                bool result = Int32.TryParse(ddlProject.SelectedValue, out _projectId);

                                BindrptPhase(_projectId);
                            }
                        }
                    }

                    //ddlServiceType and ddlEditServiceType
                    dropDownSource = context.ServiceTypes
                                     .OrderBy(b => b.Id)
                                     .Select(x => new { x.Id, x.Name })
                                     .Distinct().ToDictionary(c => c.Id, c => c.Name);

                    PageUtility.BindDropDownList(ddlServiceType, dropDownSource, string.Empty);

                    PageUtility.BindDropDownList(ddlEditServiceType, dropDownSource, string.Empty);


                    TextBoxSubmitDate.Text = Convert.ToDateTime(_currentDate).ToShortDateString();

                    //ddlMonth
                    int    currentYear  = DateTime.Now.Year;
                    string currentMonth = DateTime.Now.Month.ToString();

                    dropDownSource = context.Date1.Where(d => d.Year > 2014)
                                     .Select(x => new { id = (int)x.Year, x.Year })
                                     .Distinct()
                                     .OrderBy(i => i.id)
                                     .ToDictionary(c => c.id, c => c.Year.ToString());
                    PageUtility.BindDropDownList(ddlYear, dropDownSource, null);
                    ddlYear.SelectedValue = currentYear.ToString();

                    int yearSelected = currentYear;
                    Int32.TryParse(ddlYear.SelectedValue, out yearSelected);
                    dropDownSource = context.Date1.Where(d => d.Year == yearSelected)
                                     .Select(x => new { id = (int)x.MonthOfYear, x.Month })
                                     .Distinct()
                                     .OrderBy(i => i.id)
                                     .ToDictionary(c => c.id, c => c.Month);

                    //if (!Page.User.IsInRole("Admin"))
                    //{
                    //    dropDownSource = dropDownSource.Select(i => i).Where(m => m.Key.ToString() == currentMonth).ToDictionary(c => c.Key, c => c.Value);
                    //}

                    PageUtility.BindDropDownList(ddlMonth, dropDownSource, null);
                    ddlMonth.SelectedValue = currentMonth;



                    BindGridView();
                }

                //BindGridViewProjectEffort(-1);

                //phase
                dropDownSource = new Dictionary <int, string>();
                for (int p = 0; p < 10; p++)
                {
                    string s = string.Format("Phase-{0}", p);
                    dropDownSource.Add(p, s);
                }
                PageUtility.BindDropDownList(ddlPhaseHdn, dropDownSource, "--- Select ---");
                //BindgvPhase(-1);
            }
        }
Example #16
0
        /// <summary>
        /// If there is an existing PI in the request, the pop-out form will populate with
        /// the PI information already stored into the database.
        ///
        /// Otherwise, a brand new, blank form will be presented to the user.
        /// </summary>
        /// <param name="piId"></param>
        private void BindControl(string piId)
        {
            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                IDictionary <int, string> dropDownSource = new Dictionary <int, string>();

                int id = 0;
                Int32.TryParse(piId, out id);

                if (id > 0)
                {
                    var query1 = db.Invests
                                 .Join(db.InvestStatus, i => i.InvestStatusId, s => s.Id,
                                       (i, s) => new { i.Id, i.FirstName, i.LastName, i.Email, i.Phone, s.StatusValue })
                                 .Where(d => d.Id == id)
                                 .OrderBy(d => d.Id);

                    //GridView1.DataSource = query1.ToList();
                    //GridView1.DataBind();

                    rptPI.DataSource = query1.ToList();
                    rptPI.DataBind();
                }
                else
                {
                    var query = db.Invests
                                .Join(db.InvestStatus, i => i.InvestStatusId, s => s.Id,
                                      (i, s) => new { i.Id, i.FirstName, i.LastName, i.Email, i.Phone, s.StatusValue })
                                .Where(d => d.Id > 0)
                                .OrderBy(d => d.Id);

                    //GridView1.DataSource = query.ToList();
                    //GridView1.DataBind();

                    rptPI.DataSource = query.ToList();
                    rptPI.DataBind();
                }

                var statusQuery = db.InvestStatus
                                  .OrderBy(d => d.DisplayOrder);

                ddlStatus.DataSource     = statusQuery.ToList();
                ddlStatus.DataValueField = "Id";
                ddlStatus.DataTextField  = "StatusValue";

                ddlStatus.DataBind();

                //uhfaculty
                var uhfacultyQuery = db.JabsomAffils
                                     .Where(d => d.Type == "UHFaculty")
                                     .OrderBy(d => d.Id);

                ddlUHFaculty.DataSource     = uhfacultyQuery.ToList();
                ddlUHFaculty.DataValueField = "Id";
                ddlUHFaculty.DataTextField  = "Name";
                ddlUHFaculty.DataBind();
                ddlUHFaculty.Items.Insert(0, new ListItem(String.Empty, String.Empty));

                //degree
                var queryDegree = db.JabsomAffils
                                  .Where(d => d.Type == "Degree");

                GridViewDegree.DataSource = queryDegree.ToList();
                GridViewDegree.DataBind();

                //department
                var queryDept = db.JabsomAffils
                                .Where(d => d.Type == "Department");

                GridViewDept.DataSource = queryDept.ToList();
                GridViewDept.DataBind();

                var queryOffice = db.JabsomAffils
                                  .Where(d => d.Type == "Office");

                GridViewOffice.DataSource = queryOffice.ToList();
                GridViewOffice.DataBind();

                //ddlJabsomOther
                dropDownSource = db.JabsomAffils
                                 .Where(d => d.Type == "College")
                                 .ToDictionary(c => c.Id, c => c.Name);

                PageUtility.BindDropDownList(ddlJabsomOther, dropDownSource, string.Empty);

                var queryUHDept = db.JabsomAffils
                                  .Where(d => d.Type == "UHSchool");

                GridViewUHDept.DataSource = queryUHDept.ToList();
                GridViewUHDept.DataBind();

                //GridViewCommunityCollege
                var queryCommunityCollege = db.JabsomAffils
                                            .Where(d => d.Type == "CommunityCollege");

                GridViewCommunityCollege.DataSource = queryCommunityCollege.ToList();
                GridViewCommunityCollege.DataBind();

                //GridViewCommunityPartner
                var queryCommunityPartner = db.JabsomAffils
                                            .Where(d => d.Type == "CommunityPartner");

                GridViewCommunityPartner.DataSource = queryCommunityPartner.ToList();
                GridViewCommunityPartner.DataBind();

                //ddlHospital
                dropDownSource = db.JabsomAffils
                                 .Where(d => d.Type == "MajorHospital")
                                 .ToDictionary(c => c.Id, c => c.Name);

                //PageUtility.BindDropDownList(ddlHospital, dropDownSource, String.Empty);

                ////GridViewHph
                //var queryHph = db.JabsomAffils
                //               .Where(d => d.Type == "HawaiiPacificHealth");

                //GridViewHph.DataSource = queryHph.ToList();
                //GridViewHph.DataBind();

                //GridViewNonUH
                var queryNonUH = db.JabsomAffils
                                 .Where(d => d.Type == "MajorHospital");

                GridViewNonUH.DataSource = queryNonUH.ToList();
                GridViewNonUH.DataBind();

                //if (!Page.User.IsInRole("Admin"))
                //{
                //    btnAdd.Visible = false;
                //    btnSave.Visible = false;
                //}

                //var principleI = db.Invests.Where(i => i.Id > 0)
                //                .Select(x => new { FullName = x.FirstName + " " + x.LastName });
                //textAreaPI.Value = Newtonsoft.Json.JsonConvert.SerializeObject(principleI);
            }
        }
Example #17
0
        /// <summary>
        /// Prepares initial page load for use.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                using (ProjectTrackerContainer dbContext = new ProjectTrackerContainer())
                {
                    var dropDownSource = new Dictionary <int, string>();

                    var query = dbContext.BioStats.Where(b => b.Id > 0 && b.Id != 99);

                    dropDownSource = query
                                     .Where(b => b.Type == "phd")
                                     .OrderByDescending(b => b.EndDate)
                                     .ThenBy(b => b.Name)
                                     .ToDictionary(b => b.Id, b => b.Name);

                    PageUtility.BindDropDownList(ddlPhd, dropDownSource, " --- Select --- ");

                    dropDownSource = query
                                     .Where(b => b.Type != "phd")
                                     .OrderByDescending(b => b.EndDate)
                                     .ThenBy(b => b.Name)
                                     .ToDictionary(b => b.Id, b => b.Name);

                    PageUtility.BindDropDownList(ddlMs, dropDownSource, " --- Select --- ");

                    dropDownSource = dbContext.InvestStatus
                                     .OrderBy(d => d.DisplayOrder)
                                     .ToDictionary(b => b.Id, b => b.StatusValue);

                    PageUtility.BindDropDownList(ddlPIStatus, dropDownSource, " --- Select --- ");

                    dropDownSource = dbContext.ProjectField
                                     .Where(g => g.GroupName == "HealthData")
                                     .OrderBy(d => d.DisplayOrder)
                                     .ToDictionary(b => b.BitValue, b => b.Name);

                    PageUtility.BindDropDownList(ddlHealthData, dropDownSource, " --- Select --- ");

                    dropDownSource = dbContext.ProjectField
                                     .Where(g => g.GroupName == "Grant")
                                     .OrderBy(d => d.DisplayOrder)
                                     .ToDictionary(b => b.BitValue, b => b.Name);

                    PageUtility.BindDropDownList(ddlGrant, dropDownSource, " --- Select --- ");

                    var affil = dbContext.JabsomAffils
                                .Where(a => a.Type != "Other" && a.Type != "Degree" && a.Type != "Unknown" && a.Name != "Other")
                                .OrderBy(a => a.Id)
                                .Select(x => new { Id = x.Id, Name = x.Name });

                    textAreaAffil.Value = Newtonsoft.Json.JsonConvert.SerializeObject(affil);

                    var piName = dbContext.Invests
                                 .Where(i => i.Id > 0)
                                 .Select(x => new { Id = x.Id, Name = x.FirstName + " " + x.LastName });

                    textAreaPI.Value = Newtonsoft.Json.JsonConvert.SerializeObject(piName);

                    Dictionary <int, string> reportType = new Dictionary <int, string>();
                    /*reportType.Add(1, "Check-in Meeting Report");*/

                    PageUtility.BindDropDownList(ddlReportType, reportType, "Full Report");
                }
            }
        }
        /// <summary>
        /// Loads Collaborative Center form given id.
        /// </summary>
        /// <param name="id">Referred collab center id.</param>
        private void LoadCCForm(int id)
        {
            collabCtrProjSxn.Visible       = true;
            collabCtrClientAgmtSxn.Visible = true;

            var dropDownSource        = new Dictionary <int, string>();
            var dropDownSourcewString = new Dictionary <string, string>();

            /// Populates dropdowns of projects and client agreements associated with the collaboration center.
            using (ProjectTrackerContainer db = new ProjectTrackerContainer())
            {
                /// List of Collab Centers
                dropDownSource = db.CollabCtr
                                 .OrderBy(c => c.NameAbbrv)
                                 .Where(c => c.Id > 0)
                                 .Select(x => new { x.Id, FullName = (x.NameAbbrv + " | " + x.Name) })
                                 .ToDictionary(c => c.Id, c => c.FullName);
                PageUtility.BindDropDownList(ddlCollab, dropDownSource, string.Empty);

                /// Pulls list of projects associated with collaborative center OR
                /// if collaborative center is SONDH, pulls the projects with
                /// "MOU" listed as the grant payment.
                dropDownSource = db.Project2
                                 .GroupJoin(
                    db.JabsomAffils,
                    p => p.GrantDepartmentFundingType,
                    ja => ja.Id,
                    (p, ja) => new { p, ja })
                                 .Where(y => y.p.ClientAgmt.FirstOrDefault().CollabCtrId == id ||
                                        (id == 116 &&
                                         y.ja.FirstOrDefault().Name == "School of Nursing & Dental Hygiene") &&
                                        (y.p.IsMOU == 1 || y.p.GrantOther.Contains("MOU") || (y.p.AknOther.Contains("MOU"))))
                                 .OrderByDescending(y => y.p.Id)
                                 .Select(x => new { x.p.Id, FullName = (x.p.Id + " " + x.p.Title).Substring(0, 150) })
                                 .Distinct()
                                 .ToDictionary(d => d.Id, d => d.FullName);


                PageUtility.BindDropDownList(ddlCollabCtrProjects, dropDownSource, "-- List of Projects for Collaborative Center --");

                /// Pulls list of Client Agreements associated with collaborative center.
                dropDownSourcewString = db.ClientAgmt
                                        .Join(db.CollabCtr, ca => ca.CollabCtrId, cct => cct.Id, (ca, cct) => new { ca, cct })
                                        .Where(z => z.ca.CollabCtrId == id)
                                        .OrderByDescending(y => y.ca.Id)
                                        .Select(x => new { /*x.ca.Id*/ x.ca.AgmtId, FullName = (x.ca.Id + " - " + x.ca.AgmtId + " - " + x.ca.ProjectPhase + " - Project ID " + x.ca.Project2Id).Substring(0, 150) })
                                        .Distinct()
                                        .ToDictionary(d => d.AgmtId, d => d.FullName);

                PageUtility.BindDropDownList(ddlCollabCtrClientAgmts, dropDownSourcewString, "-- List of Client Agreements for Collaborative Center --");
            }


            CollabCtr cc = GetCollabCtrById(id);

            if (cc != null)
            {
                SetCollabCtr(cc);

                if (cc.Id > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript", PageUtility.LoadEditScript(true), false);
                }
            }
        }