Beispiel #1
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var departmentId = (int)e.Item.DataItem;

            var departmentInfo = DepartmentManager.GetDepartmentInfo(departmentId);

            var ltlTrHtml     = (Literal)e.Item.FindControl("ltlTrHtml");
            var ltlTarget     = (Literal)e.Item.FindControl("ltlTarget");
            var ltlTotalCount = (Literal)e.Item.FindControl("ltlTotalCount");
            var ltlDoCount    = (Literal)e.Item.FindControl("ltlDoCount");
            var ltlUndoCount  = (Literal)e.Item.FindControl("ltlUndoCount");
            var ltlBar        = (Literal)e.Item.FindControl("ltlBar");

            ltlTrHtml.Text =
                $@"<tr>";
            ltlTarget.Text = departmentInfo.DepartmentName;

            int totalCount;
            int doCount;

            if (_nodeId == 0)
            {
                totalCount = ContentDao.GetCountByDepartmentId(SiteId, departmentId, TbStartDate.DateTime, TbEndDate.DateTime);
                doCount    = ContentDao.GetCountByDepartmentIdAndState(SiteId, departmentId, EState.Checked, TbStartDate.DateTime, TbEndDate.DateTime);
            }
            else
            {
                totalCount = ContentDao.GetCountByDepartmentId(SiteId, departmentId, _nodeId, TbStartDate.DateTime, TbEndDate.DateTime);
                doCount    = ContentDao.GetCountByDepartmentIdAndState(SiteId, departmentId, _nodeId, EState.Checked, TbStartDate.DateTime, TbEndDate.DateTime);
            }
            var unDoCount = totalCount - doCount;

            ltlTotalCount.Text = totalCount.ToString();
            ltlDoCount.Text    = doCount.ToString();
            ltlUndoCount.Text  = unDoCount.ToString();

            ltlBar.Text = $@"<div class=""progress progress-success progress-striped"">
            <div class=""bar"" style=""width: {GetBarWidth(doCount, totalCount)}%""></div>
          </div>";
        }