Esempio n. 1
0
        public EntityAllResponse <Purchase> GetByArtistAgentId(string Id)
        {
            EntityAllResponse <Purchase> res = new EntityAllResponse <Purchase>();

            try
            {
                // Get ArtistAgent
                PaskolUser artAgnt = _usersRep.GetByID(Id);
                if (artAgnt?.ArtistAgent != null)
                {
                    res.Entities = ((IPurchaseRepository)this._rep)
                                   .GetByArtistAgntId(artAgnt.ArtistAgent.Artists.Select(u => u.User.Id).ToArray());
                    res.Success = true;
                }
                else
                {
                    res.Message = "לא מצאנו את מנהל האמנים";
                    res.Success = false;
                }
            }
            catch (Exception e)
            {
                res.Message = e.Message;
                res.Success = false;
            }

            return(res);
        }
Esempio n. 2
0
        public EntityAllResponse <Tag> GetTagList(IEnumerable <Guid> tagIds)
        {
            var res = new EntityAllResponse <Tag>();

            try
            {
                res.Entities = this._rep.GetTagList(tagIds);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Message = e.ToString();
                res.Success = false;
            }
            return(res);
        }
Esempio n. 3
0
        public EntityAllResponse <string> GetAllFilesName(FileType ft, string UserId)
        {
            EntityAllResponse <string> res = new EntityAllResponse <string>();

            try
            {
                res.Entities = this._rep.GetFilesNameForType(ft, UserId);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Message = e.Message;
                res.Success = false;
            }
            return(res);
        }
        public EntityAllResponse <PermissionProperty> GetAll(Guid categoryId)
        {
            EntityAllResponse <PermissionProperty> res = new EntityAllResponse <PermissionProperty>();

            res.Success = false;
            try
            {
                res.Entities = (_rep as IPermissionPropertyRepository).GetAll(categoryId);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Message = e.ToString();
            }

            return(res);
        }
Esempio n. 5
0
        public virtual EntityAllResponse <T> GetAll()
        {
            EntityAllResponse <T> res = new EntityAllResponse <T>();

            try
            {
                res.Entities = this._rep.GetAll();
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Success = false;
                res.Message = e.Message;
            }

            return(res);
        }
Esempio n. 6
0
        public EntityAllResponse <Purchase> GetByMusicId(int Id)
        {
            EntityAllResponse <Purchase> res = new EntityAllResponse <Purchase>();

            try
            {
                res.Entities = ((IPurchaseRepository)this._rep)
                               .GetByMusicId(Id);
                res.Success = true;
            }
            catch (Exception e)
            {
                res.Message = e.Message;
                res.Success = false;
            }
            return(res);
        }
Esempio n. 7
0
        public EntityAllResponse <Auction> GetAuctionsForArtist(string UserID)
        {
            EntityAllResponse <Auction> res = new EntityAllResponse <Auction>();

            try
            {
                res.Entities = this._auctionRep.GetAuctionsForArtist(UserID);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Success = false;
                res.Message = e.Message;
            }

            return(res);
        }
Esempio n. 8
0
        public EntityAllResponse <Tag> GetAllByParentId(Guid?parentId)
        {
            EntityAllResponse <Tag> res = new EntityAllResponse <Tag>();

            try
            {
                res.Entities = this._rep.GetAllByParentId(parentId);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Success = false;
                res.Message = e.Message;
            }

            return(res);
        }
Esempio n. 9
0
        public EntityAllResponse <Tag> GetBySearch(string tagName)
        {
            EntityAllResponse <Tag> res = new EntityAllResponse <Tag>();

            try
            {
                res.Entities = this._rep.GetBySearch(tagName);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Success = false;
                res.Message = e.Message;
            }

            return(res);
        }
Esempio n. 10
0
        public EntityAllResponse <PermissionsCategory> GetAll(PermissionNavigationOptions options)
        {
            EntityAllResponse <PermissionsCategory> res =
                new EntityAllResponse <PermissionsCategory>();

            res.Success = false;
            try
            {
                res.Entities = (_rep as IPermmsionCategoryRepository).GetAll(options);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Message = e.ToString();
            }

            return(res);
        }
