Beispiel #1
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var data = new
            {
                rows    = userApp.GetList(pagination, keyword),
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Beispiel #2
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var newsTypeList = fileApp.GetList();
            var listResult   = (from a in fileApp.GetList(pagination, keyword)
                                join b in userApp.GetList() on a.F_UploadUser equals b.F_Id into team
                                from c in team.DefaultIfEmpty()
                                select new FileEntity()
            {
                F_FileMax = a.F_FileMax,
                F_Id = a.F_Id,
                F_FileName = a.F_FileName,
                F_FileVersion = a.F_FileVersion,
                F_UploadDate = a.F_UploadDate,
                F_UploadUser = c.F_RealName
            }).ToList();
            var data = new
            {
                rows    = listResult,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Beispiel #3
0
        //
        // GET: /StatisticsManage/Department/
        public override ActionResult Index()
        {
            string  organizeId = Common.GetString("organizeid");
            string  startDT    = Common.GetString("startdt"); // Request["StartDT"];
            string  endDT      = Common.GetString("enddt");   // Request["EndDT"];
            UserApp userApp    = new UserApp();

            organizeId = string.IsNullOrEmpty(organizeId) ? NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId : organizeId;//获取到当前的组织结构id
            //todo 找出该组织的下级
            OrganizeApp   organizeApp    = new OrganizeApp();
            var           organizeData   = organizeApp.GetList(organizeId);
            List <string> listOrganizeId = organizeData.Select(x => x.F_Id).ToList();// new List<string>() { organizeId };

            //var userData = userApp.GetList(listOrganizeId);
            ViewBag.OrganizeList = organizeData.Select(x => x.F_FullName).ToJson();
            //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作
            TaskApp taskApp = new TaskApp();
            //var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            List <Report>  listReports    = new List <Report>();
            ItemsDetailApp itemsDetailApp = new ItemsDetailApp();
            var            itemsData      = itemsDetailApp.GetItemList(schedule);

            foreach (var item in itemsData)
            {
                Report report = new Report();
                report.name = item.F_ItemName;
                List <int> listCount = new List <int>();
                foreach (var organizeItem in organizeData)
                {
                    //todo 获取组织下的所有员工
                    //获取组织下的组织
                    var           data             = organizeApp.GetAllList(organizeItem.F_Id);
                    List <string> listOrganizeNext = new List <string>();
                    foreach (var organizeItemNext in data)
                    {
                        listOrganizeNext.Add(organizeItemNext);
                    }
                    //获取下级下的所有员工
                    var userData = userApp.GetList(listOrganizeNext);
                    //获取下级下的所有员工的任务
                    var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
                    if (!string.IsNullOrEmpty(startDT))
                    {
                        var time = Utils.ObjectToDateTime(startDT);
                        taskData = taskData.Where(d => d.F_CreatorTime > time).ToList();
                    }
                    if (!string.IsNullOrEmpty(endDT))
                    {
                        var time = Utils.ObjectToDateTime(endDT);
                        taskData = taskData.Where(d => d.F_CreatorTime <= time).ToList();
                    }
                    listCount.Add(taskData.Count(d => d.F_Status == item.F_Id));
                }
                report.data = listCount;
                listReports.Add(report);
            }
            ViewBag.Series = listReports.ToJson();
            return(View());
        }
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            pagination.sord = "asc";
            pagination.sidx = "F_DepartmentId";
            var data = userApp.GetList(pagination, keyword);

            return(DataGrid(pagination.records, data));
        }
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            pagination.order = "asc";
            pagination.sort  = "F_DepartmentId";
            var data = userApp.GetList(pagination, keyword);

            return(ResultLayUiTable(pagination.records, data));
        }
