Ejemplo n.º 1
0
        /// <summary>
        /// 读取通过的岗位名称
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">截至日期</param>
        /// <param name="count">通过的岗位数量</param>
        /// <returns></returns>
        public static string ReadPassPostName(int userID, DateTime startDate, DateTime endDate, ref int count)
        {
            string       ReturnString = string.Empty;
            PostPassInfo postPass     = new PostPassInfo();

            postPass.UserId          = userID;
            postPass.SearchStartDate = startDate;
            postPass.CreateDate      = endDate;
            postPass.IsRZ            = 1;
            List <PostPassInfo> PostPassList = ReadPostPassList(postPass);

            if (PostPassList != null)
            {
                foreach (PostPassInfo Info in PostPassList)
                {
                    count++;
                    if (string.IsNullOrEmpty(ReturnString))
                    {
                        ReturnString = PostBLL.ReadPost(Info.PostId).PostName;
                    }
                    else
                    {
                        ReturnString = ReturnString + "," + PostBLL.ReadPost(Info.PostId).PostName;
                    }
                }
            }
            return(ReturnString);
        }
Ejemplo n.º 2
0
        //public static Dictionary<int, string> PostPassReportList(PostPassInfo Model, string CompanyId)
        //{
        //    Dictionary<int, string> PostPassList = new Dictionary<int, string>();
        //    List<PostPassInfo> PostPassModel = dal.PostPassRepostList(Model, CompanyId);
        //    foreach (PostPassInfo Info in PostPassModel)
        //    {
        //        //if (PostPassList.Exists(delegate(PostPassInfo TempModel) { if (TempModel.UserId == Info.UserId) return true; else return false; }))
        //        if (PostPassList.ContainsKey(Info.UserId))
        //        {
        //            foreach (int Item in PostPassList.Keys)
        //            {
        //                if (Item == Info.UserId)
        //                {
        //                    PostPassList[Item] = PostPassList[Item] + "," + Info.PostId;
        //                }
        //            }
        //        }
        //        else
        //        {
        //            PostPassList.Add(Info.UserId, Info.PostId.ToString());
        //        }
        //    }
        //    return PostPassList;
        //}

        public static List <ReportPostPassInfo> PostPassReportList(PostPassInfo Model, string CompanyId)
        {
            List <ReportPostPassInfo> PostPassList  = new List <ReportPostPassInfo>();
            List <ReportPostPassInfo> PostPassModel = dal.PostPassRepostList(Model, CompanyId);

            foreach (ReportPostPassInfo Info in PostPassModel)
            {
                if (PostPassList.Exists(delegate(ReportPostPassInfo TempModel) { if (TempModel.UserId == Info.UserId)
                                                                                 {
                                                                                     return(true);
                                                                                 }
                                                                                 else
                                                                                 {
                                                                                     return(false);
                                                                                 } }))
                {
                    foreach (ReportPostPassInfo Item in PostPassList)
                    {
                        if (Item.UserId == Info.UserId)
                        {
                            Item.PassPostId   = Item.PassPostId + "," + Info.PassPostId;
                            Item.PassPostName = Item.PassPostName + "、" + Info.PassPostName;
                        }
                    }
                }
                else
                {
                    PostPassList.Add(Info);
                }
            }
            return(PostPassList);
        }
Ejemplo n.º 3
0
        public List <ReportPostPassInfo> PostPassRepostList(PostPassInfo Model, string CompanyId)
        {
            if (Model.SearchStartDate == DateTime.MinValue)
            {
                Model.SearchStartDate = Convert.ToDateTime("2013-1-1");
            }
            List <ReportPostPassInfo> TempList = new List <ReportPostPassInfo>();
            StringBuilder             sql      = new StringBuilder();

            sql.Append("select [_PassPost].UserId as UserId,[_PassPost].[PostName] as [PassPostName],WorkingPostName,[_User].WorkingPostID as WorkPostId,[_PassPost].PostId as PostId,[_User].RealName as RealName,(select count(distinct PostId) from [" + ShopMssqlHelper.TablePrefix + "PassPost] Where UserId=[_User].ID and IsRZ=1) as PostNum,[_User].StudyPostId as StudyPostId from [" + ShopMssqlHelper.TablePrefix + "PassPost],[" + ShopMssqlHelper.TablePrefix + "User] ");
            sql.Append("where [_PassPost].UserId=[_User].ID and [_User].CompanyID in (" + CompanyId + ") and ([_PassPost].CreateDate between '" + Model.SearchStartDate.ToString() + "' and '" + Model.CreateDate.ToString() + "') and [IsRZ]=1");
            sql.Append(" Order By [_PassPost].id desc");
            using (SqlDataReader dr = DbSQLHelper.ExecuteReader(sql.ToString()))
            {
                while (dr.Read())
                {
                    ReportPostPassInfo ReportModel = new ReportPostPassInfo();
                    {
                        ReportModel.UserId          = int.Parse(dr["UserId"].ToString());
                        ReportModel.PassPostId      = dr["PostId"].ToString();
                        ReportModel.PassPostName    = dr["PassPostName"].ToString();
                        ReportModel.PassPostNum     = int.Parse(dr["PostNum"].ToString());
                        ReportModel.RealName        = dr["RealName"].ToString();
                        ReportModel.WorkingPostName = dr["WorkingPostName"].ToString();
                        ReportModel.WorkingPostId   = int.Parse(dr["WorkPostId"].ToString());
                        ReportModel.StudyPostId     = int.Parse(dr["StudyPostId"].ToString());
                    }
                    TempList.Add(ReportModel);
                }
            }

            return(TempList);
        }
Ejemplo n.º 4
0
        public List <PostPassInfo> ReadPostPassList(PostPassInfo Model, int num)
        {
            string sqlNumString = "*";

            if (num > 0)
            {
                sqlNumString = "top " + num + " " + sqlNumString;
            }
            StringBuilder sql = new StringBuilder();

            sql.Append("select " + sqlNumString + " from [" + ShopMssqlHelper.TablePrefix + "PassPost] ");
            List <PostPassInfo> TempList       = new List <PostPassInfo>();
            MssqlCondition      mssqlCondition = new MssqlCondition();

            this.PrepareCondition(mssqlCondition, Model);

            if (mssqlCondition.ToString() != string.Empty)
            {
                sql.Append("where " + mssqlCondition.ToString());
                sql.Append(" Order By CreateDate desc");
                using (SqlDataReader dr = DbSQLHelper.ExecuteReader(sql.ToString()))
                {
                    this.PrepareModel(dr, TempList);
                }
            }

            return(TempList);
        }
Ejemplo n.º 5
0
        public void UpdateIsRZ(PostPassInfo Model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("Update [" + ShopMssqlHelper.TablePrefix + "PassPost] set [CreateDate]='" + DateTime.Now + "',[IsRZ]=" + Model.IsRZ + " where [UserId]=" + Model.UserId + " and [PostId]=" + Model.PostId);
            DbSQLHelper.ExecuteSql(sql.ToString());
        }
Ejemplo n.º 6
0
        public int AddPostPassInfo(PostPassInfo Model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("Insert into [" + ShopMssqlHelper.TablePrefix + "PassPost] ([UserId],[PostId],[IsRZ],[PostName]) values(@UserId,@PostId,@IsRZ,@PostName)");
            SqlParameter[] par = (SqlParameter[])this.ValueParas(Model);
            return(DbSQLHelper.ExecuteSql(sql.ToString(), par));
        }