Esempio n. 11
0
        public EntityAllResponse <string> GetMusicNames(string searchMusicText, int max)
        {
            EntityAllResponse <string> res = new EntityAllResponse <string>();

            res.Success = false;

            try
            {
                res.Entities = (this._rep as MusicsRepository).GetMusicNames(searchMusicText, max);
                res.Success  = true;
            }
            catch (Exception e)
            {
                res.Message = e.ToString();
            }

            return(res);
        }
Esempio n. 12
0
        public EntityAllResponse <Permission> GetAllPermissionsCombinations
            (PermissionsCategory category, bool getCostValue = true)
        {
            EntityAllResponse <Permission> res = new EntityAllResponse <Permission>();

            try
            {
                var propValuesLst = (from prop in category.PermissionProperties
                                     orderby prop.ViewOrder
                                     where getCostValue || !prop.IsCostLevel
                                     select prop.PropertyValues);

                List <List <PermissionPropertyValue> > valCombinationLst =
                    new List <List <PermissionPropertyValue> >()
                {
                    new List <PermissionPropertyValue>()
                };

                foreach (var propValues in propValuesLst)
                {
                    valCombinationLst = propValues.SelectMany(val => valCombinationLst.Select(valLst =>
                    {
                        List <PermissionPropertyValue> lst = new List <PermissionPropertyValue>(valLst);
                        lst.Add(val);

                        return(lst);
                    })).ToList();
                }

                res.Entities = valCombinationLst.Select(valLst =>
                                                        new Permission(category.ID, null)
                {
                    PropertyValues = valLst
                });
                res.Success = true;
            }
            catch (Exception e)
            {
                res.Success = false;
                res.Message = e.ToString();
            }
            return(res);
        }
Esempio n. 13
0
        public EntityAllResponse <KeyValuePair <Guid, string> > CategoriesAsKeyValue()
        {
            EntityAllResponse <KeyValuePair <Guid, string> > res
                = new EntityAllResponse <KeyValuePair <Guid, string> >();

            try
            {
                res.Entities = this.GetAll()
                               .Entities.Select(p => new KeyValuePair <Guid, string>(p.ID, p.Name));
                res.Success = true;
            }
            catch (Exception ex)
            {
                res.Message = ex.Message;
                res.Success = false;
            }

            return(res);
        }
Esempio n. 14
0
        private JsonResult GetReports(EntityAllResponse <Purchase.Purchase> res, int Index, SortPurchase sort)
        {
            const int RES_In_PAGE = 25;

            var entities = res.Entities;
            var totalRes = res.Entities.Count();

            switch (sort)
            {
            case SortPurchase.OldToNew:
                entities = res.Entities.OrderBy(p => p.PurchaseDate)
                           .Take(RES_In_PAGE)
                           .Skip((Index - 1) * RES_In_PAGE)
                           .ToArray();
                break;

            case SortPurchase.NewToOld:
                entities = res.Entities.OrderByDescending(p => p.PurchaseDate)
                           .Take(RES_In_PAGE)
                           .Skip((Index - 1) * RES_In_PAGE)
                           .ToArray();
                break;
            }

            return(Json(new
            {
                TotalPages = totalRes,
                entities =
                    entities.Select(p => new PurchaseReportVM
                {
                    ID = p.PurchaseId,
                    DatePurchased = p.PurchaseDate.ToString("HH:mm yyyy/MM/dd"),
                    MusicName = p.Music.HebrewName,
                    ArtistName = p.Music.Artist.User.UserName,
                    PermissionToString = string.Join(",", p.Permision.PropertyValues.Where(pv => !pv.PermissionProperty.IsCostLevel).Select(pv => pv.Name)),
                    Price = p.Permision.PermissionCost,
                    AgreementFileID = p.PurchaseAgreement?.FileId,
                    ArtistID = p.Music.ArtistID
                })
            }));
        }
