Exemplo n.º 1
0
        public bool EmployeeAssessmentStub(string month)
        {
            Random random = new Random();

            QueryParam queryParam = new QueryParam
            {
                pager = new Pager
                {
                    page = 1,
                    rows = EmployeeStubSize
                }
            };

            FilterModel filter = new FilterModel
            {
                key   = "month",
                value = month
            };
            Dictionary <string, FilterModel> filterSet = new Dictionary <string, FilterModel>();

            filterSet.Add(filter.key, filter);
            queryParam.filters = filterSet;

            var or = AssessmentManager.GetEmployeesAll(queryParam);

            if (or.status == OperateStatus.Error)
            {
                return(false);
            }

            dynamic listAssessment = or.data;

            foreach (dynamic ass in listAssessment)
            {
                AssessmentInfo e = new AssessmentInfo();

                PropertyInfo[] pArray = ass.GetType().GetProperties();
                Type           t      = ass.GetType();

                e.billSerial       = Convert.ToString(t.GetProperty("billSerial").GetValue(ass));
                e.billSerial       = t.GetProperty("billSerial").GetValue(ass);
                e.employeeId       = t.GetProperty("employeeId").GetValue(ass);
                e.month            = month;
                e.benefitScore     = random.Next(40, 100);
                e.performanceScore = random.Next(40, 100);
                e.shouldWorkTime   = 22;
                e.actualWorkTime   = 22;

                or = AssessmentManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }

            return(true);
        }