Ejemplo n.º 7
0
        public void UpdatePostPassInfo(PostPassInfo Model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("Update [" + ShopMssqlHelper.TablePrefix + "PassPost] set [UserId]=@UserId,[PostId]=@PostId,[PostName]=@PostName where [Id]=@Id");
            SqlParameter[] par = (SqlParameter[])this.ValueParas(Model);
            DbSQLHelper.ExecuteSql(sql.ToString(), par);
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int    id     = RequestHelper.GetQueryString <int>("ID");
                string Action = RequestHelper.GetQueryString <string>("Action");
                if (Action == "Search")
                {
                    string   searchName        = RequestHelper.GetQueryString <string>("username");
                    string   searchCompanyName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("companyname").Trim());
                    string   searchPostName    = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("postname").Trim());
                    DateTime startDate         = RequestHelper.GetQueryString <DateTime>("StartDate");
                    DateTime endDate           = RequestHelper.GetQueryString <DateTime>("EndDate");
                    int      pageCount         = RequestHelper.GetQueryString <int>("PageCount");
                    if (pageCount > 0)
                    {
                        base.PageSize       = pageCount;
                        this.PageCount.Text = pageCount.ToString();
                    }
                    CompanyName.Text = searchCompanyName;
                    SearchName.Text  = searchName;
                    PostName.Text    = searchPostName;
                    if (startDate != DateTime.MinValue)
                    {
                        SearchStartDate.Text = startDate.ToString("d");
                    }
                    if (endDate != DateTime.MinValue)
                    {
                        SearchEndDate.Text = endDate.ToString("d");
                    }

                    base.CheckAdminPower("ReadTestPaper", PowerCheckType.Single);
                    PostPassInfo postpassSearch = new PostPassInfo();
                    postpassSearch.SearchStartDate = startDate;
                    postpassSearch.CreateDate      = ShopCommon.SearchEndDate(endDate);
                    postpassSearch.PostName        = searchPostName;
                    if (!string.IsNullOrEmpty(searchCompanyName))
                    {
                        postpassSearch.InCompanyID = CompanyBLL.ReadCompanyIdStr(searchCompanyName, 1);
                    }

                    if (!string.IsNullOrEmpty(searchName))
                    {
                        UserSearchInfo user = new UserSearchInfo();
                        user.RealName           = searchName;
                        postpassSearch.InUserID = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(user));
                        if (string.IsNullOrEmpty(postpassSearch.InUserID))
                        {
                            postpassSearch.InUserID = "0";
                        }
                    }

                    base.BindControl(PostPassBLL.ReadPostPassList(postpassSearch, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager);
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 核对岗位是否通过
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        public static void CheckPostPass(int userID, int productID)
        {
            string      companyPostID = CookiesHelper.ReadCookieValue("UserCompanyPostSetting");
            ProductInfo product       = ProductBLL.ReadProduct(productID);

            //如果本次通过的是综合考试,就更新通过岗位的记录状态
            if (StringHelper.CompareSingleString(product.ClassID, "4387", '|'))
            {
                PostPassInfo PostPassModel = new PostPassInfo();
                PostPassModel.UserId = userID;
                PostPassModel.PostId = RenZhengCateBLL.ReadTestCateByID(productID, companyPostID).PostId;
                PostPassModel.IsRZ   = 1;
                PostPassBLL.UpdateIsRZ(PostPassModel);
            }
            else
            {
                //读取和本课程关联的岗位
                List <PostInfo> RelatedPostList = PostBLL.FilterPostListByCourseID(productID);
                if (RelatedPostList != null)
                {
                    //统计通过的课程ID
                    string PassCateId     = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(userID, DateTime.Now.AddDays(1), 1));
                    string companyBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID");
                    foreach (PostInfo Item in RelatedPostList)
                    {
                        //去除非公司设定的岗位
                        if (StringHelper.CompareSingleString(companyPostID, Item.PostId.ToString()))
                        {
                            string postCourseID = PostBLL.ReadPostCourseID(Item.PostId, companyBrandID);
                            if (string.IsNullOrEmpty(StringHelper.SubString(postCourseID, PassCateId)))
                            {
                                PostPassInfo PostPassModel = PostPassBLL.ReadPostPassInfo(userID, Item.PostId);
                                if (PostPassModel.Id <= 0)
                                {
                                    PostPassModel.UserId   = userID;
                                    PostPassModel.PostId   = Item.PostId;
                                    PostPassModel.PostName = Item.PostName;
                                    if (Item.PostId == 220) //钣金喷漆岗位直接发证书
                                    {
                                        PostPassModel.IsRZ = 1;
                                    }
                                    else
                                    {
                                        PostPassModel.IsRZ = 0;
                                    }
                                    PostPassBLL.AddPostPassInfo(PostPassModel);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public static string PassPostString(PostPassInfo Model)
        {
            string ReturnString = "0";
            List <PostPassInfo> PostPassList = ReadPostPassList(Model);

            if (PostPassList != null)
            {
                foreach (PostPassInfo Info in PostPassList)
                {
                    ReturnString = ReturnString + "," + Info.PostId;
                }
            }
            return(ReturnString);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 返回数据
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public PostPassInfo GetModel(SqlDataReader dr)
        {
            PostPassInfo Model = new PostPassInfo();

            if (dr.Read())
            {
                Model.Id       = int.Parse(dr["Id"].ToString());
                Model.UserId   = int.Parse(dr["UserId"].ToString());
                Model.PostId   = int.Parse(dr["PostId"].ToString());
                Model.IsRZ     = int.Parse(dr["IsRZ"].ToString());
                Model.PostName = dr["PostName"].ToString();
            }
            return(Model);
        }
Ejemplo n.º 12
0
 public void PrepareCondition(MssqlCondition mssqlCondition, PostPassInfo Model)
 {
     mssqlCondition.Add("[UserId]", Model.UserId, ConditionType.Equal);
     mssqlCondition.Add("[UserId]", Model.InUserID, ConditionType.In);
     mssqlCondition.Add("[PostId]", Model.PostId, ConditionType.Equal);
     mssqlCondition.Add("[IsRZ]", Model.IsRZ, ConditionType.Equal);
     mssqlCondition.Add("[PostName]", Model.PostName, ConditionType.Like);
     mssqlCondition.Add("[CreateDate]", Model.CreateDate, ConditionType.LessOrEqual);
     mssqlCondition.Add("[CreateDate]", Model.SearchStartDate, ConditionType.MoreOrEqual);
     mssqlCondition.Add("[_passpost].[postid] in (select [postid] from [_post])");
     if (!string.IsNullOrEmpty(Model.InCompanyID))
     {
         mssqlCondition.Add("[UserId] in (Select [ID] from [" + ShopMssqlHelper.TablePrefix + "User] where [CompanyID] in (" + Model.InCompanyID + "))");
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 该数据访问对象的属性值装载到数据库更新参数数组
 /// </summary>
 /// <remarks></remarks>
 protected IDbDataParameter[] ValueParas(PostPassInfo Model)
 {
     SqlParameter[] par =
     {
         new SqlParameter("@UserId",   SqlDbType.Int),
         new SqlParameter("@PostId",   SqlDbType.Int),
         new SqlParameter("@IsRZ",     SqlDbType.Int),
         new SqlParameter("@PostName", SqlDbType.NVarChar)
     };
     par[0].Value = Model.UserId;
     par[1].Value = Model.PostId;
     par[2].Value = Model.IsRZ;
     par[3].Value = Model.PostName;
     return(par);
 }
Ejemplo n.º 14
0
 public void PrepareModel(SqlDataReader dr, List <PostPassInfo> List)
 {
     while (dr.Read())
     {
         PostPassInfo Model = new PostPassInfo();
         {
             Model.Id         = int.Parse(dr["Id"].ToString());
             Model.UserId     = int.Parse(dr["UserId"].ToString());
             Model.PostId     = int.Parse(dr["PostId"].ToString());
             Model.IsRZ       = int.Parse(dr["IsRZ"].ToString());
             Model.PostName   = dr["PostName"].ToString();
             Model.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
         }
         List.Add(Model);
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 取得最新的num张岗位证书路径
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static List <string> GetTheLatestPostCert(int num)
        {
            List <string> certPathList = new List <string>();
            PostPassInfo  postPass     = new PostPassInfo();

            postPass.IsRZ = 1;
            List <PostPassInfo> PostPassList = dal.ReadPostPassList(postPass, num);

            foreach (PostPassInfo info in PostPassList)
            {
                UserInfo user    = UserBLL.ReadUser(info.UserId);
                CertBLL  certBLL = new CertBLL(user.CompanyID);
                if (string.IsNullOrEmpty(certBLL.GetCertPath(info.UserId, info.PostId)))
                {
                    certBLL.Create(info.UserId, user.RealName, info.PostId, info.PostName);
                }
                certPathList.Add(certBLL.GetCertPath(info.UserId, info.PostId));
            }
            return(certPathList);
        }
Ejemplo n.º 16
0
        public List <PostPassInfo> ReadPostPassList(PostPassInfo postpassSearch, int currentPage, int pageSize, ref int count)
        {
            List <PostPassInfo> TempList = new List <PostPassInfo>();
            ShopMssqlPagerClass class2   = new ShopMssqlPagerClass();

            class2.TableName   = "[" + ShopMssqlHelper.TablePrefix + "PassPost]";
            class2.Fields      = "*";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = "[CreateDate]";
            class2.OrderType   = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, postpassSearch);
            class2.Count = count;
            count        = class2.Count;
            using (SqlDataReader dr = class2.ExecuteReader())
            {
                this.PrepareModel(dr, TempList);
            }
            return(TempList);
        }
Ejemplo n.º 17
0
        private List <Dictionary <string, string> > GetCertList()
        {
            int PageIndex = RequestHelper.GetForm <int>("pageIndex");
            int PageSize  = RequestHelper.GetForm <int>("pageSize");
            List <Dictionary <string, string> > ReturnResult = new List <Dictionary <string, string> >();

            PostPassInfo PostPassModel = new PostPassInfo();

            PostPassModel.UserId = base.UserID;
            List <PostPassInfo> PostPassList = PostPassBLL.ReadPostPassList(PostPassModel);

            if (PostPassList.Count > 0)
            {
                foreach (PostPassInfo Info in PostPassList)
                {
                    Dictionary <string, string> TempDic = new Dictionary <string, string>();
                    TempDic.Add("PostName", Info.PostName);
                    TempDic.Add("CertPath", "/zs/" + base.UserCompanyID.ToString() + "/" + base.UserID.ToString() + "_" + Info.PostId.ToString() + ".jpg");
                    ReturnResult.Add(TempDic);
                }
            }
            return(ReturnResult);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 返回通过的岗位信息列表
 /// </summary>
 /// <param name="Model"></param>
 /// <returns></returns>
 public static List <PostPassInfo> ReadPostPassList(PostPassInfo Model)
 {
     return(dal.ReadPostPassList(Model));
 }
Ejemplo n.º 19
0
 public static List <PostPassInfo> ReadPostPassList(PostPassInfo postpassSearch, int currentPage, int pageSize, ref int count)
 {
     return(dal.ReadPostPassList(postpassSearch, currentPage, pageSize, ref count));
 }
Ejemplo n.º 20
0
        protected void HtmlOut()
        {
            StringBuilder TextOut = new StringBuilder();

            //Table表头在后面插入
            TextOut.Append(CompanyModel.CompanySimpleName);
            TextOut.Append(" [ 截止到:" + endDate.ToString("d") + " ]");
            TextOut.Append("</td></tr>\r\n");
            TextOut.Append("<tr class=\"listTableHead\">\r\n");
            TextOut.Append("<td colspan=\"3\">部门/岗位</td>");
            List <PostInfo> DepartmentList = PostBLL.ReadParentPostListByPostId(CompanyModel.Post);
            //岗位数组
            ArrayList PostArray = new ArrayList();
            //需要再次展开的岗位
            ArrayList PostExpandArray = new ArrayList();

            foreach (PostInfo Info in DepartmentList)
            {
                List <PostInfo> PostList     = PostBLL.ReadPostList(Info.PostId);
                int             SonPostCount = PostList.Count;
                if (SonPostCount > 1)
                {
                    PostArray.Add(Info.PostId);
                    PostExpandArray.Add(Info.PostId);
                    TextOut.Append("<td colspan=\"" + SonPostCount.ToString() + "\">" + Info.PostName + "</td>");
                }
                else
                {
                    TextOut.Append("<td rowspan=\"2\"  style=\"width:23px;text-align:center; \"><div style=\"width:15px; margin:0px auto;\">" + Info.PostName + "</div></td>");
                    if (SonPostCount == 1)
                    {
                        foreach (PostInfo Item in PostList)
                        {
                            PostArray.Add(Item.PostId);
                        }
                    }
                    else
                    {
                        PostArray.Add(Info.PostId);
                    }
                }
            }
            DepartmentList = null;

            TextOut.Append("</tr>");
            TextOut.Append("<tr class=\"listTableMain\">");
            TextOut.Append("<td style=\"min-width:80px;\">序号</td>");
            TextOut.Append("<td style=\"min-width:60px;\">员工<br />名称</td>");
            TextOut.Append("<td style=\"min-width:200px;\">在职<br />岗位</td>");
            foreach (int Item in PostExpandArray)
            {
                ArrayList TempArray = new ArrayList();
                foreach (PostInfo Info in PostBLL.ReadPostList(Item))
                {
                    TextOut.Append("<td style=\"width:23px;text-align:center; \"><div style=\"width:15px; margin:0px auto;\">" + Info.PostName + "</div></td>");
                    TempArray.Add(Info.PostId);
                }
                int InsertPos = PostArray.IndexOf(Item);
                PostArray.RemoveAt(InsertPos);
                PostArray.InsertRange(InsertPos, TempArray);
                TempArray = null;
            }
            PostExpandArray = null;
            TextOut.Append("</tr>\r\n");

            //取得列数,插入表头
            TextOut.Insert(0, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=left colspan=\"" + (3 + PostArray.Count) + "\"><ul style=\"margin:10px; line-height:180%;\">说明:<li>绿色代表已通过</li><li>黄色代表正在学习的岗位</li><li>紫色代表岗位课程已通过但综合认证考试未通过</li></ul></td></tr><tr class=\"listTableHead\"><td colspan=\"" + (3 + PostArray.Count) + "\">");

            int PNum = 0;
            //定义一个数组,用来存放每个人通过的岗位数
            string PassPostTotal = "|";

            endDate = endDate.AddDays(1);
            UserSearchInfo user = new UserSearchInfo();

            user.InCompanyID     = companyID.ToString();
            user.InStatus        = state;
            user.InGroupID       = groupID;
            user.InWorkingPostID = postIdCondition;
            foreach (UserInfo Info in UserBLL.SearchReportUserList(user))
            {
                PNum += 1;

                PostPassInfo PostPassModel = new PostPassInfo();
                PostPassModel.UserId     = Info.ID;
                PostPassModel.CreateDate = endDate;
                //读取通过的岗位
                string PassPost = PostPassBLL.PassPostString(PostPassModel);
                //读取岗位学完但认证没过的名单
                PostPassModel.IsRZ = 0;
                string NoPassPost = PostPassBLL.PassPostString(PostPassModel);

                string WorkingPostName = string.Empty;

                //取得工作岗位
                if (string.IsNullOrEmpty(Info.PostName))
                {
                    WorkingPostName = PostBLL.ReadPost(Info.WorkingPostID).PostName;
                }
                else
                {
                    WorkingPostName = Info.PostName;
                }

                TextOut.Append("<tr class=\"listTableMain\" data-style=\"data\">\r\n");
                TextOut.Append("<td>" + PNum.ToString() + "</td>");
                TextOut.Append("<td>" + Info.RealName + "</td>");
                TextOut.Append("<td>" + WorkingPostName + "</td>");
                int PassPostNum = 0;
                foreach (int Item in PostArray)
                {
                    if (StringHelper.CompareSingleString(PassPost, Item.ToString()))
                    {
                        PassPostNum += 1;
                        TextOut.Append("<td class=\"style1\">●</td>");
                    }
                    else if (StringHelper.CompareSingleString(NoPassPost, Item.ToString()))
                    {
                        TextOut.Append("<td class=\"style2\">○</td>");
                    }
                    else if (Item.ToString() == Info.StudyPostID.ToString())
                    {
                        TextOut.Append("<td class=\"style3\">○</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>&nbsp;</td>");
                    }
                }
                if (PassPostNum > 0)
                {
                    PassPostTotal += PassPostNum.ToString() + "|";
                }
                TextOut.Append("</tr>\r\n");
            }
            TextOut.Append("</table>");

            //统计通过几个岗位的人数
            if (PassPostTotal.Length > 1)
            {
                TextOut.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                for (int i = 1; i < PostArray.Count + 1; i++)
                {
                    if (PassPostTotal.Contains("|" + i + "|"))
                    {
                        TextOut.Append("<tr class=\"listTableMain\"><td>通过" + i.ToString() + "个岗位的人数为:");
                        int PerNum = 0;
                        foreach (string Item in PassPostTotal.Split('|'))
                        {
                            if (Item == i.ToString())
                            {
                                PerNum += 1;
                            }
                        }
                        TextOut.Append(PerNum.ToString() + "</td></tr>");
                    }
                }
                TextOut.Append("</table>");
            }
            this.ReportList.InnerHtml = TextOut.ToString();
        }
Ejemplo n.º 21
0
        protected string HtmlOut1(CompanyInfo company, ref StringBuilder TotalTable)
        {
            StringBuilder TextOut           = new StringBuilder();
            DateTime      PostPlanStartDate = DateTime.MinValue;

            if (string.IsNullOrEmpty(company.PostStartDate.ToString()))
            {
                PostPlanStartDate = Convert.ToDateTime("2013-7-1");
            }
            else
            {
                PostPlanStartDate = Convert.ToDateTime(company.PostStartDate.ToString());
            }

            int PeoperNum = 0;
            //统计目标课程数
            int TargetNum = 0, CompanyDelayNum = 0;
            //统计通过课程数量第一的数据信息
            string PassCourseFirstUser = string.Empty, GoodStudent = string.Empty; int FirstPassCourseNum = 0;
            //单个岗位的岗位计划开始时间
            DateTime PostStartDate = DateTime.MinValue;
            int      PostCourseNum = 0; //岗位课程数
            string   AllPostPlan = "0"; //岗位下所有级别的岗位课程
            int      RedNum = 0, YellowNum = 0, GreenNum = 0;

            //把公司所有员工的考试记录都一起调起
            TestPaperInfo TestPaperModel = new TestPaperInfo();

            if (!string.IsNullOrEmpty(company.PostStartDate.ToString()))
            {
                TestPaperModel.TestMinDate = Convert.ToDateTime(company.PostStartDate);
            }
            TestPaperModel.TestMaxDate        = endDate;
            TestPaperModel.CompanyIdCondition = company.CompanyId.ToString();
            //TestPaperModel.Field = "UserID";
            TestPaperModel.Condition = "[UserID] in (select [ID] from [_User] where [companyID]=" + company.CompanyId.ToString();
            if (!string.IsNullOrEmpty(groupID))
            {
                TestPaperModel.Condition += " and [GroupID] in (" + groupID + ")";
            }
            if (!string.IsNullOrEmpty(postIdCondition))
            {
                TestPaperModel.Condition += " and [WorkingPostID] in (" + postIdCondition + ")";
            }
            if (!string.IsNullOrEmpty(studyPostIdCondition))
            {
                TestPaperModel.Condition += " and [StudyPostId] in (" + studyPostIdCondition + ")";
            }
            if (!string.IsNullOrEmpty(state))
            {
                TestPaperModel.Condition += " and [Status] in (" + state + ")";
            }
            TestPaperModel.Condition += ")";
            List <TestPaperInfo> TestPaperList = TestPaperBLL.NewReadList(TestPaperModel);

            UserSearchInfo userSearch = new UserSearchInfo();

            userSearch.InStatus        = state;
            userSearch.InWorkingPostID = postIdCondition;
            //if (base.IsGroupCompany(company.GroupId))
            //{
            //    userSearch.InCompanyID = CompanyBLL.ReadCompanyIdList(company.CompanyId.ToString());
            //    ColNum = 11;
            //    userSearch.InStudyPostID = "45";//集团打开默认显示学习岗位
            //}
            //else
            {
                userSearch.InCompanyID   = company.CompanyId.ToString();
                userSearch.InStudyPostID = studyPostIdCondition; //只显示该学习岗位下的人员
            }
            userSearch.InGroupID = groupID;
            List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch);

            //把公司所有员工的第一次考试记录都一起调起
            List <TestPaperReportInfo> userFirstTestRecordList = TestPaperBLL.ReadTheFirstRecordList(userSearch.InCompanyID);
            //把所有员工的认证记录一起调用
            PostPassInfo postPassSearch = new PostPassInfo();

            postPassSearch.CreateDate  = endDate;
            postPassSearch.InCompanyID = userSearch.InCompanyID;
            List <PostPassInfo> postPassList = PostPassBLL.ReadPostPassList(postPassSearch);

            //记录岗位课程ID串
            Dictionary <int, string[]> postCourseDic = new Dictionary <int, string[]>();

            foreach (UserInfo Info in userList)
            {
                int PostId = int.MinValue, PerPassCourseNum = 0, PerCourseNum = 0;

                PostId = Info.StudyPostID;

                PostInfo PostModel = PostBLL.ReadPost(PostId);
                if (PostModel != null) //排除掉没有设置岗位的人
                {
                    //筛选出当前用户ID的成绩列表
                    List <TestPaperInfo> currentUserPaperList     = TestPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.UserId == Info.ID); });
                    List <TestPaperInfo> currentUserPassPaperList = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.IsPass == 1); });

                    int ResidueCourseNum = 0;//岗位内剩余岗位课程数

                    if (!postCourseDic.ContainsKey(PostId))
                    {
                        //岗位数据信息 1:岗位课程ID串;2:岗位课程数量;3:岗位开始时间;4:目标课程数量
                        string[] postData = { "0", "0", DateTime.MinValue.ToString(), "0" };
                        AllPostPlan = PostBLL.ReadPostCourseID(company.CompanyId, PostId);
                        postData[0] = AllPostPlan;

                        if (!string.IsNullOrEmpty(AllPostPlan))
                        {
                            PostCourseNum = AllPostPlan.Split(',').Length;
                            postData[1]   = PostCourseNum.ToString();
                        }

                        //公司有事耽误的数量  由于岗位不一样,岗位计划开始的时间也不一样,所以有事耽误的数量也是不一致的,按岗位计算
                        PostStartDate = CompanyPostPlanBLL.ReadCompanyPostPlan(company.CompanyId, PostId);
                        //如果没有设置岗位开始时间或者岗位开始时间比公司开始时间早,统一使用公司开始时间
                        if (PostStartDate == DateTime.MinValue || PostStartDate < PostPlanStartDate)
                        {
                            PostStartDate = PostPlanStartDate;
                        }

                        //根据统一的岗位开始时间调取数据
                        CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, endDate);
                        TargetNum       = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, endDate); //理论值是每周两门
                        TargetNum       = TargetNum - CompanyDelayNum;

                        postData[2] = PostStartDate.ToString();
                        postData[3] = TargetNum.ToString();
                        postCourseDic.Add(PostId, postData);
                    }
                    else
                    {
                        AllPostPlan   = postCourseDic[PostId][0];
                        PostCourseNum = int.Parse(postCourseDic[PostId][1]);
                        PostStartDate = Convert.ToDateTime(postCourseDic[PostId][2]);
                        TargetNum     = int.Parse(postCourseDic[PostId][3]);
                    }

                    //如果员工是后来的,要以员工进来的时间为起始点
                    if (PostStartDate < Info.PostStartDate)//Info.RegisterDate
                    {
                        PostStartDate   = Info.PostStartDate;
                        CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, endDate);
                        TargetNum       = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, endDate); //理论值是每周两门
                        TargetNum       = TargetNum - CompanyDelayNum;
                    }
                    TargetNum = TargetNum - ChangeNumBLL.UserChangeNum(Info.ID, PostStartDate, endDate);


                    //PassCateId 跨岗位通过的课程  PostResidueCourse 岗位内剩余课程
                    string PassCateId = string.Empty, NoPassCateId = string.Empty, PostResidueCourse = string.Empty;
                    if (!string.IsNullOrEmpty(company.PostStartDate.ToString()))
                    {
                        PassCateId        = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= PostStartDate && TempModel.TestDate <= endDate); }));
                        PostResidueCourse = StringHelper.SubString(AllPostPlan, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= endDate); })));
                    }
                    else
                    {
                        PassCateId        = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= endDate); }));
                        PostResidueCourse = StringHelper.SubString(AllPostPlan, PassCateId);
                    }

                    //跨岗位通过的课程数(全岗位计划开始后,累计完成的课程数)
                    int AllPassCourseNum = 0;
                    if (!string.IsNullOrEmpty(PassCateId))
                    {
                        AllPassCourseNum = PassCateId.Split(',').Length;
                    }
                    //获取岗位内剩余课程数
                    if (!string.IsNullOrEmpty(PostResidueCourse))
                    {
                        ResidueCourseNum = PostResidueCourse.Split(',').Length;
                    }

                    string PastPassCourse = string.Empty;
                    PeoperNum       = PeoperNum + 1;
                    TotalPeoperNum += 1;
                    TextOut.Append("<tr class=\"listTableMain\">\r\n");
                    TextOut.Append("<td>" + TotalPeoperNum + "</td>");
                    TextOut.Append("<td>" + company.CompanySimpleName + "</td>");
                    TextOut.Append("<td>" + Info.RealName + "</td>");
                    if (!string.IsNullOrEmpty(Info.PostName))
                    {
                        TextOut.Append("<td>" + Info.PostName + "</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostID).PostName + "</td>");
                    }
                    TextOut.Append("<td>" + PostModel.PostName + "</td>");
                    TextOut.Append("<td>" + EnumHelper.ReadEnumChineseName <UserState>(Info.Status) + "</td>");

                    TestPaperReportInfo currentUserFirstTestRecord = userFirstTestRecordList.Find(delegate(TestPaperReportInfo tempModel) { return(tempModel.UserID == Info.ID); });
                    if (currentUserFirstTestRecord != null)
                    {
                        TextOut.Append("<td>" + currentUserFirstTestRecord.TestDate.ToString("d") + "</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>&nbsp;</td>");
                    }
                    PostPassInfo selfPostRZ = postPassList.Find(delegate(PostPassInfo postpass) { return(postpass.UserId == Info.ID && postpass.PostId == Info.WorkingPostID); });
                    if (selfPostRZ != null)
                    {
                        TextOut.Append("<td>是</td>");
                        TextOut.Append("<td>" + selfPostRZ.CreateDate.ToString("d") + "</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>&nbsp;</td>");
                        TextOut.Append("<td>&nbsp;</td>");
                    }
                    List <PostPassInfo> otherPostRZ = postPassList.FindAll(delegate(PostPassInfo postpass) { return(postpass.UserId == Info.ID && postpass.PostId != Info.WorkingPostID); });
                    if (otherPostRZ.Count > 0)
                    {
                        TextOut.Append("<td>是</td>");
                        //TextOut.Append("<td>");
                        //string otherPostName = string.Empty;
                        //foreach (ReportPostPassInfo info in otherPostRZ)
                        //{
                        //    TextOut.Append(info.PassPostName + " ");
                        //}
                        //TextOut.Append("</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>&nbsp;</td>");
                    }

                    for (int j = 1; j <= WeekNum; j++)
                    {
                        int      WeekCourseNum = 0;
                        DateTime _StartDate    = startDate.AddDays(7 * (j - 1));
                        DateTime _EndDate      = startDate.AddDays(7 * j);
                        if (j == WeekNum)
                        {
                            _EndDate = endDate;
                        }
                        if (_StartDate < PostStartDate)
                        {
                            _StartDate = PostStartDate;
                        }
                        if (_EndDate > PostStartDate)
                        {
                            PastPassCourse = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); }));
                            WeekCourseNum  = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); }).Count;
                        }
                        int PastPassCourseNum = 0;
                        if (!string.IsNullOrEmpty(PastPassCourse))
                        {
                            PastPassCourseNum = PastPassCourse.Split(',').Length;
                        }
                        PerPassCourseNum += PastPassCourseNum;
                        PerCourseNum     += WeekCourseNum;
                        TextOut.Append("<td>" + WeekCourseNum + "</td>");
                        TextOut.Append("<td>" + (PastPassCourseNum) + "</td>");
                        if (PastPassCourseNum == 0)
                        {
                            TextOut.Append("<td>0</td>");
                        }
                        else
                        {
                            TextOut.Append("<td>" + ((double)PastPassCourseNum / (double)WeekCourseNum).ToString("P") + "</td>");
                        }
                    }

                    //统计好学生 学习课程超过30门的人
                    if (PerCourseNum >= 30)
                    {
                        GoodStudent += " " + Info.RealName;
                    }

                    //统计通过课程数量第一的数据
                    if (PerPassCourseNum > 0 && PerPassCourseNum >= FirstPassCourseNum)
                    {
                        if (PerPassCourseNum > FirstPassCourseNum)
                        {
                            PassCourseFirstUser = Info.RealName;
                            FirstPassCourseNum  = PerPassCourseNum;
                        }
                        else
                        {
                            PassCourseFirstUser = PassCourseFirstUser + " " + Info.RealName;
                        }
                    }
                    TextOut.Append("<td>" + PerCourseNum + "</td>");
                    TextOut.Append("<td>" + PerPassCourseNum + "</td>");
                    if (PerCourseNum <= 0)
                    {
                        TextOut.Append("<td>0</td>");
                    }
                    else
                    {
                        TextOut.Append("<td>" + ((double)PerPassCourseNum / (double)PerCourseNum).ToString("P") + "</td>");
                    }
                    TextOut.Append("<td>" + (AllPassCourseNum) + "</td>");
                    TextOut.Append("<td>" + (TargetNum) + "</td>");
                    TargetNum = AllPassCourseNum - TargetNum;
                    TextOut.Append("<td style=\"");
                    if (TargetNum > 0)
                    {
                        TextOut.Append("background: #00b050;");
                        GreenNum += 1;
                    }
                    else if (TargetNum < 0)
                    {
                        TextOut.Append("background: #ff0000;");
                        RedNum += 1;
                    }
                    else
                    {
                        TextOut.Append("background: #ffff00;");
                        YellowNum += 1;
                    }
                    TextOut.Append(" color:#000;\">" + (TargetNum) + "</td>");
                    TextOut.Append("</tr>\r\n");

                    currentUserPaperList     = null;
                    currentUserPassPaperList = null;
                }
                PostModel = null;
            }
            TestPaperList = null;

            //集团性质不显示总结描述
            if (TotalTable == null)
            {
                if (FirstPassCourseNum > 0)
                {
                    TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">课程考试通过数量最多的学霸为: <font color=red>" + PassCourseFirstUser + "</font>  ,数量为: <font color=red>" + FirstPassCourseNum.ToString() + "</font> 。</th></tr>");
                }
                if (!string.IsNullOrEmpty(GoodStudent))
                {
                    TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">月度考试数量超过30门的为好学生,此次好学生为: <font color=red>" + GoodStudent + "</font> 。</th></tr>");
                }
                TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 刚好达标人数:" + YellowNum.ToString() + " 超越目标人数:" + GreenNum.ToString() + "</th></tr>");
                TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 达标人数:" + (YellowNum + GreenNum).ToString() + " 达成率:" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</th></tr>");
            }

            //生成集团报表内容
            if (TotalTable != null)
            {
                //集团报表内容开始
                groupResult[1] = (int)groupResult[1] + PeoperNum;
                groupResult[2] = (int)groupResult[2] + (YellowNum + GreenNum);
                groupResult[3] = (int)groupResult[3] + RedNum;
                if (((double)(YellowNum + GreenNum) / (double)PeoperNum) == 1.0)
                {
                    groupResult[4] = groupResult[4] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>";
                }
                else if (((double)(YellowNum + GreenNum) / (double)PeoperNum) < 0.7)
                {
                    groupResult[5] = groupResult[5] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>";
                }
                //GroupResult[4] += ((double)(YellowNum + GreenNum) / (double)PeoperNum);
                if (FirstPassCourseNum > 0 && FirstPassCourseNum >= (int)groupResult[7])
                {
                    if (FirstPassCourseNum == (int)groupResult[7])
                    {
                        groupResult[6] = string.IsNullOrEmpty(groupResult[6].ToString()) ? PassCourseFirstUser : groupResult[6] + " " + PassCourseFirstUser;
                    }
                    else
                    {
                        groupResult[6] = PassCourseFirstUser;
                        groupResult[7] = FirstPassCourseNum;
                    }
                }
                TotalTable.AppendLine("<tr class=\"listTableMain\"><td>" + company.CompanySimpleName + "</td><td>" + PeoperNum + "</td><td>" + (YellowNum + GreenNum).ToString() + "</td><td>" + RedNum.ToString() + "</td><td>" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</td><td>" + PassCourseFirstUser + "</td><td>" + FirstPassCourseNum.ToString() + "</td></tr>");
            }
            return(TextOut.ToString());
        }