Beispiel #6
0
        public ActionResult Default()
        {
            var           organizeId       = NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId;//获取到当前的组织结构id
            UserApp       userApp          = new UserApp();
            TaskApp       taskApp          = new TaskApp();
            OrganizeApp   organizeApp      = new OrganizeApp();
            var           organizeData     = organizeApp.GetAllList(organizeId);
            List <string> listOrganizeNext = new List <string>();

            foreach (var item in organizeData)
            {
                listOrganizeNext.Add(item);
            }
            var      userData = userApp.GetList(listOrganizeNext);
            var      taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            DateTime dt       = DateTime.Now; //当前时间

            //当天待处理任务
            ViewBag.DayTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > dt.AddDays(-1) && d.F_CreatorTime <= dt);
            //本周待处理任务
            DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一
            DateTime endWeek   = startWeek.AddDays(6);                                        //本周周日

            ViewBag.WeekTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek);
            //本周已处理任务
            ViewBag.WeekTaskDone = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek);
            //本月待处理任务
            DateTime startMonth = dt.AddDays(1 - dt.Day);              //本月月初
            DateTime endMonth   = startMonth.AddMonths(1).AddDays(-1); //本月月末
            //本月任务
            var tempTask = taskData.Where(d => d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth).ToList();

            //本月待处理
            ViewBag.MonthTaskDoing = tempTask.Count(d => d.F_Status == Doing);

            //本月已处理任务
            ViewBag.MonthTaskDone = tempTask.Count(d => d.F_Status == Done);
            //本月未完成
            ViewBag.MonthTaskNone = tempTask.Count(d => d.F_Status != Done && d.F_Status != Doing);
            //最近6个月的完成情况
            List <int>    listLineChartData = new List <int>();
            List <string> listLineChartName = new List <string>();

            for (int i = 6; i > 0; i--)
            {
                startMonth = dt.AddMonths(-i).AddDays(1 - dt.Day); //当月月初
                endMonth   = startMonth.AddMonths(1).AddDays(-1);  //当月月末
                var tempCount = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth);
                listLineChartData.Add(tempCount);
                listLineChartName.Add(dt.AddMonths(-i).Year + "年" + dt.AddMonths(-i).Month + "月");
            }
            ViewBag.LineChartData = listLineChartData.ToJson();
            ViewBag.LineChartName = listLineChartName.ToJson();
            return(View());
        }
Beispiel #7
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var companyId = OperatorProvider.Provider.GetCurrent().CompanyId;
            var data      = new
            {
                rows    = _userApp.GetList(pagination, keyword, companyId),
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Beispiel #8
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            string organizeId = Common.GetString("organizeid"); //组织id
            string startTime  = Common.GetString("startdt");    // 开始时间
            string endTime    = Common.GetString("enddt");      // 结束时间
            string schedule   = Common.GetString("schedule");   //进度
            //TODO 找出该组织下的员工
            UserApp userApp  = new UserApp();
            var     userData = userApp.GetList(pagination, keyword, organizeId);
            //ViewBag.UserList = userData.Select(x => x.F_RealName).ToJson();

            //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作
            TaskApp       taskApp  = new TaskApp();
            var           taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            List <Series> list     = new List <Series>();

            foreach (var item in userData)
            {
                Series series = new Series();
                series.id   = item.F_Id;
                series.name = item.F_RealName;
                series.tel  = item.F_MobilePhone;
                var tempTask = taskData.Where(d => d.F_UserId == item.F_Id);
                if (!string.IsNullOrEmpty(schedule))
                {
                    tempTask = tempTask.Where(d => d.F_Status == schedule);
                }
                if (!string.IsNullOrEmpty(startTime))
                {
                    tempTask = tempTask.Where(d => d.F_CreatorTime > Utils.ObjectToDateTime(startTime));
                }
                if (!string.IsNullOrEmpty(endTime))
                {
                    tempTask = tempTask.Where(d => d.F_CreatorTime <= Utils.ObjectToDateTime(endTime));
                }
                series.count    = tempTask.Count();
                series.schedule = schedule;
                list.Add(series);
            }
            var data = new
            {
                rows    = list,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Beispiel #9
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var watch    = Common.TimerStart();
            var data     = userApp.GetList(pagination, keyword);
            var jsondata = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = Common.TimerEnd(watch)
            };

            return(ToJsonResult(jsondata));
        }
        //[HttpGet]
        //[HttpPost]
        //[HandlerAjaxOnly]
        public ActionResult GetSysUserJson(string keyValue)
        {
            RoleEntity role    = (new RoleApp()).GetModel(keyValue);
            UserApp    userApp = new UserApp();
            var        data    = userApp.GetList("");

            if (role != null)
            {
                data = data.FindAll(p => p.F_RoleId == role.F_Id && p.F_EnabledMark == true);
            }
            else
            {
                data = userApp.GetUserList("");
            }
            return(Content(data.ToJson()));
        }
        private object GetUserList()
        {
            UserApp userApp = new UserApp();
            var     data    = userApp.GetList();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (UserEntity item in data)
            {
                var fieldItem = new
                {
                    encode   = item.F_Account,
                    fullname = item.F_RealName
                };
                dictionary.Add(item.F_Id, fieldItem);
            }
            return(dictionary);
        }
