Beispiel #1
0
        public List <EmployViewModel> GetUserScoresByFKCode(int FKCode)
        {
            RS_ScoreExtend             extend     = new RS_ScoreExtend();
            RS_EmployScoreBFL          ebfl       = new RS_EmployScoreBFL();
            RS_EmployScoreModel        model2     = new RS_EmployScoreModel();
            RS_EmployScoreQueryModel   queryModel = new RS_EmployScoreQueryModel();
            List <EmployViewModel>     list       = new List <EmployViewModel>();
            List <RS_EmployScoreModel> list2      = new List <RS_EmployScoreModel>();

            queryModel.ManageCodeEqual = FKCode;
            list2 = ebfl.GetRS_EmployScoreList(queryModel);
            if (list2.Count > 0)
            {
                for (int i = 0; i < list2.Count; i++)
                {
                    EmployViewModel item = new EmployViewModel();
                    item.Index    = i + 1;
                    item.Code     = list2[i].Code;
                    item.UserCode = list2[i].UserCode;
                    item.UserName = extend.GetUserNameByCode(list2[i].UserCode);
                    item.Score    = list2[i].Score;
                    list.Add(item);
                }
                return(list);
            }
            return(null);
        }
Beispiel #2
0
        public List <EmployScoreMode> GetEmployScore(string deptCode, DateTime dtNow, SearchType st)
        {
            int num;
            RS_ScoreManageQueryModel   model  = new RS_ScoreManageQueryModel();
            RS_ScoreManageModel        model2 = new RS_ScoreManageModel();
            List <RS_ScoreManageModel> list   = new List <RS_ScoreManageModel>();
            DateTime dt = this.GetMonthFirstDate(dtNow);

            list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
            if (list.Count == 0)
            {
                if (st == SearchType.Search)
                {
                    return(null);
                }
                for (num = 12; (list.Count == 0) && (num > 0); num--)
                {
                    dt   = dt.AddMonths(-1);
                    list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
                }
                if (list.Count == 0)
                {
                    return(null);
                }
            }
            else
            {
                int code = list[0].Code;
                if (int.Parse(list[0].Status) < int.Parse(WorkFlowStatus.Audited.ToString("d")))
                {
                    for (num = 12; (list.Count == 0) && (num > 0); num--)
                    {
                        if (st == SearchType.Search)
                        {
                            return(null);
                        }
                        dt   = dt.AddMinutes(-1);
                        list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
                    }
                    if (list.Count == 0)
                    {
                        return(null);
                    }
                }
            }
            List <RS_EmployScoreModel> userScoreListByManageCode = new List <RS_EmployScoreModel>();

            userScoreListByManageCode = this.GetUserScoreListByManageCode(list[0].Code);
            string                 userNameByUserID = this.GetUserNameByUserID(list[0].Marker);
            string                 deptNameByDeptID = this.GetDeptNameByDeptID(list[0].DeptCode);
            EmployScoreMode        item             = new EmployScoreMode();
            List <EmployScoreMode> list3            = new List <EmployScoreMode>();
            RS_ScoreExtend         extend           = new RS_ScoreExtend();

            foreach (RS_EmployScoreModel model3 in userScoreListByManageCode)
            {
                item           = new EmployScoreMode();
                item.UserCode  = model3.UserCode;
                item.UserName  = extend.GetUserNameByCode(model3.UserCode);
                item.Score     = model3.Score.ToString();
                item.DeptCode  = list[0].DeptCode;
                item.DeptName  = deptNameByDeptID;
                item.Marker    = userNameByUserID;
                item.ScoreCode = model3.Code;
                item.MarkTime  = list[0].MarkDate.ToString();
                item.Status    = list[0].Status;
                list3.Add(item);
            }
            return(list3);
        }