Ejemplo n.º 22
0
        protected void HtmlOut()
        {
            //Table表头在后面插入
            ReportContentHtml.Append(Company.CompanySimpleName);
            ReportContentHtml.Append(" [ 截止到:" + EndDate.ToString("d") + " ]");
            ReportContentHtml.AppendLine("</th></tr>");
            ReportContentHtml.AppendLine("</tr>");
            ReportContentHtml.AppendLine("<tr>");
            ReportContentHtml.AppendLine("<th colspan=\"3\">部门/岗位</th>");

            //岗位数组
            ArrayList postArray = new ArrayList();
            //需要再次展开的岗位
            ArrayList postExpandArray = new ArrayList();

            foreach (PostInfo Info in PostBLL.ReadParentPostListByPostId(Company.Post))
            {
                List <PostInfo> sonPostList  = PostBLL.FilterPostListByParentID(PostList, Info.PostId);
                int             sonPostCount = sonPostList.Count;
                if (sonPostCount > 1)
                {
                    postArray.Add(Info.PostId);
                    postExpandArray.Add(Info.PostId);
                    ReportContentHtml.AppendLine("<th colspan=\"" + sonPostCount.ToString() + "\">" + Info.PostName + "</th>");
                }
                else
                {
                    ReportContentHtml.AppendLine("<th rowspan=\"2\" class=\"outside\"><div class=\"inside\">" + Info.PostName + "</div></th>");
                    if (sonPostCount == 1)
                    {
                        foreach (PostInfo Item in sonPostList)
                        {
                            postArray.Add(Item.PostId);
                        }
                    }
                    else
                    {
                        postArray.Add(Info.PostId);
                    }
                }
            }

            ReportContentHtml.AppendLine("</tr>");
            ReportContentHtml.AppendLine("<tr class=\"hoverwhite\">");
            ReportContentHtml.AppendLine("<td class=\"id\">序号</td>");
            ReportContentHtml.AppendLine("<td class=\"name\">员工名称</td>");
            ReportContentHtml.AppendLine("<td class=\"post\">在职岗位</td>");
            foreach (int item in postExpandArray)
            {
                ArrayList tempArray = new ArrayList();
                foreach (PostInfo info in PostBLL.FilterPostListByParentID(PostList, item))
                {
                    ReportContentHtml.AppendLine("<td class=\"outside\"><div class=\"inside\">" + info.PostName + "</div></td>");
                    tempArray.Add(info.PostId);
                }
                int insertPos = postArray.IndexOf(item);
                postArray.RemoveAt(insertPos);
                postArray.InsertRange(insertPos, tempArray);
            }
            ReportContentHtml.AppendLine("</tr>");

            //取得列数,插入表头
            ReportContentHtml.Insert(0, "<table class=\"evaluation_sheet\"><tr><th colspan=\"" + (3 + postArray.Count) + "\">");

            int PNum = 0;
            //定义一个数组,用来存放每个人通过的岗位数
            string PassPostTotal = "|";

            UserSearchInfo userSearch = new UserSearchInfo();

            userSearch.InCompanyID   = CompanyID.ToString();
            userSearch.InStatus      = (int)UserState.Normal + "," + (int)UserState.Free;
            userSearch.InStudyPostID = PostIdCondition;
            List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch);

            foreach (UserInfo user in userList)
            {
                PNum += 1;

                PostPassInfo postPassSearch = new PostPassInfo();
                postPassSearch.UserId     = user.ID;
                postPassSearch.IsRZ       = 1;
                postPassSearch.CreateDate = ShopCommon.SearchEndDate(EndDate);
                //读取通过的岗位
                string PassPost = PostPassBLL.PassPostString(postPassSearch);
                //读取岗位学完但认证没过的名单
                postPassSearch.IsRZ = 0;
                string NoPassPost = PostPassBLL.PassPostString(postPassSearch);

                string WorkPostName = string.Empty;

                //取得工作岗位
                if (string.IsNullOrEmpty(user.PostName))
                {
                    WorkPostName = PostBLL.ReadPost(user.WorkingPostID).PostName;
                }
                else
                {
                    WorkPostName = user.PostName;
                }

                ReportContentHtml.AppendLine("<tr data-style=\"data\">");
                ReportContentHtml.AppendLine("<td>" + PNum.ToString() + "</td>");
                ReportContentHtml.AppendLine("<td>" + user.RealName + "</td>");
                ReportContentHtml.AppendLine("<td>" + WorkPostName + "</td>");
                int PassPostNum = 0;
                foreach (int Item in postArray)
                {
                    if (StringHelper.CompareSingleString(PassPost, Item.ToString()))
                    {
                        PassPostNum += 1;
                        ReportContentHtml.AppendLine("<td class=\"style1\">●</td>");
                    }
                    else if (StringHelper.CompareSingleString(NoPassPost, Item.ToString()))
                    {
                        ReportContentHtml.AppendLine("<td class=\"style2\">○</td>");
                    }
                    else if (Item.ToString() == user.StudyPostID.ToString())
                    {
                        ReportContentHtml.AppendLine("<td class=\"style3\">○</td>");
                    }
                    else
                    {
                        ReportContentHtml.AppendLine("<td>&nbsp;</td>");
                    }
                }
                if (PassPostNum > 0)
                {
                    PassPostTotal += PassPostNum.ToString() + "|";
                }
                ReportContentHtml.AppendLine("</tr>");
            }
            ReportContentHtml.AppendLine("</table>");

            //统计通过几个岗位的人数
            if (PassPostTotal.Length > 1)
            {
                ReportContentHtml.AppendLine("<table class=\"evaluation_sheet count\">");
                for (int i = 1; i < postArray.Count + 1; i++)
                {
                    if (PassPostTotal.Contains("|" + i + "|"))
                    {
                        ReportContentHtml.AppendLine("<tr>");
                        ReportContentHtml.AppendLine("<td>通过" + i.ToString() + "个岗位的人数为:");
                        int PerNum = 0;
                        foreach (string Item in PassPostTotal.Split('|'))
                        {
                            if (Item == i.ToString())
                            {
                                PerNum += 1;
                            }
                        }
                        ReportContentHtml.AppendLine(PerNum.ToString() + "</td>");
                        ReportContentHtml.AppendLine("</tr>");
                    }
                }
                ReportContentHtml.AppendLine("</table>");
            }
        }
