コード例 #1
0
        public static List<AssignmentStatusByUser_UserData> GetAssignmentStatusByUser_UserData(SearchAssignmentStatusByUser search)
        {
            var result = new List<AssignmentStatusByUser_UserData>();

            using (var DBMEdition01_Entities = new DBMEdition01_Entities())
            {
                try
                {
                    int ProgramID = Convert.ToInt32(search.ProgramIDs);

                    result = DBMEdition01_Entities.GetAssignmentStatusByUser_UserWise(search.SelectedSiteIDs, ProgramID,
                        search.SelectedChapterIDs, search.SelectedStandardIDs, search.SelectedScoreType, search.SelectedAssignedToIDs, search.IncludeFSAEPs,
                        search.IncludeDocumentationRequired, search.IncludeNewChangedEPs, search.StartDate, search.EndDate, search.StandardEffBeginDate, search.ScoreValueList).ToList();

                    result
                        .Where(a => (decimal)(a.ScoreCompletePercentage.Value + a.ScoreNotCompletePercentage.Value + a.ScorePastDueDatePercentage.Value) > (decimal)100.00).ToList()
                        .ForEach(delegate (AssignmentStatusByUser_UserData userData)
                    {

                        decimal difference = (userData.ScoreCompletePercentage.Value + userData.ScoreNotCompletePercentage.Value + userData.ScorePastDueDatePercentage.Value) - 100;

                        if (userData.ScoreCompletePercentage.Value > difference * 2)
                            userData.ScoreCompletePercentage = userData.ScoreCompletePercentage.Value - difference;
                        else if (userData.ScoreNotCompletePercentage.Value > difference * 2)
                            userData.ScoreNotCompletePercentage = userData.ScoreNotCompletePercentage.Value - difference;
                        else if (userData.ScorePastDueDatePercentage.Value > difference * 2)
                            userData.ScorePastDueDatePercentage = userData.ScorePastDueDatePercentage.Value - difference;

                    });

                }
                catch (Exception ex)
                {
                    throw ex;
                }

                return result;
            }
        }