Example #1
0
        /// <summary>
        /// 展示用户信息
        /// </summary>
        protected void DisplayUserInfo()
        {
            try
            {
                List <User> list   = new List <User>();
                Int64       userId = GetUserId();

                if (userId == -1) // -1 表示既没有传参又没有用户登录
                {
                    Response.Redirect("/layout/SignIn.aspx");
                    return;
                }
                else
                {
                    list = UserService.GetUserById(userId);
                }

                if (list != null)
                {
                    ListUserInfo.DataSource = list;
                    ListUserInfo.DataBind();
                }
            }
            catch (Exception ex)
            {
                PromptInfo.Text = ex.Message;
            }
        }
Example #2
0
        public void GetUserInfo(SearchUserData data)
        {
            var     connectionString = "server=172.21.128.84;database=Exam2;uid=adminims;pwd=Ifs2015Pri";
            DataSet result           = new DataSet();
            string  sql = string.Format(@"SELECT * FROM [V_ExamUserDetail]");

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand(sql, con))
                {
                    SqlDataAdapter adp = new SqlDataAdapter(cmd);
                    adp.Fill(result);
                }
            }
            foreach (DataRow row in result.Tables[0].Rows)
            {
                decimal  score        = 0;
                DateTime?now          = null;
                DateTime?practicetime = null;
                if (row["TheoreticalAchievement"].ToString() != "")
                {
                    score = Convert.ToDecimal(row["TheoreticalAchievement"].ToString());
                }
                if (row["LastExamTime"].ToString() != "")
                {
                    now = Convert.ToDateTime(row["LastExamTime"].ToString());
                }
                if (row["PariceDate"].ToString() != "")
                {
                    now = Convert.ToDateTime(row["PariceDate"].ToString());
                }

                ListUserInfo.Add(new UserInfo
                {
                    Id        = Convert.ToInt32(row["ID"].ToString()),
                    TypeName  = row["TypeName"].ToString(),
                    UserCode  = row["UserCode"].ToString(),
                    UserName  = row["UserName"].ToString(),
                    EntryDate = Convert.ToDateTime(row["EntryDate"]),

                    RankName               = row["RankName"].ToString(),
                    PostName               = row["PostName"].ToString(),
                    DepartCode             = row["DepartCode"].ToString(),
                    SkillLevel             = row["SkillLevel"].ToString(),        //本职等
                    CurrentSkillLevel      = row["CurrentSkillLevel"].ToString(), //已经考取技能等级
                    ExamScore              = row["ExamScore"].ToString(),         //最近一次理论考试成绩
                    LastExamTime           = now,                                 //最后一次理论时间
                    TheoreticalAchievement = score,                               //实践成绩
                    PracticeTime           = practicetime,                        //最后一次实践成绩
                    HighestTestSkill       = row["HighestTestSkill"].ToString(),  //最高可考技能
                    ApplicationLevel       = row["ApplicationLevel"].ToString(),  //本次申请等级
                    IsAchment              = row["IsAchment"].ToString(),
                    Achievement            = row["Achievement"].ToString(),

                    SubjectName = row["SubjectName"].ToString(),
                    //CreateUser = row["CreateUser"].ToString(),
                    //CreateDate = Convert.ToDateTime(row["CreateDate"]),
                    //UpdateUser = row["UpdateUser"].ToString(),
                    //UpdateDate = Convert.ToDateTime(row["UpdateDate"]),


                    IsUserExam = row["IsUserExam"].ToString()
                });
            }
            ListUserInfo11 = ListUserInfo.ToList();
            YListUserInfo  = ListUserInfo.Where(x => x.IsUserExam == "true").ToList();
            if (data != null)
            {
                if (!string.IsNullOrEmpty(data.TypeName))
                {
                    ListUserInfo11 = ListUserInfo11.Where(x => x.TypeName.Contains(data.TypeName)).ToList();
                    YListUserInfo  = YListUserInfo.Where(x => x.TypeName.Contains(data.TypeName)).ToList();
                    ListDetailInfo = Data.ExamUserDetailInfo.Get_All_ExamUserDetailInfo(new { ExamStatus = "HrSignUp", IsStop = false, TypeName = data.TypeName });
                }
                if (!string.IsNullOrEmpty(data.UserCode))
                {
                    ListUserInfo11 = ListUserInfo11.Where(x => x.UserCode.Contains(data.UserCode)).ToList();
                    YListUserInfo  = YListUserInfo.Where(x => x.UserCode.Contains(data.UserCode)).ToList();
                    ListDetailInfo = Data.ExamUserDetailInfo.Get_All_ExamUserDetailInfo(new { ExamStatus = "HrSignUp", IsStop = false, UserCode = data.UserCode });
                }
                if (!string.IsNullOrEmpty(data.Depart))
                {
                    ListUserInfo11 = ListUserInfo11.Where(x => x.DepartCode.Contains(data.Depart)).ToList();
                    YListUserInfo  = YListUserInfo.Where(x => x.DepartCode.Contains(data.Depart)).ToList();
                    ListDetailInfo = Data.ExamUserDetailInfo.Get_All_ExamUserDetailInfo(new { ExamStatus = "HrSignUp", IsStop = false, DepartCode = data.Depart });
                }
            }
            LExamType.Add(new KeyValuePair <string, string>("", "-全部-"));
            foreach (var item in Data.ExamType.Get_All_ExamType())
            {
                LExamType.Add(new KeyValuePair <string, string>(item.TypeName, item.TypeName));
            }
            #region
            //var user = Data.ExamUserInfo.Get_All_ExamUserInfo();
            //foreach (var item in user)
            //{
            //    //本职等技能,最高渴考技能
            //    var SkillLevel = "";
            //    var maxskilllevel = "";
            //    if (item.RankName != null)
            //    {
            //        ListRankInfo = Data.ExamUserInfo.Get_ExamUserLevel(item.RankName);
            //        if (ListRankInfo != null&& ListRankInfo.Count()>0)
            //        {
            //            SkillLevel = ListRankInfo.FirstOrDefault().SkillName;
            //            maxskilllevel = ListRankInfo.FirstOrDefault().MaxSkillName;
            //        }
            //    }
            //    //目前技能等级,最近一次考试时间
            //    var CurrentSkillLevel = "";
            //    DateTime LastExamTime = DateTime.Now;
            //    DateTime PlanTime = DateTime.Now;
            //    decimal? score = 0;
            //    var  ExamStatus = "";
            //    if (item.UserCode != null)
            //    {
            //        ListExamUserDetailInfo = Data.ExamUserInfo.GetExamUserDetail(item.UserCode);
            //        if (ListExamUserDetailInfo != null&& ListExamUserDetailInfo.Count()>0)
            //        {
            //            //目前技能
            //            CurrentSkillLevel = ListExamUserDetailInfo.FirstOrDefault().SkillName;
            //            LastExamTime =Convert.ToDateTime(ListExamUserDetailInfo.FirstOrDefault().ExamDate);
            //            PlanTime = Convert.ToDateTime(ListExamUserDetailInfo.FirstOrDefault().PlanExamDate);
            //            ExamStatus = ListExamUserDetailInfo.FirstOrDefault().ExamStatus;
            //            if (CurrentSkillLevel != null && LastExamTime != null)
            //            {
            //                //理论成绩(实践表)
            //                ListPracticeInfo = Data.ExamUserInfo.GetPraticeScore(item.UserCode, CurrentSkillLevel);
            //                if (ListPracticeInfo != null&& ListPracticeInfo.Count()>0)
            //                {
            //                    score = ListPracticeInfo.FirstOrDefault().PracticeScore;
            //                }
            //            }
            //        }

            //    }
            //    //ApplicationLevel 本地申请等级
            //    var ApplicationLevel = "";
            //    bool apps = false;
            //    if (item.UserCode != null)
            //    {
            //        ListExamUserDetailInfo = Data.ExamUserInfo.GetExamUserDetail(item.UserCode);
            //        if (ListExamUserDetailInfo.Count() > 0)
            //        {
            //            var ap= "";
            //            var app = ListExamUserDetailInfo.FirstOrDefault().ApplyLevel;
            //            if (app != null)
            //            {
            //                if (app == "G1")
            //                {
            //                    ap = "G2";
            //                }
            //                else if (app == "G2")
            //                {
            //                    ap = "G3";
            //                }
            //                else if (app == "G3")
            //                {
            //                    ap = "G4";
            //                }
            //                else if (app == "G4")
            //                {
            //                    ap = "G5";
            //                }
            //                else if (app == "G5")
            //                {
            //                    ap = "G6";
            //                }
            //                else if (app == "G6")
            //                {
            //                    ap = "G7";
            //                }
            //                else if (app == "G7")
            //                {
            //                    ap = "G8";
            //                }
            //                //本职等技能 + 1,如果去职等表里面查找不到,就显现满级,如果存在,就显示对应的职等技能
            //                  ListRankInfo = Data.ExamUserInfo.GetRanKInfoSkill(ap);
            //                if (ListRankInfo != null&& ListRankInfo.Count()>0)
            //                {
            //                    var s = ListRankInfo.FirstOrDefault().SkillName;
            //                    ApplicationLevel = s;

            //                }
            //                else {
            //                    ApplicationLevel = app;
            //                }

            //            }
            //        }
            //        else
            //        {
            //            //不存在,就按照职等去技能表找对应的本职等级能
            //            ListRankInfo = Data.ExamUserInfo.Get_ExamUserLevel(item.RankName);
            //            if (ListRankInfo != null&& ListRankInfo.Count()>0)
            //            {
            //                ApplicationLevel = ListRankInfo.FirstOrDefault().SkillName;
            //                apps = true;
            //            }

            //        }
            //    }
            //    //是否绩效
            //    bool isach = false;
            //    if (ApplicationLevel != null)
            //    {
            //        ListSkillInfo = Data.ExamUserInfo.GetSkillAch(ApplicationLevel);
            //        if (ListSkillInfo != null&&ListSkillInfo.Count()>0)
            //        {
            //            var sk = ListSkillInfo.FirstOrDefault().AchRequire;
            //            if (sk == item.Achievement)
            //            {
            //                isach = true;
            //            }

            //        }
            //    }

            //    //本次是否考试
            //    bool isexam = false;
            //    if (apps == false && isach == true)
            //    {
            //        isexam = true;
            //    }

            //    ListUserInfo.Add(new UserInfo {
            //        Id = item.ID,
            //        UserCode = item.UserCode,
            //        UserName = item.UserName,
            //        DepartCode = item.DepartCode,
            //        PostName = item.PostName,
            //        RankName = item.RankName,
            //        EntryDate = item.EntryDate,
            //        Achievement = item.Achievement,
            //        TypeName = item.TypeName,
            //        SubjectName = item.SubjectName,
            //        CreateUser = item.CreateUser,
            //        CreateDate = item.CreateDate,
            //        UpdateUser = item.UpdateUser,
            //        UpdateDate = item.UpdateDate,
            //        SkillLevel = SkillLevel,
            //        HighestTestSkill=maxskilllevel,
            //        CurrentSkillLevel= CurrentSkillLevel,
            //        LastExamTime= LastExamTime,
            //        TheoreticalAchievement=score,
            //        IsApp=apps,
            //        IsAchment= isach,
            //        PlanExamDate=PlanTime,
            //        IsExam=isexam,
            //        ApplicationLevel= ApplicationLevel,
            //        ExamStatus=ExamStatus
            //    });
            //}
            #endregion
        }