Ejemplo n.º 23
0
        //private List<PostCateInfo> ConvertToPostCate(List<PostInfo> PostList, bool ChildList)
        //{
        //    List<PostCateInfo> PostCateList = new List<PostCateInfo>();
        //    if (PostList != null)
        //    {
        //        foreach (PostInfo Info in PostList)
        //        {
        //            PostCateInfo PostCateModel = new PostCateInfo();
        //            PostCateModel.EncryptFcateID = Info.PostId.ToString();
        //            PostCateModel.Title = Info.PostName;
        //            if (ChildList) PostCateModel.ChildCourseFCateView = ConvertToPostCate(PostBLL.ReadPostList(Info.PostId), false);
        //            PostCateList.Add(PostCateModel);
        //        }
        //    }
        //    return PostCateList;
        //}

        private List <MCourseInfo> GetCourseList()
        {
            int postID   = RequestHelper.GetForm <int>("postID");
            int page     = RequestHelper.GetForm <int>("pageIndex");
            int pageSize = RequestHelper.GetForm <int>("pageSize");
            int classID  = RequestHelper.GetForm <int>("classID");

            if (pageSize <= 0)
            {
                pageSize = base.PageSize;
            }
            List <MCourseInfo> CourseList = new List <MCourseInfo>();
            int    userID          = base.UserID;
            string prepaidCourseId = BLLMTestCate.ReadPrepaidTestCate(userID);

            if (postID < 0)
            {
                postID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"));
            }

            List <ProductInfo> productList      = new List <ProductInfo>();
            string             inProductID      = PostBLL.ReadPostCourseID(base.UserCompanyID, postID);
            string             passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1));

            inProductID = StringHelper.SubString(inProductID, passPostCourseID);
            ProductSearchInfo productSearch = new ProductSearchInfo();

            if (!string.IsNullOrEmpty(inProductID))
            {
                productSearch.InProductID = inProductID;
                productSearch.IsSale      = 1;
                if (classID > 0)
                {
                    productSearch.ClassID = "|" + classID + "|";
                }
                productSearch.OrderField = "[IsTop],[ClassID],[Sort],[ID]";
                productList = ProductBLL.SearchProductList(page, pageSize, productSearch, ref base.Count);
            }

            int pageCount = (int)Math.Ceiling((double)base.Count / pageSize);

            //加载选修课程(岗位课程罗列完成后,再加载选修)
            if ((classID < 0 || classID == 6) && (page == pageCount) && StringHelper.CompareSingleString("4,5,64", UserBLL.ReadUser(base.UserID).StudyPostID.ToString()))
            {
                productSearch.InProductID = string.Empty;
                productSearch.ClassID     = "|6|";
                productSearch.InBrandID   = base.CompanyBrandID;
                productSearch.NotLikeName = "必修";
                productSearch.IsSale      = 1;
                productList.AddRange(ProductBLL.SearchProductList(productSearch));
            }

            //加载认证考试
            if ((classID < 0 && page == 1) || classID == 4387)
            {
                PostPassInfo passpost = new PostPassInfo();
                passpost.UserId = base.UserID;
                passpost.IsRZ   = 0;

                RenZhengCateInfo rzCate = new RenZhengCateInfo();
                rzCate.InPostID = PostPassBLL.PassPostString(passpost);
                string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate);
                if (!string.IsNullOrEmpty(rzProductID))
                {
                    productSearch.InProductID = rzProductID;
                    productSearch.ClassID     = string.Empty;
                    productSearch.InBrandID   = base.CompanyBrandID;
                    productSearch.NotLikeName = string.Empty;
                    productSearch.IsSale      = 1;
                    productList.InsertRange(0, ProductBLL.SearchProductList(productSearch));
                }
            }

            //加载大课件
            if ((classID < 0 && page == 1) || classID == 5298)
            {
                productSearch.InProductID = string.Empty;
                productSearch.InBrandID   = string.Empty;
                productSearch.NotLikeName = string.Empty;
                productSearch.IsSale      = 1;
                productSearch.ClassID     = "|5298|";
                productList.InsertRange(0, ProductBLL.SearchProductList(productSearch));
            }

            //加载指定时间考试
            if (classID < 0 && page == 1)
            {
                string parentCompanyID = base.ParentCompanyID;
                if (string.IsNullOrEmpty(parentCompanyID))
                {
                    parentCompanyID = base.UserCompanyID.ToString();
                }
                else
                {
                    parentCompanyID += "," + base.UserCompanyID.ToString();
                }
                List <TestSettingInfo> specialTestList = TestSettingBLL.ReadSpecialTestList(parentCompanyID);
                if (specialTestList.Count > 0)
                {
                    string specialCourseID = TestSettingBLL.ReadSpecialTestCourseID(specialTestList);
                    if (!string.IsNullOrEmpty(specialCourseID))
                    {
                        productSearch.InProductID = specialCourseID;
                        productSearch.ClassID     = string.Empty;
                        productSearch.InBrandID   = base.CompanyBrandID;
                        productSearch.NotLikeName = string.Empty;
                        productSearch.IsSale      = 1;
                        List <ProductInfo> specialProductList = ProductBLL.SearchProductList(productSearch);
                        productList.InsertRange(0, specialProductList);
                    }
                }
            }

            //重新获取产品ID串
            inProductID      = ProductBLL.ReadProductIdStr(productList);
            passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1));

            //获取未通过的最新记录
            string noPassCourseID = StringHelper.SubString(inProductID, passPostCourseID);
            List <TestPaperReportInfo> noPassTestPaperList = string.IsNullOrEmpty(noPassCourseID) ? new List <TestPaperReportInfo>() : TestPaperBLL.ReadThelatestList(base.UserID, noPassCourseID);

            List <AttributeRecordInfo> attributeRecordList = AttributeRecordBLL.ReadList("5", noPassCourseID);

            foreach (ProductInfo Info in productList)
            {
                //通过的课程不用显示
                //if (!StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString()))
                {
                    TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(base.UserCompanyID, Info.ID);

                    MCourseInfo CourseModel = new MCourseInfo();
                    CourseModel.ClassID   = Info.ID.ToString();
                    CourseModel.Title     = Info.Name;
                    CourseModel.IsPass    = false;
                    CourseModel.PageCount = pageCount;
                    TestPaperReportInfo currentPaper = noPassTestPaperList.Find(delegate(TestPaperReportInfo tempPaper) { return(tempPaper.CourseID == Info.ID); });
                    if (currentPaper != null)
                    {
                        //剩余时间
                        int remainingTime = (testSetting.TestInterval - (int)(DateTime.Now - currentPaper.TestDate).TotalHours);
                        CourseModel.ValidDateShow = remainingTime > 0 ? remainingTime.ToString() : "";
                    }
                    CourseModel.OriginalPrice = Info.MarketPrice.ToString();
                    if (!string.IsNullOrEmpty(Info.ProductNumber))
                    {
                        CourseModel.IsVideo = true;
                    }

                    if (!string.IsNullOrEmpty(Info.Accessory))
                    {
                        CourseModel.IsTest = true;

                        //通过的课程不用再考
                        if (StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString()))
                        {
                            CourseModel.IsTest = false;
                        }

                        if (testSetting != null && (testSetting.TestStartTime != null || testSetting.TestEndTime != null))
                        {
                            //指定时间考试考过了就不要再考了
                            if (!string.IsNullOrEmpty(CourseModel.ValidDateShow))
                            {
                                CourseModel.IsTest = false;
                            }
                            if (DateTime.Now < testSetting.TestStartTime || DateTime.Now > testSetting.TestEndTime)
                            {
                                CourseModel.IsTest = false;
                            }
                        }
                    }
                    CourseModel.IsPostCourse    = true;
                    CourseModel.IsPrepaidCourse = StringHelper.CompareSingleString(prepaidCourseId, Info.ID.ToString());

                    //产品知识 练车剧本地址
                    {
                        CourseModel.RCUrl = AttributeRecordBLL.ReadAttributeRecord(attributeRecordList, 5, Info.ID).Value;
                        if (!string.IsNullOrEmpty(CourseModel.RCUrl))
                        {
                            CourseModel.IsRC = true;
                        }
                    }
                    CourseList.Add(CourseModel);
                }
            }
            return(CourseList);
        }
