Esempio n. 1
0
        //获取任务各状态下的数量
        private void GetStatusNum(out string msg)
        {
            msg = string.Empty;
            //DataTable dt = BLL.Util.GetEnumDataTable(typeof(Entities.YTGActivityTaskStatus));
            DataTable dt = new DataTable();

            dt.Columns.Add("name");
            dt.Columns.Add("value");
            dt.Rows.Add("待分配", "1");
            dt.Rows.Add("待处理", "2");
            dt.Rows.Add("处理中", "3");
            dt.Rows.Add("已处理", "4");
            dt.Rows.Add("已结束", "5");
            dt.Rows.Add("成功", "1");
            dt.Rows.Add("失败", "0");
            Hashtable ht = new Hashtable();

            Entities.QueryYTGActivityTaskInfo query = new Entities.QueryYTGActivityTaskInfo();
            query.LoginID = Convert.ToInt32(loginUser); //BLL.Util.GetLoginUserID();
            int _assignid = 0;

            if (int.TryParse(AssignID, out _assignid))
            {
                query.AssignUserID = _assignid;
            }
            if (ProjectName != "")
            {
                query.ProjectName = ProjectName;
            }
            //if (RequestBeginDealTime != "")
            //{
            //    query.BeginDealTime = RequestBeginDealTime;
            //}
            //if (RequestEndDealTime != "")
            //{
            //    query.EndDealTime = RequestEndDealTime;
            //}

            if (!string.IsNullOrEmpty(RequestTaskCBeginTime))
            {
                query.TaskCBeginTime = RequestTaskCBeginTime;
            }
            if (!string.IsNullOrEmpty(RequestTaskCEndTime))
            {
                query.TaskCEndTime = RequestTaskCEndTime;
            }
            if (!string.IsNullOrEmpty(RequestTaskID))
            {
                query.TaskID = RequestTaskID;
            }


            DataTable dtCount = BLL.YTGActivityTask.Instance.GetStatusNum(query);

            //拼接起来
            for (int i = 0, len = dt.Rows.Count; i < len; i++)
            {
                DataRow dr    = dt.Rows[i];
                string  count = dtCount.Rows[0][dr["name"].ToString()].ToString();
                msg += "'" + dr["name"].ToString() + "':['" + dr["value"].ToString() + "','" + count + "'],";
            }

            msg = msg.Substring(0, msg.Length - 1);
        }
        private void bindData()
        {
            if (!int.TryParse(RequestPageSize, out PageSize))
            {
                PageSize = PageSize;
            }
            var query = new Entities.QueryYTGActivityTaskInfo();
            int assid = 0;

            if (int.TryParse(RequestAssignID, out assid))
            {
                query.AssignUserID = assid;
            }
            if (RequestProjectName != "")
            {
                query.ProjectName = RequestProjectName;
            }
            int status = 0;

            if (int.TryParse(RequestStatus, out status))
            {
                query.Status = status;
            }
            int success = 0;

            if (int.TryParse(RequestIsSuccess, out success))
            {
                query.IsSuccess = success;
            }
            //if (RequestBeginDealTime != "")
            //{
            //    query.BeginDealTime = RequestBeginDealTime;
            //}
            //if (RequestEndDealTime != "")
            //{
            //    query.EndDealTime = RequestEndDealTime;
            //}
            query.LoginID = userID;

            if (!string.IsNullOrEmpty(RequestTaskCBeginTime))
            {
                query.TaskCBeginTime = RequestTaskCBeginTime;
            }
            if (!string.IsNullOrEmpty(RequestTaskCEndTime))
            {
                query.TaskCEndTime = RequestTaskCEndTime;
            }
            if (!string.IsNullOrEmpty(RequestTaskID))
            {
                query.TaskID = RequestTaskID;
            }


            int RecordCount = 0;

            DataTable dt = BLL.YTGActivityTask.Instance.GetYTGTask(query, "lt.CreateTime ASC", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount);

            repeaterTableList.DataSource = dt;
            repeaterTableList.DataBind();

            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
Esempio n. 3
0
 /// 根据status分组,获取各状态下数量
 /// <summary>
 /// 根据status分组,获取各状态下数量
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public DataTable GetStatusNum(Entities.QueryYTGActivityTaskInfo query)
 {
     return(Dal.YTGActivityTask.Instance.GetStatusNum(query));
 }
Esempio n. 4
0
        //根据status分组,获取各状态下数量
        public DataTable GetStatusNum(Entities.QueryYTGActivityTaskInfo query)
        {
            string where = string.Empty;

            #region 数据权限判断
            if (query.LoginID != Constant.INT_INVALID_VALUE)
            {
                where = Dal.UserGroupDataRigth.Instance.GetSqlRightstr("pf", "lt", "BGID", "AssignUserID", query.LoginID);
            }
            #endregion

            if (query.AssignUserID != Constant.INT_INVALID_VALUE)
            {
                where += " and AssignUserID=" + query.AssignUserID;
            }
            if (query.ProjectName != Constant.STRING_INVALID_VALUE)
            {
                where += " and  pf.Name LIKE '%" + StringHelper.SqlFilter(query.ProjectName.ToString()) + "%'";
            }
            if (!string.IsNullOrEmpty(query.TaskCBeginTime))
            {
                where += " and lt.CreateTime>='" + StringHelper.SqlFilter(query.TaskCBeginTime) + " 0:0:0'";
            }
            if (!string.IsNullOrEmpty(query.TaskCEndTime))
            {
                where += " and lt.CreateTime<='" + StringHelper.SqlFilter(query.TaskCEndTime) + " 23:59:59'";
            }
            if (query.TaskID != Constant.STRING_INVALID_VALUE)
            {
                where += " and lt.TaskID='" + StringHelper.SqlFilter(query.TaskID) + "'";
            }


            string  sqlStr = @"SELECT  
                                        ISNULL(SUM(CASE WHEN lt.Status = 1 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '待分配' ,
                                        ISNULL(SUM(CASE WHEN lt.Status = 2 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '待处理' ,
                                        ISNULL(SUM(CASE WHEN lt.Status = 3 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '处理中' ,
                                        ISNULL(SUM(CASE WHEN lt.Status = 4 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '已处理' ,
                                        ISNULL(SUM(CASE WHEN lt.Status = 5 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '已结束' ,
                                        ISNULL(SUM(CASE WHEN lt.status = 4 AND lt.IsSuccess = 1 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '成功' ,
                                        ISNULL(SUM(CASE WHEN lt.status = 4 AND lt.IsSuccess = 0 THEN 1
                                                        ELSE 0
                                                   END), 0) AS '失败'
                                        FROM    dbo.YTGActivityTask lt
                                                LEFT JOIN dbo.ProjectInfo pf ON lt.ProjectID = pf.ProjectID
                                        WHERE   1 = 1 " + where;
            DataSet ds     = new DataSet();
            ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.Text, sqlStr);
            if (ds != null && ds.Tables.Count > 0)
            {
                return(ds.Tables[0]);
            }
            else
            {
                return(null);
            }
        }