コード例 #1
0
ファイル: DailyCheck.cs プロジェクト: aleczhminr/systemManage
        /// <summary>
        /// 得到列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="uName"></param>
        /// <returns></returns>
        public static Dictionary <string, object> GetList(int pageIndex, int pageSize, string uName)
        {
            Dictionary <string, object> list = new Dictionary <string, object>();

            List <DapperWhere> sqlWhere = new List <DapperWhere>();

            sqlWhere.Add(new DapperWhere("TaskStatus", 0));

            if (uName != "")
            {
                sqlWhere.Add(new DapperWhere("Operator", uName, " Operator like '%'+ @Operator +'%' "));
            }



            if (pageSize < 1)
            {
                pageSize = 20;
            }

            int rowCount = 0;

            if (pageIndex == 1)
            {
                rowCount = BLL.Base.Sys_DailyCheckBaseBLL.GetCount(sqlWhere);
            }
            int maxPage = 0;

            if (rowCount > 0)
            {
                maxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(rowCount) / pageSize));
            }

            list["rowCount"]  = rowCount;
            list["maxPage"]   = maxPage;
            list["pageIndex"] = pageIndex;

            List <Sys_DailyCheck> ModelList = BLL.Base.Sys_DailyCheckBaseBLL.GetList(pageIndex, pageSize, sqlWhere, " id desc");


            //得到 周类别, 得到当前账号信息

            List <RemindUsr>         userList   = Sys_Manage_UserBLL.GetRemindUsr();
            Dictionary <int, string> userKeyVal = new Dictionary <int, string>();

            foreach (RemindUsr itemUL in userList)
            {
                userKeyVal[itemUL.Id] = itemUL.Name;
            }


            foreach (Sys_DailyCheck itemModel in ModelList)
            {
                string[] uS       = itemModel.Reminder.Trim(',').Split(',');
                string   userName = "";
                foreach (string uIS in uS)
                {
                    int uISInt = 0;
                    if (int.TryParse(uIS, out uISInt))
                    {
                        try
                        {
                            userName += userKeyVal[uISInt] + ",";
                        }
                        catch (Exception ex)
                        {
                            userName += "";
                        }
                    }
                }
                itemModel.Reminder = userName.Trim(',');

                string repeatTime = itemModel.RepeatTime;
                if (repeatTime != null && repeatTime.Length > 0)
                {
                    string[] repeatTimes = repeatTime.Trim(',').Split(',');
                    repeatTime = "";
                    foreach (string i in repeatTimes)
                    {
                        int day = 0;
                        if (int.TryParse(i, out day))
                        {
                            repeatTime += "" + i + "日,";
                        }
                        else
                        {
                            repeatTime += "星期" + i + ",";
                        }
                    }
                }
                else
                {
                    repeatTime = Convert.ToDateTime(itemModel.RemindTime).ToString("yyyy-MM-dd");
                }
                itemModel.RepeatTime = repeatTime.Trim(',');
            }



            list["listData"] = ModelList;
            return(list);
        }
コード例 #2
0
ファイル: DailyCheck.cs プロジェクト: aleczhminr/systemManage
 /// <summary>
 /// 得到所有的人员
 /// </summary>
 /// <returns></returns>
 public static List <RemindUsr> GetRemindUsr()
 {
     return(Sys_Manage_UserBLL.GetRemindUsr());
 }