Ejemplo n.º 24
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "综合情况统计表";
            base.CheckUserPower("ReadEMSReport", PowerCheckType.Single);

            if (!base.ExistsSonCompany || Action == "Search" || !base.CompareUserPower("ManageGroupCompany", PowerCheckType.Single))
            {
                if (EndDate == DateTime.MinValue)
                {
                    EndDate = DateTime.Today;
                }
                List <CompanyInfo> sonCompanyList = new List <CompanyInfo>();
                if (CompanyID <= 0)
                {
                    CompanyID = base.UserCompanyID;
                }

                CompanyModel = CompanyBLL.ReadCompany(CompanyID);

                if (base.CompareUserPower("ManageGroupCompany", PowerCheckType.Single))
                {
                    //减少使用递归方法的频率
                    if (CompanyID != base.UserCompanyID)
                    {
                        sonCompanyList = CompanyBLL.ReadCompanyListByCompanyId(CompanyBLL.ReadCompanyIdList(CompanyID.ToString()));
                    }
                    else
                    {
                        sonCompanyList = base.SonCompanyList;
                    }
                }
                else
                {
                    sonCompanyList.Add(CompanyModel);
                }

                int           AllPassCourseNum = 0, AllCourseNum = 0, AllUserNum = 0, TotalNum = 0, CompanyNum = 0;
                double        PassAverage = 0.0, PerPassAverage = 0.0, PerAllAverage = 0.0;
                string        NoPassCompanyName = string.Empty, AverageCourseNumCompanyName = string.Empty;
                StringBuilder MonthOut = new StringBuilder();

                MonthOut.Append("<table class=\"evaluation_sheet\">");
                MonthOut.Append("<tr><th colspan=\"11\">" + CompanyModel.CompanyName + " 在职人员数据统计 [");
                if (StartDate != DateTime.MinValue)
                {
                    MonthOut.Append("从" + StartDate.ToString("d"));
                }
                else
                {
                    MonthOut.Append("从项目启动");
                }
                MonthOut.Append("到" + EndDate.ToString("d") + "]</th></tr>");
                MonthOut.Append("<tr>");
                MonthOut.Append("<th>店名</th>");
                MonthOut.Append("<th>项目启动时间</th>");
                MonthOut.Append("<th>系统登记<br />人数</th>");
                MonthOut.Append("<th>累计参加<br />考试人数</th>");
                MonthOut.Append("<th>累计学习<br />考试次数</th>");
                MonthOut.Append("<th>考试通过<br />课程数量</th>");
                MonthOut.Append("<th>人均学习<br />课程数量</th>");
                MonthOut.Append("<th>人均通过<br />课程数量</th>");
                MonthOut.Append("<th>参考人员<br />人均学习<br />课程数量</th>");
                MonthOut.Append("<th>参考人员<br />人均通过<br />课程数量</th>");
                MonthOut.Append("<th>课程考试<br />通过率</th>");
                MonthOut.Append("</tr>");
                EndDate = EndDate.AddDays(1);

                foreach (CompanyInfo _CompanyModel in sonCompanyList)
                {
                    if (_CompanyModel.CompanyId != CompanyID || !base.IsGroupCompany(_CompanyModel.GroupId))
                    {
                        if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < EndDate)
                        {
                            string         UserId = string.Empty;
                            int            PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0;
                            UserSearchInfo userSearch = new UserSearchInfo();
                            userSearch.InCompanyID   = _CompanyModel.CompanyId.ToString();
                            userSearch.StatusNoEqual = (int)UserState.Del;
                            //userSearch.GroupId = 36;
                            List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch);
                            Num = userList.Count;
                            //应考人数(去除在待考分组的人)
                            //int YKNum = userList.FindAll(delegate(UserInfo TempModel) { return TempModel.Status == (int)UserState.Normal; }).Count;
                            //Num = YKNum;

                            TestPaperInfo TestPaperModel = new TestPaperInfo();
                            TestPaperModel.TestMinDate        = StartDate;
                            TestPaperModel.TestMaxDate        = EndDate;
                            TestPaperModel.UserIdCondition    = UserBLL.ReadUserIdStr(userList);
                            TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString();
                            List <TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel);
                            foreach (TestPaperInfo Info in TempList)
                            {
                                if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString()))
                                {
                                    UserId += "," + Info.UserId.ToString();
                                }
                                if (Info.IsPass == 1)
                                {
                                    PassCourseNum += 1;
                                }
                            }
                            if (UserId.StartsWith(","))
                            {
                                UserId = UserId.Substring(1);
                            }
                            if (string.IsNullOrEmpty(UserId))
                            {
                                UserNum = 0;
                            }
                            else
                            {
                                UserNum = UserId.Split(',').Length;
                            }
                            CourseNum = TempList.Count;

                            double SinglePassRate; //单店课程通过率
                            if (CourseNum == 0)
                            {
                                SinglePassRate = 0;
                            }
                            else
                            {
                                SinglePassRate = (double)PassCourseNum / (double)CourseNum;
                            }

                            if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID)
                            {
                                CompanyNum       += 1;             //通过率大于22%的公司数量
                                TotalNum         += Num;           //总人数
                                AllUserNum       += UserNum;       //总参加考试人数
                                AllCourseNum     += CourseNum;     //总考试课程数
                                AllPassCourseNum += PassCourseNum; //总通过考试课程数
                            }
                            else
                            {
                                NoPassCompanyName += _CompanyModel.CompanySimpleName + " ";
                            }

                            MonthOut.Append("<tr>");
                            MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>");
                            MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>");
                            MonthOut.Append("<td>" + Num.ToString() + "</td>");
                            MonthOut.Append("<td>" + UserNum.ToString() + "</td>");
                            MonthOut.Append("<td>" + CourseNum + "</td>");
                            MonthOut.Append("<td>" + PassCourseNum + "</td>");
                            if (Num == 0)
                            {
                                MonthOut.Append("<td>0</td>");
                                MonthOut.Append("<td>0</td>");
                            }
                            else
                            {
                                if (StartDate == DateTime.MinValue || (EndDate - StartDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2)
                                {
                                    MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                                }
                                else
                                {
                                    AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " ";
                                    MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                                }
                                MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>");
                                if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID)
                                {
                                    PerAllAverage  += Math.Round(((double)CourseNum / Num), 1);
                                    PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1);
                                }
                            }
                            //计算参考人员人均值
                            if (UserNum == 0)
                            {
                                MonthOut.Append("<td>0</td>");
                                MonthOut.Append("<td>0</td>");
                            }
                            else
                            {
                                MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>");
                                MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>");
                            }
                            if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID)
                            {
                                MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>");
                                PassAverage += SinglePassRate;
                            }
                            else
                            {
                                MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>");
                            }
                            MonthOut.Append("</tr>");
                        }
                    }
                }
                MonthOut.Append("<tr>");
                MonthOut.Append("<td colspan=\"2\">" + CompanyModel.CompanySimpleName + "有效学习合计</td>");
                MonthOut.Append("<td>" + TotalNum.ToString() + "</td>");
                MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>");
                MonthOut.Append("<td>" + AllCourseNum + "</td>");
                MonthOut.Append("<td>" + AllPassCourseNum + "</td>");
                if (TotalNum == 0)
                {
                    MonthOut.Append("<td>0</td>");
                    MonthOut.Append("<td>0</td>");
                }
                else
                {
                    //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>");
                    //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>");
                    //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>");
                    MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>");
                    MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>");
                }
                if (AllUserNum == 0)
                {
                    MonthOut.Append("<td>0</td>");
                    MonthOut.Append("<td>0</td>");
                }
                else
                {
                    MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>");
                    MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>");
                }
                if (AllCourseNum == 0)
                {
                    MonthOut.Append("<td>0</td>");
                }
                else
                {
                    MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>");
                }
                MonthOut.Append("</tr>");
                MonthOut.Append("</table>");
                MonthOut.Insert(0, "在孟特EMS考试系统中进行有效学习的人数为 <span style=\"color:#FF0000;\">" + TotalNum.ToString() + " 人</span></li><li>累计进行了 <span style=\"color:#FF0000;\">" + AllCourseNum.ToString() + " 次</span>课程的学习,人均进行了 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>课程考试</li><li>其中学习通过 <span style=\"color:#FF0000;\">" + AllPassCourseNum + " 门</span>课程考试,人均通过 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + " 门</span>课程</li><li>课程学习的考试通过率为 <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span></li></ul>");

                MonthOut.Insert(0, "到" + EndDate.AddDays(-1).ToString("d"));
                if (StartDate != DateTime.MinValue)
                {
                    MonthOut.Insert(0, "从" + StartDate.ToString("d"));
                }
                else
                {
                    MonthOut.Insert(0, "从项目启动");
                }
                if (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)
                {
                    MonthOut.Insert(0, "集团");
                }
                else
                {
                    MonthOut.Insert(0, "贵司");
                }
                MonthOut.Insert(0, "<ul class=\"ReportList_count\"><li>");

                MonthOut.Append("<ul class=\"ReportList_count\"><li><font color=\"red\">人均学习课程数量:</font>代表团队对学习重视的程度,越高代表越重视学习,建议<span style=\"color:#FF0000;\">不低于每周人均2.2门课程,每月人均8.5门课程</span>,低于指标者请部门领导对学习加大关注。</li>");
                if (StartDate != DateTime.MinValue && (EndDate - StartDate).Days <= 7 && !string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2))
                {
                    MonthOut.Append("<li style=\"color:#3366ff;\">目前人均学习数量低于每周人均2.2门课程的团队有:<span style=\"color:#FF0000;\">" + AverageCourseNumCompanyName + "</span>;请相关领导予以关注。</li>");
                    // else if (string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2))
                    MonthOut.Append("<li style=\"color:#3366ff;\">目前有效人均学习数量为:  <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>,");
                    if (Math.Round(((double)AllCourseNum / TotalNum), 1) >= 2.2)
                    {
                        MonthOut.Append("表现良好,请再接再厉。</li>");
                    }
                    else
                    {
                        MonthOut.Append("请相关领导予以关注。</li>");
                    }
                }
                MonthOut.Append("<li><font color=\"red\">课程考试通过率:</font>通过率高代表团队学习认真,若<span style=\"color:#FF0000;\">通过率低于22%</span>,表示学员没有学习课程,只是通过不断考试来<span style=\"color:#FF0000;\">试图懵过考核</span>,请部门领导制止不当的学习行为。</li>");
                if (!string.IsNullOrEmpty(NoPassCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2))
                {
                    MonthOut.Append("<li style=\"color:#3366ff;\">目前通过率低于22%的团队有: <span style=\"color:#FF0000;\">" + NoPassCompanyName + "</span>,请相关领导予以关注,以上4S店视为无效学习,全部数据不列入集团学习效果统计。</li>");
                }
                else if (string.IsNullOrEmpty(NoPassCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2))
                {
                    MonthOut.Append("<li style=\"color:#3366ff; \">目前通过率为: <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span>,表现良好,请再接再厉。</li>");
                }
                MonthOut.Append("</ul>");

                //添加通过岗位报表
                MonthOut.Append("<div class=\"split_line\"></div>");
                MonthOut.Append("<table class=\"evaluation_sheet\">");
                MonthOut.Append("<tr><th colspan=\"9\">" + CompanyModel.CompanyName + " 岗位资质认证统计 [");
                if (StartDate != DateTime.MinValue)
                {
                    MonthOut.Append("从" + StartDate.ToString("d"));
                }
                else
                {
                    MonthOut.Append("从项目启动");
                }
                MonthOut.Append("到" + EndDate.AddDays(-1).ToString("d") + "]</th></tr>");
                MonthOut.Append("<tr>");
                MonthOut.Append("<th>店名</th>");
                MonthOut.Append("<th>姓名</th>");
                MonthOut.Append("<th>在职岗位</th>");
                MonthOut.Append("<th>已通过的<br />认证岗位</th>");
                //MonthOut.Append("<th>岗位考核<br />课程数量</th>");
                MonthOut.Append("<th>累计通过<br />岗位数量</th>");
                MonthOut.Append("<th>目前正在<br />学习岗位</th>");
                MonthOut.Append("</tr>");
                foreach (CompanyInfo _CompanyModel in sonCompanyList)
                {
                    if (_CompanyModel.State != 0)
                    {
                        continue;
                    }
                    if (_CompanyModel.CompanyId != CompanyID || !base.IsGroupCompany(_CompanyModel.GroupId))
                    {
                        PostPassInfo PostPassModel = new PostPassInfo();
                        PostPassModel.SearchStartDate = StartDate;
                        PostPassModel.CreateDate      = EndDate;
                        List <ReportPostPassInfo> PostPassList = PostPassBLL.PostPassReportList(PostPassModel, _CompanyModel.CompanyId.ToString());
                        foreach (ReportPostPassInfo Info in PostPassList)
                        {
                            MonthOut.Append("<tr>");
                            MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>");
                            MonthOut.Append("<td>" + Info.RealName + "</td>");
                            if (string.IsNullOrEmpty(Info.WorkingPostName))
                            {
                                MonthOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostId).PostName + "</td>");
                            }
                            else
                            {
                                MonthOut.Append("<td>" + Info.WorkingPostName + "</td>");
                            }
                            MonthOut.Append("<td>" + Info.PassPostName + "</td>");
                            MonthOut.Append("<td>" + Info.PassPostNum.ToString() + "</td>");
                            MonthOut.Append("<td>" + PostBLL.ReadPost(Info.StudyPostId).PostName + "</td>");
                            MonthOut.Append("</tr>");
                        }
                    }
                }
                MonthOut.Append("</table>");

                ReportContentHtml  = MonthOut.ToString();
                ReportContentHtml += HistoryData(sonCompanyList, EndDate);
            }
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //设置默认值
                if (string.IsNullOrEmpty(action))
                {
                    groupID = "36";
                    state   = ((int)UserState.Normal).ToString();
                }
                if (action == "search" && companyID > 0)
                {
                    startDate            = RequestHelper.GetQueryString <DateTime>("SearchStartDate");
                    endDate              = RequestHelper.GetQueryString <DateTime>("SearchEndDate");
                    SearchStartDate.Text = startDate.ToString("d");
                    SearchEndDate.Text   = endDate.ToString("d");
                    companyModel         = CompanyBLL.ReadCompany(companyID);
                    companyName          = companyModel.CompanyName;

                    CompanyInfo companySearch = new CompanyInfo();
                    companySearch.Field            = "CompanyId";
                    companySearch.Condition        = CompanyBLL.ReadCompanyIdList(companyID.ToString());
                    companySearch.State            = 0;
                    companySearch.GroupIdCondition = "0,3";
                    List <CompanyInfo> companyList = CompanyBLL.ReadCompanyList(companySearch);

                    //有效学习统计开始
                    int    AllPassCourseNum = 0, AllCourseNum = 0, AllUserNum = 0, TotalNum = 0, CompanyNum = 0;
                    double PassAverage = 0.0, PerPassAverage = 0.0, PerAllAverage = 0.0;
                    string NoPassCompanyName = string.Empty, AverageCourseNumCompanyName = string.Empty;

                    StringBuilder MonthOut = new StringBuilder();
                    MonthOut.Append("<table class=\"listTable\">");
                    MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"11\">" + companyModel.CompanyName + " 人员数据统计[");
                    if (startDate != DateTime.MinValue)
                    {
                        MonthOut.Append("从" + startDate.ToString("d"));
                    }
                    else
                    {
                        MonthOut.Append("从项目启动");
                    }
                    MonthOut.Append("到" + endDate.ToString("d") + "]</td></tr>");
                    MonthOut.Append("<tr class=\"listTableHead\">");
                    MonthOut.Append("<td>店名</td>");
                    MonthOut.Append("<td>项目启动时间</td>");
                    MonthOut.Append("<td>系统登记<br />应考人数</td>");
                    MonthOut.Append("<td>累计参加<br />考试人数</td>");
                    MonthOut.Append("<td>累计学习<br />考试次数</td>");
                    MonthOut.Append("<td>考试通过<br />课程数量</td>");
                    MonthOut.Append("<td>人均学习<br />课程数量</td>");
                    MonthOut.Append("<td>人均通过<br />课程数量</td>");
                    MonthOut.Append("<td>参考人员<br />人均学习<br />课程数量</td>");
                    MonthOut.Append("<td>参考人员<br />人均通过<br />课程数量</td>");
                    MonthOut.Append("<td>课程考试<br />通过率</td>");
                    MonthOut.Append("</tr>");

                    endDate = endDate.AddDays(1);
                    foreach (CompanyInfo _CompanyModel in companyList)
                    {
                        if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < endDate)
                        {
                            int            PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0;
                            UserSearchInfo userSearch = new UserSearchInfo();
                            userSearch.InCompanyID     = _CompanyModel.CompanyId.ToString();
                            userSearch.InStatus        = state;
                            userSearch.InGroupID       = groupID;
                            userSearch.InWorkingPostID = postIdCondition;
                            userSearch.InStudyPostID   = studyPostIdCondition;
                            List <UserInfo> userList = UserBLL.SearchUserList(userSearch);
                            Num = userList.Count;

                            TestPaperInfo TestPaperModel = new TestPaperInfo();
                            TestPaperModel.TestMinDate        = startDate;
                            TestPaperModel.TestMaxDate        = endDate;
                            TestPaperModel.UserIdCondition    = UserBLL.ReadUserIdStr(userList);
                            TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString();
                            List <TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel);
                            string UserId = string.Empty;
                            foreach (TestPaperInfo Info in TempList)
                            {
                                if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString()))
                                {
                                    UserId += "," + Info.UserId.ToString();
                                }
                                if (Info.IsPass == 1)
                                {
                                    PassCourseNum += 1;
                                }
                            }
                            if (UserId.StartsWith(","))
                            {
                                UserId = UserId.Substring(1);
                            }
                            if (string.IsNullOrEmpty(UserId))
                            {
                                UserNum = 0;
                            }
                            else
                            {
                                UserNum = UserId.Split(',').Length;
                            }

                            CourseNum = TempList.Count;
                            double SinglePassRate; //单店课程通过率
                            if (CourseNum == 0)
                            {
                                SinglePassRate = 0;
                            }
                            else
                            {
                                SinglePassRate = (double)PassCourseNum / (double)CourseNum;
                            }

                            if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                            {
                                CompanyNum       += 1;             //通过率大于22%的公司数量
                                TotalNum         += Num;           //总人数
                                AllUserNum       += UserNum;       //总参加考试人数
                                AllCourseNum     += CourseNum;     //总考试课程数
                                AllPassCourseNum += PassCourseNum; //总通过考试课程数
                            }
                            else
                            {
                                NoPassCompanyName += _CompanyModel.CompanySimpleName + " ";
                            }

                            MonthOut.Append("<tr class=\"listTableMain\">");
                            MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>");
                            MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>");
                            MonthOut.Append("<td>" + Num.ToString() + "</td>");
                            MonthOut.Append("<td>" + UserNum.ToString() + "</td>");
                            MonthOut.Append("<td>" + CourseNum + "</td>");
                            MonthOut.Append("<td>" + PassCourseNum + "</td>");
                            if (Num == 0)
                            {
                                MonthOut.Append("<td>0</td>");
                                MonthOut.Append("<td>0</td>");
                            }
                            else
                            {
                                if (startDate == DateTime.MinValue || (endDate - startDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2)
                                {
                                    MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                                }
                                else
                                {
                                    AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " ";
                                    MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                                }
                                MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>");
                                if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                                {
                                    PerAllAverage  += Math.Round(((double)CourseNum / Num), 1);
                                    PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1);
                                }
                            }
                            //计算参考人员人均值
                            if (UserNum == 0)
                            {
                                MonthOut.Append("<td>0</td>");
                                MonthOut.Append("<td>0</td>");
                            }
                            else
                            {
                                MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>");
                                MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>");
                            }
                            if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                            {
                                MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>");
                                PassAverage += SinglePassRate;
                            }
                            else
                            {
                                MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>");
                            }
                            MonthOut.Append("</tr>");
                        }
                    }
                    MonthOut.Append("<tr class=\"listTableHead\">");
                    MonthOut.Append("<td colspan=\"2\">" + companyModel.CompanySimpleName + "有效学习合计</td>");
                    MonthOut.Append("<td>" + TotalNum.ToString() + "</td>");
                    MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>");
                    MonthOut.Append("<td>" + AllCourseNum + "</td>");
                    MonthOut.Append("<td>" + AllPassCourseNum + "</td>");
                    if (TotalNum == 0)
                    {
                        MonthOut.Append("<td>0</td>");
                        MonthOut.Append("<td>0</td>");
                    }
                    else
                    {
                        //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>");
                        //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>");
                        //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>");
                        MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>");
                        MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>");
                    }
                    if (AllUserNum == 0)
                    {
                        MonthOut.Append("<td>0</td>");
                        MonthOut.Append("<td>0</td>");
                    }
                    else
                    {
                        MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>");
                        MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>");
                    }
                    if (AllCourseNum == 0)
                    {
                        MonthOut.Append("<td>0</td>");
                    }
                    else
                    {
                        MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>");
                    }
                    MonthOut.Append("</tr>");
                    MonthOut.Append("</table>");
                    if (AllCourseNum <= 0)
                    {
                        MonthOut.Insert(0, "<p>课程学习的考试通过率为 <span style=\"color:#FF0000;\"> 0 </span></p><br /></div>");
                    }
                    else
                    {
                        MonthOut.Insert(0, "<p>课程学习的考试通过率为 <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span></p><br /></div>");
                    }
                    MonthOut.Insert(0, "在孟特EMS考试系统中进行有效学习的人数为 <span style=\"color:#FF0000;\">" + TotalNum.ToString() + " 人</span></p><br /><p>累计进行了 <span style=\"color:#FF0000;\">" + AllCourseNum.ToString() + " 次</span>课程的学习,人均进行了 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>课程考试</p><br /><p>其中学习通过 <span style=\"color:#FF0000;\">" + AllPassCourseNum + " 门</span>课程考试,人均通过 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + " 门</span>课程</p><br />");

                    MonthOut.Insert(0, "到" + endDate.AddDays(-1).ToString("d"));
                    if (startDate != DateTime.MinValue)
                    {
                        MonthOut.Insert(0, "从" + startDate.ToString("d"));
                    }
                    else
                    {
                        MonthOut.Insert(0, "从项目启动");
                    }
                    if (companyModel.GroupId == 1 || companyModel.GroupId == 2)
                    {
                        MonthOut.Insert(0, "集团");
                    }
                    else
                    {
                        MonthOut.Insert(0, "贵司");
                    }
                    MonthOut.Insert(0, "<div style=\" text-align:left; font-size:14px;\"><p>");

                    MonthOut.Append("<div style=\"line-height:25px; text-align:left; font-size:14px;\"><p style=\"text-align:left; font-size:14px;\"><font color=\"red\">人均学习课程数量:</font>代表团队对学习重视的程度,越高代表越重视学习,建议<span style=\"color:#FF0000;\">不低于每周人均2.2门课程,每月人均8.5门课程</span>,低于指标者请部门领导对学习加大关注。</p>");
                    if (startDate != DateTime.MinValue && (endDate - startDate).Days <= 7 && !string.IsNullOrEmpty(AverageCourseNumCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2))
                    {
                        MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前人均学习数量低于每周人均2.2门课程的团队有:<span style=\"color:#FF0000;\">" + AverageCourseNumCompanyName + "</span>;请相关领导予以关注。</p>");
                        // else if (string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2))
                        MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前有效人均学习数量为:  <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>,");
                        if (Math.Round(((double)AllCourseNum / TotalNum), 1) >= 2.2)
                        {
                            MonthOut.Append("表现良好,请再接再厉。</p>");
                        }
                        else
                        {
                            MonthOut.Append("请相关领导予以关注。</p>");
                        }
                    }
                    MonthOut.Append("<br />");
                    MonthOut.Append("<p style=\"text-align:left; font-size:14px;\"><font color=\"red\">课程考试通过率:</font>通过率高代表团队学习认真,若<span style=\"color:#FF0000;\">通过率低于22%</span>,表示学员没有学习课程,只是通过不断考试来<span style=\"color:#FF0000;\">试图懵过考核</span>,请部门领导制止不当的学习行为。</p>");
                    if (!string.IsNullOrEmpty(NoPassCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2))
                    {
                        MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前通过率低于22%的团队有: <span style=\"color:#FF0000;\">" + NoPassCompanyName + "</span>,请相关领导予以关注,以上4S店视为无效学习,全部数据不列入集团学习效果统计。</p>");
                    }
                    else if (string.IsNullOrEmpty(NoPassCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2))
                    {
                        MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前通过率为: <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span>,表现良好,请再接再厉。</p>");
                    }
                    MonthOut.Append("</div>");

                    //有效学习统计结束


                    //有效学习统计开始
                    //AllPassCourseNum = 0;
                    //AllCourseNum = 0;
                    //AllUserNum = 0;
                    //TotalNum = 0;
                    //CompanyNum = 0;

                    //MonthOut.Append("<br><br>");
                    //MonthOut.Append("<table class=\"listTable\">");
                    //MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"11\">" + companyModel.CompanyName + " 人员数据统计(除了删除人员以外的所有考试人员) [");
                    //if (startDate != DateTime.MinValue) MonthOut.Append("从" + startDate.ToString("d"));
                    //else MonthOut.Append("从项目启动");
                    //MonthOut.Append("到" + endDate.AddDays(-1).ToString("d") + "]</td></tr>");
                    //MonthOut.Append("<tr class=\"listTableHead\">");
                    //MonthOut.Append("<td>店名</td>");
                    //MonthOut.Append("<td>项目启动时间</td>");
                    //MonthOut.Append("<td>系统登记<br />人数</td>");
                    //MonthOut.Append("<td>累计参加<br />考试人数</td>");
                    //MonthOut.Append("<td>累计学习<br />考试次数</td>");
                    //MonthOut.Append("<td>考试通过<br />课程数量</td>");
                    //MonthOut.Append("<td>人均学习<br />课程数量</td>");
                    //MonthOut.Append("<td>人均通过<br />课程数量</td>");
                    //MonthOut.Append("<td>参考人员<br />人均学习<br />课程数量</td>");
                    //MonthOut.Append("<td>参考人员<br />人均通过<br />课程数量</td>");
                    //MonthOut.Append("<td>课程考试<br />通过率</td>");
                    //MonthOut.Append("</tr>");

                    //foreach (CompanyInfo _CompanyModel in companyList)
                    //{
                    //    if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < endDate)
                    //    {
                    //        int PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0;
                    //        UserSearchInfo userSearch = new UserSearchInfo();
                    //        userSearch.InCompanyID = _CompanyModel.CompanyId.ToString();
                    //        userSearch.InStatus = state;
                    //        userSearch.InGroupID = groupID;
                    //        userSearch.InWorkingPostID = postIdCondition;
                    //        userSearch.InStudyPostID = studyPostIdCondition;
                    //        List<UserInfo> userList = UserBLL.SearchUserList(userSearch);
                    //        Num = userList.Count;
                    //        //应考人数(去除在待考分组的人)
                    //        //int YKNum = userList.FindAll(delegate(UserInfo TempModel) { return TempModel.Status == (int)UserState.Normal; }).Count;
                    //        //Num = YKNum;

                    //        TestPaperInfo TestPaperModel = new TestPaperInfo();
                    //        TestPaperModel.TestMinDate = startDate;
                    //        TestPaperModel.TestMaxDate = endDate;
                    //        TestPaperModel.UserIdCondition = UserBLL.ReadUserIdStr(userList);
                    //        TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString();
                    //        List<TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel);
                    //        string UserId = string.Empty;
                    //        foreach (TestPaperInfo Info in TempList)
                    //        {
                    //            if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString()))
                    //            {
                    //                UserId += "," + Info.UserId.ToString();
                    //            }
                    //            if (Info.IsPass == 1)
                    //            {
                    //                PassCourseNum += 1;
                    //            }
                    //        }
                    //        if (UserId.StartsWith(",")) UserId = UserId.Substring(1);
                    //        if (string.IsNullOrEmpty(UserId))
                    //        {
                    //            UserNum = 0;
                    //        }
                    //        else
                    //        {
                    //            UserNum = UserId.Split(',').Length;
                    //        }

                    //        CourseNum = TempList.Count;
                    //        double SinglePassRate; //单店课程通过率
                    //        if (CourseNum == 0)
                    //            SinglePassRate = 0;
                    //        else
                    //            SinglePassRate = (double)PassCourseNum / (double)CourseNum;

                    //        if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                    //        {
                    //            CompanyNum += 1; //通过率大于22%的公司数量
                    //            TotalNum += Num;  //总人数
                    //            AllUserNum += UserNum; //总参加考试人数
                    //            AllCourseNum += CourseNum; //总考试课程数
                    //            AllPassCourseNum += PassCourseNum;  //总通过考试课程数
                    //        }
                    //        else
                    //        {
                    //            NoPassCompanyName += _CompanyModel.CompanySimpleName + " ";
                    //        }

                    //        MonthOut.Append("<tr class=\"listTableMain\">");
                    //        MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>");
                    //        MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>");
                    //        MonthOut.Append("<td>" + Num.ToString() + "</td>");
                    //        MonthOut.Append("<td>" + UserNum.ToString() + "</td>");
                    //        MonthOut.Append("<td>" + CourseNum + "</td>");
                    //        MonthOut.Append("<td>" + PassCourseNum + "</td>");
                    //        if (Num == 0)
                    //        {
                    //            MonthOut.Append("<td>0</td>");
                    //            MonthOut.Append("<td>0</td>");
                    //        }
                    //        else
                    //        {
                    //            if (startDate == DateTime.MinValue || (endDate - startDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2)
                    //            {
                    //                MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                    //            }
                    //            else
                    //            {
                    //                AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " ";
                    //                MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>");
                    //            }
                    //            MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>");
                    //            if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                    //            {
                    //                PerAllAverage += Math.Round(((double)CourseNum / Num), 1);
                    //                PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1);
                    //            }
                    //        }
                    //        //计算参考人员人均值
                    //        if (UserNum == 0)
                    //        {
                    //            MonthOut.Append("<td>0</td>");
                    //            MonthOut.Append("<td>0</td>");
                    //        }
                    //        else
                    //        {
                    //            MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>");
                    //            MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>");
                    //        }
                    //        if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID)
                    //        {
                    //            MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>");
                    //            PassAverage += SinglePassRate;
                    //        }
                    //        else
                    //        {
                    //            MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>");
                    //        }
                    //        MonthOut.Append("</tr>");
                    //    }
                    //}
                    //MonthOut.Append("<tr class=\"listTableHead\">");
                    //MonthOut.Append("<td colspan=\"2\">" + companyModel.CompanySimpleName + "有效学习合计</td>");
                    //MonthOut.Append("<td>" + TotalNum.ToString() + "</td>");
                    //MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>");
                    //MonthOut.Append("<td>" + AllCourseNum + "</td>");
                    //MonthOut.Append("<td>" + AllPassCourseNum + "</td>");
                    //if (TotalNum == 0)
                    //{
                    //    MonthOut.Append("<td>0</td>");
                    //    MonthOut.Append("<td>0</td>");
                    //}
                    //else
                    //{
                    //    //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>");
                    //    //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>");
                    //    //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>");
                    //    MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>");
                    //    MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>");
                    //}
                    //if (AllUserNum == 0)
                    //{
                    //    MonthOut.Append("<td>0</td>");
                    //    MonthOut.Append("<td>0</td>");
                    //}
                    //else
                    //{
                    //    MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>");
                    //    MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>");
                    //}
                    //if (AllCourseNum == 0)
                    //    MonthOut.Append("<td>0</td>");
                    //else
                    //    MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>");
                    //MonthOut.Append("</tr>");
                    //MonthOut.Append("</table>");
                    //MonthOut.Append("<br><br>");
                    //有效学习统计结束


                    //岗位资质认证统计开始
                    MonthOut.Append("<table class=\"listTable\">");
                    MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"9\">" + companyModel.CompanyName + " 岗位资质认证统计 [");
                    if (startDate != DateTime.MinValue)
                    {
                        MonthOut.Append("从" + startDate.ToString("d"));
                    }
                    else
                    {
                        MonthOut.Append("从项目启动");
                    }
                    MonthOut.Append("到" + endDate.AddDays(-1).ToString("d") + "]</td></tr>");
                    MonthOut.Append("<tr class=\"listTableHead\">");
                    MonthOut.Append("<td>店名</td>");
                    MonthOut.Append("<td>姓名</td>");
                    MonthOut.Append("<td>在职岗位</td>");
                    MonthOut.Append("<td>已通过的<br />认证岗位</td>");
                    //MonthOut.Append("<td>岗位考核<br />课程数量</td>");
                    MonthOut.Append("<td>累计通过<br />岗位数量</td>");
                    MonthOut.Append("<td>目前正在<br />学习岗位</td>");
                    MonthOut.Append("</tr>");
                    foreach (CompanyInfo _CompanyModel in companyList)
                    {
                        PostPassInfo PostPassModel = new PostPassInfo();
                        PostPassModel.SearchStartDate = startDate;
                        PostPassModel.CreateDate      = endDate;
                        List <ReportPostPassInfo> PostPassList = PostPassBLL.PostPassReportList(PostPassModel, _CompanyModel.CompanyId.ToString());
                        foreach (ReportPostPassInfo Info in PostPassList)
                        {
                            MonthOut.Append("<tr class=\"listTableMain\">");
                            MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>");
                            MonthOut.Append("<td>" + Info.RealName + "</td>");
                            if (string.IsNullOrEmpty(Info.WorkingPostName))
                            {
                                MonthOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostId).PostName + "</td>");
                            }
                            else
                            {
                                MonthOut.Append("<td>" + Info.WorkingPostName + "</td>");
                            }
                            MonthOut.Append("<td>" + Info.PassPostName + "</td>");
                            MonthOut.Append("<td>" + Info.PassPostNum.ToString() + "</td>");
                            MonthOut.Append("<td>" + PostBLL.ReadPost(Info.StudyPostId).PostName + "</td>");
                            MonthOut.Append("</tr>");
                        }
                    }
                    MonthOut.Append("</table>");
                    //岗位资质认证统计结束

                    ReportList.InnerHtml  = MonthOut.ToString();
                    ReportList.InnerHtml += HistoryData(companyList, endDate);
                }
            }
        }
