Exemplo n.º 1
0
        public Tuple <List <OrderUI>, long> GetAll(long UserID)
        {
            var strquery   = "exec uspOrderGetAll @PK_Id";
            var parameters = new[]
            {
                new SqlParameter("PK_Id", UserID)
            };

            //VoucherMasterViewModel vmViewModel = _unitOfWork.VoucherMastersRepository.MultiResultSetSqlQuery(strquery, parameters);

            var multiResultSet = new MultiResultSetReader(_unitOfWork.getContext(), strquery, parameters);

            List <OrderUI>       orderui = new List <OrderUI>();
            List <OrderDetailUI> Odetui  = new List <OrderDetailUI>();

            orderui = multiResultSet.ResultSetFor <OrderUI>().ToList();
            Odetui  = multiResultSet.ResultSetFor <OrderDetailUI>().ToList();

            for (int i = 0; i < orderui.Count(); i++)
            {
                orderui[i].ODet = Odetui.Where(a => a.OId == orderui[i].UIDN).ToList();
            }


            if (orderui != null)
            {
                return(new Tuple <List <OrderUI>, long>(orderui, orderui.Count()));
            }
            else
            {
                return(new Tuple <List <OrderUI>, long>(null, 0));
            }
        }
Exemplo n.º 2
0
        public Tuple <List <ShopMasterUI>, long> GetAll(ListFilter filter, long userId)
        {
            // int exporttype = Convert.ToInt16(filter.ExportType);

            var strquery   = "exec uspGetAllShops @UserId";
            var parameters = new[]
            {
                new SqlParameter("UserId", userId)
            };
            var multiResultSet           = new MultiResultSetReader(_unitOfWork.getContext(), strquery, parameters);
            List <ShopMasterUI> ShopList = new List <ShopMasterUI>();

            // ShopList = multiResultSet.ResultSetFor<ShopMasterUI>().ToList();

            //List<Data.files> rFiles = new List<Data.files>();
            //rFiles = multiResultSet.ResultSetFor<Data.files>().ToList();

            //List<UIEntity.files> files = Mapper.Map<List<Data.files>, List<UIEntity.files>>(rFiles);

            foreach (var Shop in ShopList)
            {
                // Shop.CL = files.Where(s => s.ShopMaster_PK_Id == Shop.UIDN).ToList();
            }

            ShopMasterUI Shopui = ShopList.FirstOrDefault();

            if (Shopui != null)
            {
                return(new Tuple <List <ShopMasterUI>, long>(ShopList, ShopList.Count()));
            }
            else
            {
                return(new Tuple <List <ShopMasterUI>, long>(ShopList, 0));
            }


            /*
             *
             *
             * var condition = PredicateBuilder.Create<ShopMaster>(t => t.SignupId == filter.SignupId && t.Status != RecordStatus.Deleted);
             *
             * if (false == string.IsNullOrWhiteSpace(filter.FilterData))
             * {
             *  filter.FilterData = filter.FilterData.ToLower();
             *  condition = condition.And(a => a.ShopName.ToLower().Contains(filter.FilterData)
             || a.Website.ToLower().Contains(filter.FilterData)
             || a.EmailID.ToLower().Contains(filter.FilterData));
             ||}
             ||if (userId > 0)
             ||{
             || UserRoleService userRoleService = new UserRoleService();
             || ListFilter<string> fil = new ListFilter<string>();
             || fil.FilterData = userId.ToString();
             || List<UserRoleUI> userRoles = userRoleService.GetAll(fil).Item1;
             || var CompIds = userRoles.Select(s => s.CI).Distinct();
             ||
             || condition = condition.And(x => CompIds.Any(c => c == x.PK_Id));
             ||}
             ||
             ||if (true == string.IsNullOrWhiteSpace(filter.sort))
             ||{
             || filter.sort = "ShopName";
             ||}
             ||
             ||Tuple<List<ShopMaster>, long> complist = null;
             ||
             ||
             ||if (filter.ExportType == ExportType.None)
             ||{
             || complist = _unitOfWork.ShopMastersRepository.GetFilteredList(condition, filter.sort, filter.sortorder, filter.startindex, filter.endindex, true, "ShopLogo");
             ||}
             ||else
             ||{
             || complist = _unitOfWork.ShopMastersRepository.GetFilteredList(condition, filter.sort, filter.sortorder, filter.startindex, filter.endindex, true, "ShopLogo");
             ||}
             ||var companies = Mapper.Map<List<ShopMaster>, List<ShopMasterUI>>(complist.Item1);
             ||return new Tuple<List<ShopMasterUI>, long>(companies, complist.Item2);
             */
        }