Ejemplo n.º 1
0
        /// <summary>
        /// 返回当前用户的待借出清单
        /// </summary>
        /// <param name="_user"></param>
        /// <returns></returns>
        public static object GetLendList(User _user)
        {
            using (SunginDataContext sc = new SunginDataContext())
            {
                //SampleLendout slo = sc.SampleLendouts.SingleOrDefault(p => p.DdId == _user.DdId && p.State == LendStats.草拟);

                var           lendlist = sc.LendRecords.Where(p => p.DdId == _user.DdId && p.State == LendRecordStats.草拟).ToList();
                List <object> lo       = new List <object>();
                lendlist.ForEach(p =>
                {
                    var obj = SampleHelper.GetDdLenOutObj(p);
                    if (obj != null)
                    {
                        lo.Add(obj);
                    }
                });

                return(lo);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 当前用户的借出清单
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static object GetLendOutListDD(User _user)
        {
            using (SunginDataContext sc = new SunginDataContext())
            {
                var           lendlist = sc.LendRecords.Where(p => p.DdId == _user.DdId && (p.State == LendRecordStats.借出审批 || p.State == LendRecordStats.已借出)).ToList();
                List <object> lo       = new List <object>();
                lendlist.ForEach(p =>
                {
                    var obj = SampleHelper.GetDdLenOutObj(p);
                    if (obj != null)
                    {
                        lo.Add(obj);
                    }
                });

                if (lo.Count == 0)
                {
                    lo = null;
                }
                return(lo);
            }
        }
Ejemplo n.º 3
0
        public static object GetLendOutListPC(User _user)
        {
            using (SunginDataContext sc = new SunginDataContext())
            {
                var           lendlist = sc.LendRecords.Where(p => p.DdId == _user.DdId && (p.State == LendRecordStats.借出审批 || p.State == LendRecordStats.已借出)).ToList();
                List <object> lo       = new List <object>();
                lendlist.ForEach(p =>
                {
                    var sb = sc.SampleBaseInfos.SingleOrDefault(t => t.StyleId == p.StyleId);
                    if (sb != null)
                    {
                        lo.Add(SampleHelper.GetReturnObj(sb));
                    }
                });

                if (lo.Count == 0)
                {
                    lo = null;
                }
                return(new { items = lo });
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 返回所有借用清单
        /// </summary>
        /// <param name="PageId"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public static object GetAllLendOutList(int PageId = 1, int PageSize = 20)
        {
            using (SunginDataContext sc = new SunginDataContext())
            {
                int count = sc.LendRecords.Count(p => !p.IsDelete && p.State == LendRecordStats.已借出);

                List <LendRecord> lr  = sc.LendRecords.Where(p => !p.IsDelete && p.State == LendRecordStats.已借出).OrderByDescending(p => p.DdId).Skip(PageSize * (PageId - 1)).Take(PageSize).ToList();
                List <object>     obj = new List <object>();;
                lr.ForEach(p =>
                {
                    var sb = sc.SampleBaseInfos.SingleOrDefault(t => t.StyleId == p.StyleId);
                    obj.Add(new { p.Id, p.StyleId, p.UserName, p.UserDept, sb.StyleNo, p.CreateDate, baseinfo = SampleHelper.GetReturnObj(sb) });
                });
                return(new { items = obj, total = count, current = PageId, pageSize = PageSize });
            }
        }