Ejemplo n.º 26
0
        protected void ListShow()
        {
            PostPassInfo postPassModel = new PostPassInfo();

            postPassModel.UserId = base.UserID;
            List <PostPassInfo> postPassList = PostPassBLL.ReadPostPassList(postPassModel);

            if (postPassList.Count > 0)
            {
                foreach (PostPassInfo Info in postPassList)
                {
                    PostInfo  post   = PostBLL.ReadPost(Info.PostId);
                    Watermark NewPic = new Watermark();
                    if (File.Exists(Server.MapPath("/zs/Template/" + base.UserCompanyID.ToString() + ".jpg")))
                    {
                        NewPic.BackgroundImage = Server.MapPath("/zs/Template/" + base.UserCompanyID.ToString() + ".jpg");
                    }
                    else
                    {
                        NewPic.BackgroundImage = Server.MapPath("/zs/Template/1.jpg");
                    }
                    NewPic.Text     = base.UserRealName;
                    NewPic.DateText = DateTime.Today.Year + "     " + DateTime.Today.Month + "    " + DateTime.Today.Day;
                    NewPic.PostName = post.PostName;
                    string OutPutName = string.Empty;
                    switch (Info.PostId)
                    {
                    case 7:
                        OutPutName = "基础知识入门";
                        break;

                    case 37:
                        OutPutName = "市场营销";
                        break;

                    case 64:
                        OutPutName = "销售内训师";
                        break;

                    case 42:
                        OutPutName = "基础电学入门";
                        break;

                    case 82:
                        OutPutName = "电学暨电机";
                        break;

                    case 83:
                        OutPutName = "售后前台接待";
                        break;

                    case 84:
                    case 85:
                        OutPutName = "服务主管";
                        break;

                    case 87:
                        OutPutName = "售后服务业务入门";
                        break;

                    case 88:
                        OutPutName = "售后服务管理入门";
                        break;

                    case 168:
                        OutPutName = "精品业务";
                        break;

                    case 166:
                        OutPutName = "洗车暨美容";
                        break;

                    case 89:
                        OutPutName = "客户关系提升";
                        break;

                    case 167:
                        OutPutName = "高级财务";
                        break;

                    case 158:
                        OutPutName = "4S店业务入门";
                        break;

                    case 11:
                        OutPutName = "高级运营管理专家";
                        break;

                    default:
                        OutPutName = post.PostName;
                        break;
                    }
                    NewPic.PostText = "“汽车" + OutPutName + "专业”";
                    NewPic.Left     = 205;
                    NewPic.Top      = 210;
                    string PicPath = Server.MapPath("/zs/") + @"/" + base.UserCompanyID.ToString();
                    if (!Directory.Exists(PicPath))
                    {
                        Directory.CreateDirectory(PicPath);
                    }
                    PicPath           += "/" + base.UserID.ToString() + "_" + Info.PostId.ToString() + ".jpg";
                    NewPic.ResultImage = PicPath;
                    if (!File.Exists(PicPath))
                    {
                        NewPic.Create();
                    }
                    PicPath = "/zs/" + base.UserCompanyID.ToString() + "/" + base.UserID.ToString() + "_" + Info.PostId.ToString() + ".jpg";
                    HtmlOutPut.Append("<div style=\"float:left; text-align:center; line-height:30px; margin-top:20px;\"><a href=\"" + PicPath + "\"  target=\"_blank\"><img src=\"" + PicPath + "\" style=\"width:350px;\"></a><h3 style=\"font-size:16px;\">" + post.PostName + "证书</h3></div>");
                }
            }
        }
