private string GetAllStatusComments(int formResultId, string newLine, string tab)
        {
            string result = "";

            def_FormResults            fr            = formsRepo.GetFormResultById(formResultId);
            def_StatusMaster           statusMaster  = formsRepo.GetStatusMasterByFormId(fr.formId);
            List <def_StatusDetail>    statusDetails = formsRepo.GetStatusDetails(statusMaster.statusMasterId);
            List <def_StatusText>      statusTexts   = statusDetails.Select(sd => formsRepo.GetStatusTextByDetailSortOrder(statusMaster.statusMasterId, sd.sortOrder.Value)).ToList();
            IQueryable <def_StatusLog> statusLogs    = formsRepo.GetStatusLogsForFormResultId(fr.formResultId).OrderByDescending(sl => sl.statusLogDate);

            foreach (def_StatusLog sl in statusLogs)
            {
                def_StatusDetail sdFrom = statusDetails.Where(sd => sd.statusDetailId == sl.statusDetailIdFrom).FirstOrDefault();
                def_StatusDetail sdTo   = statusDetails.Where(sd => sd.statusDetailId == sl.statusDetailIdTo).FirstOrDefault();
                if (sdFrom == null)
                {
                    throw new Exception("could not find def_StatusDetail for statusDetailIdFrom " + sl.statusDetailIdFrom + " in def_StatusLog " + sl.statusLogId);
                }
                if (sdTo == null)
                {
                    throw new Exception("could not find def_StatusDetail for statusDetailIdTo " + sl.statusDetailIdTo + " in def_StatusLog " + sl.statusLogId);
                }

                def_StatusText stFrom = statusTexts.Where(st => st.statusDetailId == sdFrom.statusDetailId).FirstOrDefault();
                def_StatusText stTo   = statusTexts.Where(st => st.statusDetailId == sdTo.statusDetailId).FirstOrDefault();
                if (stFrom == null)
                {
                    throw new Exception("could not find def_StatusText for statusDetailId " + sdFrom.statusDetailId);
                }
                if (stTo == null)
                {
                    throw new Exception("could not find def_StatusText for statusDetailId " + sdTo.statusDetailId);
                }

                result += "<span style='color:Red'>" + sl.statusLogDate + "</span> - " + stFrom.displayText + " -> " + stTo.displayText + newLine;
                result += tab + sl.statusNote + newLine + "<hr>";
            }
            //statusLog.statusDetailIdFrom = formsRepo.GetStatusDetailBySortOrder(statusMasterId, oldStatus).statusDetailId;
            //statusLog.statusDetailIdTo = formsRepo.GetStatusDetailBySortOrder(statusMasterId, status).statusDetailId;
            //statusLog.formResultId = result.formResultId;
            //statusLog.UserID = SessionHelper.LoginStatus.UserID;
            //statusLog.statusLogDate = DateTime.Now;

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Get List of all Application Status
        /// </summary>
        /// <param name="formsRepo">FormsRepository interface</param>
        /// <returns>Dic</returns>
        public static Dictionary <int, string> GetAdapStatusList(IFormsRepository formsRepo, int enterpriseId, int statusMasterId = 1)
        {
            Dictionary <int, string> result = new Dictionary <int, string>();

            // RRB 3/24/16
            // Need to add GetStatusMaster(ApplicationId, FormId)
            List <def_StatusDetail> allSd = formsRepo.GetStatusDetails(statusMasterId);

            foreach (def_StatusDetail sd in allSd)
            {
                def_StatusText st        = formsRepo.GetStatusText(sd.statusDetailId, enterpriseId, 1);
                int            sortOrder = sd.sortOrder.Value;
                string         text      = st.displayText;
                result.Add(sortOrder, text);
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Get the list of possible Application Status based on the method parameters
        ///         rolePermission [Applicant 0, Staff 1, Mgt 2])
        /// </summary>
        /// <param name="formsRepo">FormsRepository interface</param>
        /// <param name="currentStatus">current application status code</param>
        /// <param name="rolePermission">Role Permission of User</param>
        /// <returns></returns>
        public static Dictionary <int, string> PossibleWorkflow(IFormsRepository formsRepo, int statusMasterId, int currentStatus, int rolePermission)
        {
            Dictionary <int, string> possibleStatus = new Dictionary <int, string>();

            string currentStatusIdentifier = formsRepo.GetStatusDetailBySortOrder(statusMasterId, currentStatus).identifier;
            int    enterpriseId            = SessionHelper.LoginStatus.EnterpriseID;

            string[] nextWorkflowStatuses = GetNextWorkflowStatusIdentifiers(currentStatusIdentifier, statusMasterId);
            foreach (string statusIdentifier in nextWorkflowStatuses)
            {
                def_StatusDetail sd = formsRepo.GetStatusDetailByMasterIdentifier(statusMasterId, statusIdentifier);
                def_StatusText   st = formsRepo.GetStatusText(sd.statusDetailId, enterpriseId, 1);
                int    sortOrder    = sd.sortOrder.Value;
                string text         = st.displayText;
                possibleStatus.Add(sortOrder, text);
            }

            return(possibleStatus);
        }
Beispiel #4
0
        public void DeleteStatusText(def_StatusText statusText)
        {
            db.def_StatusText.Remove(statusText);

            db.SaveChanges();
        }
Beispiel #5
0
        public void SaveStatusText(def_StatusText statusText)
        {
            db.Entry(statusText).State = EntityState.Modified;

            db.SaveChanges();
        }
Beispiel #6
0
        public void AddStatusText(def_StatusText statusText)
        {
            db.def_StatusText.Add(statusText);

            db.SaveChanges();
        }
        override public IEnumerable <OverviewRow> BuildRowsFromVFormResultUsers(IEnumerable <vFormResultUser> vfruRecords, string countURL = "")
        {
            //* * *OT 4-14-16 Not sure what the intention was here.
            //the following two GroupBy+Select statements were originally in AdapController.Reports DataTableApplicationOverview()
            //very similar code was moved from AdapController.Reports DataTableApplicationStatus() to ajboggs\adap\domain\StatusGrid.cs
            //both blocks seem to do the same thing, but I'm keeping them separate because it seems they were intended to behave differently
            var subgroup = vfruRecords.GroupBy(q => new { q.formId, q.subject, q.GroupID, q.GroupName, q.formStatus })
                           .Select(g =>
                                   new
            {
                FormId          = g.Key.formId,
                Subject         = g.Key.subject,
                GroupId         = g.Key.GroupID,
                GroupName       = g.Key.GroupName,
                StatusSortOrder = g.Key.formStatus,
                MaxDate         = g.Select(q => (overview) ? q.dateUpdated : q.statusChangeDate).OrderByDescending(d => d).FirstOrDefault()
            });

            int totalCount = subgroup.Count();
            //List<string[]> dataCheck2 = new List<string[]>();
            //foreach (var v in subgroup)
            //{
            //    dataCheck2.Add(new string[] { v.Subject.ToString(), v.Group, v.Status.ToString(), v.MaxDate.ToString() });
            //}

            var group = subgroup.GroupBy(g => new { g.FormId, g.GroupId, g.GroupName, g.StatusSortOrder })
                        .Select(g =>
                                new
            {
                FormId          = g.Key.FormId,
                GroupId         = g.Key.GroupId,
                GroupName       = g.Key.GroupName,
                StatusSortOrder = g.Key.StatusSortOrder,
                Count           = g.Count()
            });

            List <OverviewRow> result = new List <OverviewRow>();

            foreach (var g in group)
            {
                string formIdentifier = applicableFormIdentifiers[g.FormId];

                def_StatusText defstatusText = formsRepo.GetStatusTextByDetailSortOrder(1, g.StatusSortOrder);

                string statusDisplayText = string.Empty;

                if (defstatusText != null)
                {
                    statusDisplayText = defstatusText.displayText;

                    string newCountURL = countURL;
                    if (newCountURL.Contains("sTeam"))
                    {
                        newCountURL = newCountURL.Replace("sTeam", g.GroupName);
                    }

                    if (newCountURL.Contains("sStatus"))
                    {
                        newCountURL = newCountURL.Replace("sStatus", statusDisplayText);
                    }

                    result.Add(new OverviewRow(
                                   g.FormId, formIdentifier,
                                   g.GroupId, g.GroupName,
                                   g.StatusSortOrder, statusDisplayText,
                                   g.Count, newCountURL));
                }
            }
            return(result);
        }