Esempio n. 15
0
        public string GetSketchesForAuction(string ID)
        {
            EntityAllResponse <SketchesListViewModel> AuctoinRes =
                new EntityAllResponse <SketchesListViewModel>();

            var res = _actionSrv.GetByID(ID);

            AuctoinRes.Entities = res.Entity.Sketches.Select(a => new SketchesListViewModel()
            {
                SketchID     = a.ID,
                AuctionId    = ID,
                ArtistId     = a.Artist.User.Id,
                File         = a.MP3File,
                ArtistName   = a.Artist.User.UserName,
                Note         = a.Comment,
                SketchesName = a.Name
            });

            AuctoinRes.Message = res.Message;
            AuctoinRes.Success = res.Success;
            return(JsonConvert.SerializeObject(AuctoinRes));
        }
Esempio n. 16
0
        public string GetAuctionsForUser()
        {
            EntityAllResponse <AuctionListCustomerViewModel> AuctoinRes =
                new EntityAllResponse <AuctionListCustomerViewModel>();

            var res = _actionSrv.GetAuctionsForCustomer(User.GetUser().Id);

            AuctoinRes.Entities = res.Entities.Select(a => new AuctionListCustomerViewModel()
            {
                Id              = a.AuctionId,
                AuctionName     = a.AuctionName,
                AuctionStatus   = a.AuctionStatus.ToDescription(),
                CloseDate       = a.CloseDate == null ? "" : a.CloseDate.Value.ToShortDateString(),
                OpenDate        = a.OpenDate == null ? "" : a.OpenDate.Value.ToShortDateString(),
                OpenProjectDate = a.OpenProjectDate == null ? "" : a.OpenProjectDate.Value.ToShortDateString(),
                PickWinnerDate  = a.PickWinnerDate == null ? "" : a.PickWinnerDate.Value.ToShortDateString(),
                SketchesCount   = a.Sketches.Count
            }).ToList();
            AuctoinRes.Message = res.Message;
            AuctoinRes.Success = res.Success;
            return(JsonConvert.SerializeObject(AuctoinRes));
        }
Esempio n. 17
0
        public string GetAuctionsForArtist()
        {
            EntityAllResponse <AuctionListArtistViewModel> AuctoinRes =
                new EntityAllResponse <AuctionListArtistViewModel>();

            string UserId = User.Identity.GetUserId();
            var    res    = _actionSrv.GetAuctionsForArtist(UserId);

            AuctoinRes.Entities = res.Entities.Select(a => new AuctionListArtistViewModel()
            {
                Id             = a.AuctionId,
                AuctionName    = a.AuctionName,
                AuctionStatus  = setAuctionStatusForArtist(a.AuctionStatus),
                CloseDate      = a.CloseDate.Value.ToShortDateString(),
                OpenDate       = a.OpenDate.Value.ToShortDateString(),
                PickWinnerDate = a.PickWinnerDate.Value.ToShortDateString(),
                Won            = a.WinnerArtist?.Id == UserId,
                SketchSent     = a.Sketches?.Any(s => s.ArtistID == UserId)
            });
            AuctoinRes.Message = res.Message;
            AuctoinRes.Success = res.Success;
            return(JsonConvert.SerializeObject(AuctoinRes));
        }
Esempio n. 18
0
        public EntityAllResponse <Purchase> GetBetweenDates(DateTime s, DateTime e, bool WithoutPhonePurchase)
        {
            EntityAllResponse <Purchase> res = new EntityAllResponse <Purchase>();

            try
            {
                res.Entities = ((IPurchaseRepository)this._rep)
                               .GetByDates(s, e);

                if (WithoutPhonePurchase)
                {
                    res.Entities = res.Entities
                                   .Where(p => p.PurchaseStatus != PurchaseStatus.NotPaidBycustomer);
                }
                res.Success = true;
            }
            catch (Exception ex)
            {
                res.Message = ex.Message;
                res.Success = false;
                throw;
            }
            return(res);
        }