Ejemplo n.º 27
0
 public static void UpdateIsRZ(PostPassInfo Model)
 {
     dal.UpdateIsRZ(Model);
 }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //设置默认值
                if (string.IsNullOrEmpty(action))
                {
                    groupID = "36";
                    state   = ((int)UserState.Normal).ToString();
                }

                if (!string.IsNullOrEmpty(action) && companyID > 0)
                {
                    ShowArea.Style.Add("display", "");
                    company              = CompanyBLL.ReadCompany(companyID);
                    companyName          = company.CompanyName;
                    startDate            = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchStartDate"));
                    endDate              = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchEndDate"));
                    SearchStartDate.Text = startDate.ToString("d");
                    SearchEndDate.Text   = endDate.ToString("d");
                    endDate              = ShopCommon.SearchEndDate(endDate);

                    //计算周数
                    WeekNum = (endDate - startDate).Days / 7;
                    if ((endDate - startDate).Days % 7 > 0)
                    {
                        WeekNum = WeekNum + 1;
                    }


                    if (base.IsGroupCompany(company.GroupId))
                    {
                        StringBuilder TotalTable = new StringBuilder();
                        //调取所有用户列表
                        UserSearchInfo userSearch = new UserSearchInfo();
                        userSearch.InCompanyID = CompanyBLL.ReadCompanyIdList(companyID.ToString());
                        userSearch.Condition   = "Order by [CompanyID] Desc";
                        List <UserInfo> userAllList = UserBLL.SearchUserList(userSearch);

                        //调取所有考试记录
                        TestPaperInfo testPaperSearch = new TestPaperInfo();
                        testPaperSearch.CompanyIdCondition = userSearch.InCompanyID;
                        testPaperSearch.Condition          = "[UserID] in (select [ID] from [_User] where [CompanyID] in (" + userSearch.InCompanyID + "))";
                        List <TestPaperInfo> TestPaperAllList = TestPaperBLL.NewReadList(testPaperSearch);

                        PostPassInfo postPassSearch = new PostPassInfo();
                        postPassSearch.CreateDate  = endDate;
                        postPassSearch.InCompanyID = userSearch.InCompanyID;
                        List <PostPassInfo> postPassList = PostPassBLL.ReadPostPassList(postPassSearch);

                        TotalTable.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        TotalTable.Append("<thead>");
                        TotalTable.Append("<tr class=\"listTableHead\">");
                        TotalTable.Append("<th>单店</th>");
                        TotalTable.Append("<th>总人数</th>");
                        TotalTable.Append("<th>应学习人数</th>");
                        TotalTable.Append("<th>学习总人数</th>");
                        TotalTable.Append("<th>通过本岗位总人数</th>");
                        TotalTable.Append("<th>通过本岗位在职人数</th>");
                        TotalTable.Append("<th>正在学习他岗位人数</th>");
                        TotalTable.Append("<th>已通过认证人数</th>");
                        TotalTable.Append("<th>完成多岗位认证的人数</th>");
                        TotalTable.Append("<th>项目启动时间</th>");
                        TotalTable.Append("</tr>\r\n");
                        List <CompanyInfo> companyList = CompanyBLL.ReadCompanyListByParentID(companyID.ToString());
                        foreach (CompanyInfo companyItem in companyList)
                        {
                            Dictionary <int, int> userDic = new Dictionary <int, int>();
                            List <UserInfo>       currentCompanyUserList = userAllList.FindAll(delegate(UserInfo tempUser) { return(tempUser.CompanyID == companyItem.CompanyId); });

                            int manyPostNum = 0;
                            Dictionary <int, int> studyUserDic                    = new Dictionary <int, int>(); //有学习的人
                            Dictionary <int, int> passPostUserDic                 = new Dictionary <int, int>(); //通过认证的人
                            Dictionary <int, int> passSelfPostUserDic             = new Dictionary <int, int>(); //通过本职岗位的人
                            Dictionary <int, int> passSelfPostAndInCompanyUserDic = new Dictionary <int, int>(); //通过本职岗位还在职的人
                            Dictionary <int, int> passOtherPostUserDic            = new Dictionary <int, int>(); //通过其他岗位的人

                            foreach (UserInfo userItem in currentCompanyUserList)
                            {
                                foreach (TestPaperInfo testpaper in TestPaperAllList)
                                {
                                    if (userItem.ID == testpaper.UserId && !studyUserDic.ContainsKey(userItem.ID))
                                    {
                                        studyUserDic[userItem.ID] = userItem.ID;
                                        break;
                                    }
                                }

                                foreach (PostPassInfo postpass in postPassList)
                                {
                                    if (postpass.UserId == userItem.ID)
                                    {
                                        if (passPostUserDic.ContainsKey(userItem.ID))
                                        {
                                            passPostUserDic[userItem.ID] = passPostUserDic[userItem.ID] + 1;
                                        }
                                        else
                                        {
                                            passPostUserDic[userItem.ID] = 1;
                                        }
                                        if (postpass.PostId == userItem.WorkingPostID)
                                        {
                                            passSelfPostUserDic[userItem.ID] = userItem.ID;
                                            if (userItem.Status != (int)UserState.Del)
                                            {
                                                passSelfPostAndInCompanyUserDic[userItem.ID] = userItem.ID;
                                            }
                                        }
                                        if (postpass.PostId != userItem.WorkingPostID)
                                        {
                                            passOtherPostUserDic[userItem.ID] = userItem.ID;
                                        }
                                    }
                                }
                            }

                            foreach (int item in passPostUserDic.Values)
                            {
                                if (item > 1)
                                {
                                    manyPostNum++;
                                }
                            }
                            TotalTable.Append("<tr class=\"listTableMain\">");
                            TotalTable.Append("<td>" + companyItem.CompanySimpleName + "</td>");
                            TotalTable.Append("<td>" + currentCompanyUserList.Count + "</td>");
                            TotalTable.Append("<td>" + currentCompanyUserList.FindAll(delegate(UserInfo tempUser) { return(tempUser.Status != (int)UserState.Del); }).Count + "</td>");
                            TotalTable.Append("<td>" + studyUserDic.Count + "</td>");
                            TotalTable.Append("<td>" + passSelfPostUserDic.Count + "</td>");
                            TotalTable.Append("<td>" + passSelfPostAndInCompanyUserDic.Count + "</td>");
                            TotalTable.Append("<td>" + passOtherPostUserDic.Count + "</td>");
                            TotalTable.Append("<td>" + passPostUserDic.Count + "</td>");
                            TotalTable.Append("<td>" + manyPostNum + "</td>");
                            TotalTable.Append("<td>" + (!string.IsNullOrEmpty(companyItem.PostStartDate.ToString()) ? Convert.ToDateTime(companyItem.PostStartDate).ToString("d") : "") + "</td>");
                            TotalTable.Append("</tr>\r\n");
                        }
                        TotalTable.Append("</table>\r\n");



                        groupResult.Add(company.CompanySimpleName + "合计");
                        groupResult.Add(0);
                        groupResult.Add(0);
                        groupResult.Add(0);
                        groupResult.Add("");
                        groupResult.Add("");
                        groupResult.Add("");
                        groupResult.Add(0);
                        string dataHtml = GetTheadHtml(company);
                        TotalTable.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        TotalTable.Append("<tr class=\"listTableHead\">");
                        TotalTable.Append("<td colspan=\"7\">" + company.CompanySimpleName + " [" + startDate.ToString("d") + "—" + endDate.AddDays(-1).ToString("d") + "]");
                        TotalTable.Append("</td></tr>\r\n");
                        TotalTable.Append("<tr class=\"listTableHead\">\r\n");
                        TotalTable.Append("<td>公司名</td>");
                        TotalTable.Append("<td>参加岗位考试人数</td>");
                        TotalTable.Append("<td>最小学习量<br />学习达标人数</td>");
                        TotalTable.Append("<td>最小学习量<br />学习未达标人数</td>");
                        TotalTable.Append("<td>最小学习量<br />学习达成率</td>");
                        TotalTable.Append("<td>学霸</td>");
                        TotalTable.Append("<td>学习数量</td>");
                        TotalTable.Append("</tr>\r\n");

                        CompanyInfo companySearch = new CompanyInfo();
                        companySearch.Field            = "CompanyId";
                        companySearch.Condition        = CompanyBLL.ReadCompanyIdList(companyID.ToString());
                        companySearch.State            = 0;
                        companySearch.GroupIdCondition = "0,3";
                        List <CompanyInfo> sonCompanyList = CompanyBLL.ReadCompanyList(companySearch);
                        //List<CompanyInfo> sonCompanyList = CompanyBLL.ReadCompanyListByCompanyId(CompanyBLL.ReadCompanyIdList(companyID.ToString()));
                        foreach (CompanyInfo info in sonCompanyList)
                        {
                            if (info.CompanyId != companyID && !string.IsNullOrEmpty(info.PostStartDate.ToString()) && Convert.ToDateTime(info.PostStartDate) < endDate)
                            {
                                dataHtml += HtmlOut1(info, ref TotalTable);
                            }
                        }
                        TotalTable.Append("<tr class=\"listTableFoot\">\r\n");
                        TotalTable.Append("<td>" + groupResult[0] + "</td>");
                        TotalTable.Append("<td>" + groupResult[1] + "</td>");
                        TotalTable.Append("<td>" + groupResult[2] + "</td>");
                        TotalTable.Append("<td>" + groupResult[3] + "</td>");
                        TotalTable.Append("<td>" + (double.Parse(groupResult[2].ToString()) / double.Parse(groupResult[1].ToString())).ToString("P") + "</td>");
                        TotalTable.Append("<td>" + groupResult[6] + "</td>");
                        TotalTable.Append("<td>" + groupResult[7] + "</td>");
                        TotalTable.Append("</tr>\r\n");
                        TotalTable.Append("</table>\r\n");
                        TotalTable.Append("<div style=\"line-height:25px; text-align:left; font-size:14px; margin-bottom:50px;\"><p style=\"text-align:left;  font-size:14px; line-heigh:30px; margin-top:20px;\">4S店每人每周完成1-2小时的基础学习,将带动公司提升“百年老店”运营,建议高标为100%,低标为70%。");
                        if (!string.IsNullOrEmpty(groupResult[4].ToString()))
                        {
                            TotalTable.Append("<br /><br />目前:<span style=\"color:#00b050;\">" + groupResult[4] + "</span> 达至 <span style=\"color:#00b050;\">100%</span> ,表现良好,予以肯定。");
                        }
                        if (!string.IsNullOrEmpty(groupResult[5].ToString()))
                        {
                            TotalTable.Append("<br /><br /><span style=\"color:#FF0000;\">" + groupResult[5] + "</span> 达成率尚不足 <span style=\"color:#FF0000;\">70%</span> ,请相关部门领导关注下属自主学习时间的妥善安排。");
                        }
                        TotalTable.Append("</p></div>\r\n");
                        this.ReportList.InnerHtml = TotalTable.ToString() + dataHtml + GetTfootHtml();
                    }
                    else
                    {
                        StringBuilder TotalTable = null;
                        this.ReportList.InnerHtml = GetTheadHtml(company) + HtmlOut1(company, ref TotalTable) + GetTfootHtml();
                    }
                }
            }
        }