Beispiel #12
0
        //[HttpGet]
        //[HttpPost]
        //[HandlerAjaxOnly]
        public ActionResult GetSysUserJson(string keyValue)
        {
            RoleEntity role    = (new RoleApp()).GetModel(keyValue);
            UserApp    userApp = new UserApp();
            var        data    = userApp.GetList("");

            if (role != null)
            {
                data = data.FindAll(p => p.F_RoleId == role.F_Id && p.F_EnabledMark == true);
            }
            else
            {
                data = userApp.GetUserList("");
            }
            for (int i = 0; i < data.Count; i++)
            {
                data[i].F_DepartmentId = CommonApp.GetDepartName(data[i].F_DepartmentId);
            }
            return(Content(data.ToJson()));
        }
Beispiel #13
0
        public ActionResult GetGridJson(Pagination pagination, string keyword, string itemId)
        {
            List <string> list = null;

            if (!string.IsNullOrEmpty(keyword))
            {
                list = OrganizeApp.getDepartByName(keyword);
            }
            var query = userApp.GetList(pagination, keyword, itemId, list);

            query = query.OrderByDescending(q => q.F_Id).Skip((pagination.page - 1) * pagination.rows).Take(pagination.rows).ToList();
            var data = new
            {
                rows    = query,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Beispiel #14
0
        public ActionResult CreateSysUser()
        {
            List <UserEntity> sysusers = new List <UserEntity>();
            UserApp           userApp  = new UserApp();
            var data = app.GetList("");

            foreach (DingTalkUserEntity dduser in data)
            {
                UserEntity user = sysusers.Find(t => t.F_DingTalkUserId == dduser.UserId && dduser.UserName == t.F_DingTalkUserName);
                if (user == null)
                {
                    UserEntity model = new UserEntity();
                    model.F_Account          = ZhPinyinHelper.ChConvertPinyin(dduser.UserName);
                    model.F_RealName         = dduser.UserName;
                    model.F_NickName         = dduser.UserName;
                    model.F_DepartmentId     = "80E10CD5-7591-40B8-A005-BCDE1B961E76";
                    model.F_DutyId           = "23ED024E-0AAA-4C8D-9216-D1AB93348D26";
                    model.F_OrganizeId       = "5AB270C0-5D33-4203-A54F-4552699FDA3C";
                    model.F_RoleId           = "2691AB91-3010-465F-8D92-60A97425A45E";
                    model.F_Gender           = true;
                    model.F_EnabledMark      = true;
                    model.F_IsAdmin          = false;
                    model.F_DingTalkUserId   = dduser.UserId;
                    model.F_DingTalkUserName = dduser.UserName;
                    model.F_DingTalkAvatar   = dduser.Avatar;
                    model.F_MobilePhone      = dduser.Mobile;
                    UserLogOnEntity userLogOnEntity = new UserLogOnEntity();
                    userLogOnEntity.F_UserPassword = "******";
                    userApp.SubmitForm(model, userLogOnEntity, null);
                }
            }
            DingTalkUserEntity entity = new DingTalkUserEntity();

            sysusers = userApp.GetList("");
            return(Success("发送成功。"));
        }
Beispiel #15
0
        public List <AttachmentEntity> GetList(Pagination pagination, string keyword)
        {
            // 获取当前登录用户ID和部门ID
            string userID   = OperatorProvider.Provider.GetCurrent().UserId;
            string departID = OperatorProvider.Provider.GetCurrent().DepartmentId;
            // 获取当前用户实体对象
            UserApp    userApp = new UserApp();
            UserEntity user    = userApp.GetList().Find(t => t.F_Id == userID);
            // 查找当前用户所在部门及下级部门
            string childIDs          = GetAllChild((new OrganizeApp()).GetList(), departID);
            string departandChildIDs = "'" + departID + "'" + (childIDs.IsEmpty() ? "" : "," + childIDs);

            departandChildIDs = departandChildIDs.ToLower();

            var expression = ExtLinq.True <AttachmentEntity>();

            if (!string.IsNullOrEmpty(keyword))
            {
                expression = expression.And(t => t.F_Name.Contains(keyword));
            }
            if (user != null)
            {
                switch (user.F_AttachmentLevel)
                {
                case 1:
                    // 仅本人
                    expression = expression.And(t => t.F_CreatorUserId.Equals(userID, StringComparison.CurrentCultureIgnoreCase));
                    break;

                case 2:
                    // 仅本部门
                {
                    var    userList = userApp.GetList().FindAll(t => t.F_DepartmentId.Equals(departID, StringComparison.CurrentCultureIgnoreCase));
                    string userIDs  = ""; userList.ForEach(t => userIDs += (userIDs.IsEmpty() ? "'" : ",'") + t.F_Id.ToLower() + "'");
                    expression = expression.And(t => userIDs.Contains(t.F_CreatorUserId));
                }
                break;

                case 3:
                    // 本部门及下级
                {
                    var    userList = userApp.GetList().FindAll(t => departandChildIDs.Contains(t.F_DepartmentId.ToLower()));
                    string userIDs  = ""; userList.ForEach(t => userIDs += (userIDs.IsEmpty() ? "'" : ",'") + t.F_Id.ToLower() + "'");
                    expression = expression.And(t => userIDs.Contains(t.F_CreatorUserId));
                }
                break;

                case 9:
                    // 所有
                    break;

                default:
                    break;
                }
            }
            else
            {
                expression = expression.And(t => false);
            }

            return(service.FindList(expression, pagination));
        }
Beispiel #16
0
        public ActionResult GetListJson()
        {
            var data = userApp.GetList();

            return(Content(data.ToJson()));
        }
Beispiel #17
0
        public ActionResult GetGridDataStatisticsJson(Pagination pagination, string keyword, string starttime)
        {
            DateTime now = DateTime.Now;

            if (!string.IsNullOrEmpty(starttime))
            {
                now = starttime.ToDate();
            }
            var lists = new List <DataStatisticsForm>();

            foreach (var item in userApp.GetList(pagination, keyword))
            {
                var list = new DataStatisticsForm();
                list.F_DepartmentId = item.F_DepartmentId;
                list.F_Id           = item.F_Id;
                list.name           = item.F_RealName;
                var baocan = reportApp.GetCurrentTime(item.F_Id, now, 1);
                list.baocan = "未报";
                if (baocan != null)
                {
                    list.baocan = "已报";
                }
                var attl = attlApp.GetCurrentTime(item.F_AttCard, now, true);
                list.shangban = "×";
                if (attl != null)
                {
                    list.shangban = "√";
                }
                var attl2 = attlApp.GetCurrentTime(item.F_AttCard, now, false);
                list.xiaban = "×";
                if (attl2 != null)
                {
                    list.xiaban = "√";
                }
                var pos = posApp.GetCurrentTime(item.F_PosCard, now, 0);
                list.zaocan = "×";
                if (pos != null)
                {
                    list.zaocan = "√";
                }
                var pos1 = posApp.GetCurrentTime(item.F_PosCard, now, 1);
                list.wucan = "×";
                if (pos1 != null)
                {
                    list.wucan = "√";
                }
                var pos2 = posApp.GetCurrentTime(item.F_PosCard, now, 2);
                list.wancan = "×";
                if (pos2 != null)
                {
                    list.wancan = "√";
                }
                int bu  = 0;
                int kou = 0;
                PosT(now, item.F_PosCard, item.F_AttCard, item.F_Id, out bu, out kou);
                list.yujibuzhu = (bu * 15).ToString();
                list.cishu     = (kou).ToString();
                lists.Add(list);
            }
            var data = new
            {
                rows    = lists,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
        public ActionResult GetAllGridJson(string keyword)
        {
            var data = userApp.GetList(keyword);

            return(Content(data.ToJson()));
        }