Ejemplo n.º 29
0
        private PostCateInfo GetPostClassList()
        {
            string QuestType   = RequestHelper.GetForm <string>("questType");
            int    classID     = RequestHelper.GetForm <int>("ClassID");
            int    studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"));
            Dictionary <string, Dictionary <string, string> > postProductClassList = new Dictionary <string, Dictionary <string, string> >();

            string postCourseID     = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID);
            string passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1));

            postCourseID = StringHelper.SubString(postCourseID, passPostCourseID);

            //加载认证考试
            PostPassInfo passpost = new PostPassInfo();

            passpost.UserId = base.UserID;
            passpost.IsRZ   = 0;

            RenZhengCateInfo rzCate = new RenZhengCateInfo();

            rzCate.InPostID = PostPassBLL.PassPostString(passpost);
            string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate);

            postCourseID = string.IsNullOrEmpty(rzProductID) ? postCourseID : string.IsNullOrEmpty(postCourseID) ? rzProductID : postCourseID + "," + rzProductID;

            //加载大课件
            ProductSearchInfo productSearch = new ProductSearchInfo();

            productSearch.IsSale  = 1;
            productSearch.ClassID = "|5298|";
            List <ProductInfo> dkjProductList = ProductBLL.SearchProductList(productSearch);

            if (dkjProductList.Count > 0)
            {
                string dkjCourseID = ProductBLL.ReadProductIdStr(dkjProductList);
                postCourseID = string.IsNullOrEmpty(postCourseID) ? dkjCourseID : postCourseID + "," + dkjCourseID;
            }

            if (!string.IsNullOrEmpty(postCourseID))
            {
                postProductClassList = ProductClassBLL.ReadProductClassListByProductID(postCourseID, 1);
            }
            if (postProductClassList.Count > 1)
            {
                postProductClassList = ProductClassBLL.productClassSort(postProductClassList);
            }

            List <Dictionary <string, string> > productClassList = new List <Dictionary <string, string> >();

            foreach (string key in postProductClassList.Keys)
            {
                Dictionary <string, string> productClassDic = new Dictionary <string, string>();
                productClassDic.Add("ID", key);
                productClassDic.Add("Name", ProductClassBLL.ReadProductClassCache(int.Parse(key)).ClassName);
                productClassList.Add(productClassDic);
            }

            PostCateInfo studyPost = new PostCateInfo();

            studyPost.EncryptFcateID       = studyPostID.ToString();
            studyPost.Title                = PostBLL.ReadPost(studyPostID).PostName;
            studyPost.ChildCourseFCateView = productClassList;

            return(studyPost);

            //三个岗位加载 竞品选修
            //if (StringHelper.CompareSingleString("4,5,64", studyPostID.ToString()))
            //{
            //    ProductSearchInfo productSearch = new ProductSearchInfo();
            //    productSearch.ClassID = "|6|";
            //    productSearch.InBrandID = base.CompanyBrandID;
            //    productSearch.IsSale = 1;
            //    productSearch.NotLikeName = "必修";
            //    string xxCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch));
            //    string passXXCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, xxCourseID, 1));
            //    //if (passType == 1)
            //    //    xxCourseID = passXXCourseID;
            //    //else if (passType == 0)
            //    xxCourseID = StringHelper.SubString(xxCourseID, passXXCourseID);
            //    if (!string.IsNullOrEmpty(xxCourseID))
            //        this.xxProductClassList = ProductClassBLL.ReadProductClassListByProductID(xxCourseID, 1);
            //}

            //if (!string.IsNullOrEmpty(QuestType))
            //{
            //    List<PostInfo> PostCateList = new List<PostInfo>();
            //    PostCateList.Add(PostBLL.ReadPost(PostId));
            //    return ConvertToPostCate(PostCateList, true);
            //}
            //else
            //{
            //    return ConvertToPostCate(PostBLL.ReadPostCateRootList(), true);
            //}
        }
Ejemplo n.º 30
0
        protected override void PageLoad()
        {
            if (StringHelper.CompareSingleString(base.ParentCompanyID, "667"))
            {
                Response.Redirect("/");
            }
            base.PageLoad();
            base.CheckUserPower("PostStudy", PowerCheckType.Single);

            ProductSearchInfo product = new ProductSearchInfo();

            product.IsNew = 1;
            //product.IsTop = 1;
            product.IsSale = 1;
            int count = 0;

            this.newProductList = ProductBLL.SearchProductList(1, 10, product, ref count);
            this.newProductAttributeRecordList = AttributeRecordBLL.ReadList("3", ProductBLL.ReadProductIdStr(this.newProductList));

            //默认加载视图模式
            if (string.IsNullOrEmpty(view))
            {
                view = "Grid";
            }

            int studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"));

            this.studyPost        = PostBLL.ReadPost(studyPostID);
            this.productClassList = ProductClassBLL.ReadProductClassRootList();
            string postCourseID = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID);

            postCourseNum = string.IsNullOrEmpty(postCourseID) ? 0 : postCourseID.Split(',').Length;
            string passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1));

            passCourseNum = string.IsNullOrEmpty(passPostCourseID) ? 0 : passPostCourseID.Split(',').Length;
            //isTestAgain = TestSettingBLL.IsTestAgain(base.UserID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")));

            switch (studyPostID)
            {
            case 5:
            case 37:
            case 64:
            case 87:
            case 693:
                postImageName = "post1.jpg";
                break;

            case 8:
            case 86:
            case 4:
            case 85:
            case 276:
            case 286:
                postImageName = "post2.jpg";
                break;

            case 82:
            case 220:
            case 166:
            case 168:
            case 88:
            case 251:
            case 258:
            case 302:
            case 308:
            case 341:
                postImageName = "post3.jpg";
                break;

            case 83:
            case 89:
            case 158:
            case 265:
            case 312:
            case 318:
                postImageName = "post4.jpg";
                break;

            case 11:
            case 327:
                postImageName = "post5.jpg";
                break;

            default:
                postImageName = "post1.jpg";
                break;
            }

            //视图模式时加载分类目录
            if (view == "Grid")
            {
                //公共课程
                if (pc == 1)
                {
                    ProductSearchInfo productSearch = new ProductSearchInfo();
                    productSearch.ClassID = "|5298|";
                    productSearch.IsSale  = 1;
                    postCourseID          = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch));
                }
                //获取认证课程ID
                else if (rz == 1)
                {
                    PostPassInfo passpost = new PostPassInfo();
                    passpost.UserId = base.UserID;
                    passpost.IsRZ   = int.MinValue;

                    RenZhengCateInfo rzCate = new RenZhengCateInfo();
                    rzCate.InPostID = PostPassBLL.PassPostString(passpost);
                    postCourseID    = RenZhengCateBLL.ReadTestCateID(rzCate);
                }
                else
                {
                    //默认加载未通过的课程
                    if (passType <= 0)
                    {
                        passType = 0;
                    }

                    if (passType == 1 || passType == 0)
                    {
                        if (passType == 1)
                        {
                            postCourseID = passPostCourseID;//StringHelper.EqualString(postCourseID, filterCourseID);
                        }
                        else if (passType == 0)
                        {
                            postCourseID = StringHelper.SubString(postCourseID, passPostCourseID);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(postCourseID))
                {
                    this.postProductClassList = ProductClassBLL.ReadProductClassListByProductID(postCourseID, 1);
                }
                if (postProductClassList.Count > 1)
                {
                    this.postProductClassList = productClassSort(this.postProductClassList);
                }

                //特定时间考试
                if (pc != 1 && rz != 1)
                {
                    string parentCompanyID = CookiesHelper.ReadCookieValue("UserCompanyParentCompanyID");
                    //if (string.IsNullOrEmpty(parentCompanyID)) parentCompanyID = base.UserCompanyID.ToString();
                    //else parentCompanyID += "," + base.UserCompanyID.ToString();
                    List <TestSettingInfo> specialTestList = TestSettingBLL.ReadSpecialTestList(parentCompanyID);
                    if (specialTestList.Count > 0)
                    {
                        string specialCourseID = TestSettingBLL.ReadSpecialTestCourseID(specialTestList);
                        if (!string.IsNullOrEmpty(specialCourseID))
                        {
                            ProductSearchInfo productSearch = new ProductSearchInfo();
                            productSearch.InProductID = specialCourseID;
                            productSearch.InBrandID   = CookiesHelper.ReadCookieValue("UserCompanyBrandID");
                            productSearch.IsSale      = 1;
                            specialCourseID           = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch));
                            string passSpecialCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, specialCourseID, 1));
                            if (passType == 1)
                            {
                                specialCourseID = passSpecialCourseID;
                            }
                            else if (passType == 0)
                            {
                                specialCourseID = StringHelper.SubString(specialCourseID, passSpecialCourseID);
                            }

                            if (!string.IsNullOrEmpty(specialCourseID))
                            {
                                hasSpecialTest = true;
                            }
                        }
                    }
                }

                //三个岗位加载 竞品选修
                if (passType >= 0 && StringHelper.CompareSingleString("4,5,64", studyPostID.ToString()))
                {
                    ProductSearchInfo productSearch = new ProductSearchInfo();
                    productSearch.ClassID     = "|6|";
                    productSearch.InBrandID   = CookiesHelper.ReadCookieValue("UserCompanyBrandID");
                    productSearch.IsSale      = 1;
                    productSearch.NotLikeName = "必修";
                    string xxCourseID     = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch));
                    string passXXCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, xxCourseID, 1));
                    if (passType == 1)
                    {
                        xxCourseID = passXXCourseID;
                    }
                    else if (passType == 0)
                    {
                        xxCourseID = StringHelper.SubString(xxCourseID, passXXCourseID);
                    }
                    if (!string.IsNullOrEmpty(xxCourseID))
                    {
                        this.xxProductClassList = ProductClassBLL.ReadProductClassListByProductID(xxCourseID, 1);
                    }
                }
            }
        }