Exemplo n.º 1
0
 public RecentlyChangedInfo(Gig gig)
 {
     Summary = gig.Summary;
     DaysSinceChange = formatDate(gig.Edited);
     Venue = gig.Venue;
     Date = gig.Date;
 }
 private Notification(Gig gig, NotificationType notificationType)
 {
     DateTime = DateTime.Now;
     Gig      = gig ?? throw new ArgumentNullException("gig");
     Type     = notificationType;
 }
Exemplo n.º 3
0
 public GigDetailsViewModel(Gig gig, string heading)
 {
     Gig     = gig;
     Heading = heading;
 }
Exemplo n.º 4
0
        public ActionResult Details(int?id, int?subid, string type = "")
        {
            TempData["TrendingTagsFooter"]       = MatchBxCommon.GetTrendingTagsFooter();
            TempData["BidMessage"]               = "";
            TempData["GigAmount"]                = "";
            TempData["AXPRFeeAmt"]               = "0.00";
            TempData["AXPRFeeTotAmt"]            = "";
            TempData["BidAmountinDollar"]        = "";
            TempData["GigSubscriptionId"]        = 0;
            TempData["GigCompletionDate"]        = "";
            TempData["GigTitle"]                 = string.Empty;
            TempData["GigCompletionDate"]        = "";
            TempData["JobCompletionDateDisplay"] = "";
            //Session["Expired"] = "N";
            //Session["FromDetails"] = "Y";
            Session["GigSubDocMasterList"]    = null;
            Session["GigSubDocList"]          = null;
            TempData["NoofDocuments"]         = 0;
            TempData["GigSubscriptionStatus"] = "S";

            dynamic        model           = new ExpandoObject();
            GigModel       _GigModel       = new GigModel();
            GigReviewModel _GigReviewModel = new GigReviewModel();
            Gig            _Gig            = new Gig();

            int gigid = id.GetValueOrDefault();

            Session["GigId"]    = gigid;
            Session["SubGigId"] = subid.GetValueOrDefault();
            if (gigid != 0)
            {
                List <Gig> _GigList = MatchBxCommon.GenerateBadgeForGig(_GigModel.GetGigPost(gigid));
                if (_GigList.Count() > 0)
                {
                    _GigList.FirstOrDefault().GigSkillsMappingList       = _GigModel.GetSkillsByGigId(gigid);
                    _GigList.FirstOrDefault().GigTrendingTagsMappingList = _GigModel.GetTagsByGigId(gigid);
                    _Gig = _GigList.FirstOrDefault();
                    Session["JobPoster"] = _Gig.UserId;

                    Session["JobCategory"]       = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_Gig.Category.ToLower());
                    Session["JobCategoryHeader"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_Gig.Category.ToLower());

                    if (Session["JobCategoryId"] != null && Session["JobCategoryId"].ToString() == "0")
                    {
                        Session["JobCategoryName"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase("ALL SERVICES".ToLower());
                    }
                    else
                    {
                        Session["JobCategoryName"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_Gig.Category.ToLower());
                    }

                    decimal exchangerate = MatchBxCommon.GetExchangeRate();
                    decimal bid          = Convert.ToDecimal(_Gig.BudgetASP);
                    decimal perc         = (Convert.ToDecimal(bid) * 3) / 100;
                    TempData["AXPRFeeAmt"] = perc.ToString("#,##0.00");
                    string totalfees = (bid + perc).ToString("#,##0.00");
                    TempData["AXPRFeeTotAmt"] = totalfees;
                    TempData["GigAmount"]     = _Gig.BudgetASP.ToString() + " AXPR";
                    //TempData["BidAmountinDollar"] = (Math.Round(exchangerate * (bid + perc), 2)).ToString("#,##0.00");
                    TempData["BidAmountinDollar"] = (Math.Round(exchangerate * (bid), 2)).ToString("#,##0.00");

                    UserProfileModel objProfileMod = new UserProfileModel();
                    UserProfile      objProfile    = new UserProfile();
                    objProfile      = objProfileMod.LoadUserProfile(_Gig.UserId).FirstOrDefault();
                    _Gig.ProfilePic = objProfile.ProfilePic;

                    if (type == "R")
                    {
                        var _SubObj = new GigSubscription();
                        _SubObj.GigId            = Convert.ToInt32(id);
                        _Gig.GigSubscriptionList = new GigSubscriptionModel().GetGigSubscriptions(_SubObj);
                    }
                    else if (type == "A")
                    {
                        var _SubObj = new GigSubscription();
                        _SubObj.GigId            = Convert.ToInt32(id);
                        _Gig.GigActiveOrdersList = new GigSubscriptionModel().GetActiveOrders(_SubObj);
                    }
                    else if (type == "C")
                    {
                        var _SubObj = new GigSubscription();
                        _SubObj.GigId = Convert.ToInt32(id);
                        _Gig.GigCompletedOrdersList = new GigSubscriptionModel().GetCompletedOrders(_SubObj);
                    }
                    _Gig.GigReviewList = _GigReviewModel.GetReviewForGig(gigid);
                    if (_Gig.GigReviewList.Count > _RecordDisplay)
                    {
                        _Gig.GigReviewList.ForEach(s => s.Isloadmore = 1);
                    }
                    else
                    {
                        _Gig.GigReviewList.ForEach(s => s.Isloadmore = 0);
                    }
                    TempData["ReviewCount"] = _Gig.GigReviewList.Count();
                    _Gig.GigReviewList      = _Gig.GigReviewList.Take(_RecordDisplay).ToList();

                    try
                    {
                        string rating = Adjust(decimal.ToDouble(objProfile.Rating)).ToString();
                        TempData["Rating"]      = rating;
                        TempData["RatingCount"] = Adjust(decimal.ToDouble(objProfile.RatingCount)).ToString();
                        if (rating.Contains('.'))
                        {
                            string[] parts = rating.Split('.');
                            TempData["RatingWhole"] = parts[0];
                            if (parts[1] != null)
                            {
                                TempData["RatingFraction"] = parts[1];
                            }
                            else
                            {
                                TempData["RatingFraction"] = 0;
                            }
                        }
                        else
                        {
                            TempData["RatingWhole"]    = rating;
                            TempData["RatingFraction"] = 0;
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    if (Convert.ToInt32(Session["UserId"]) != _Gig.UserId)
                    {
                        if (subid.GetValueOrDefault() > 0)
                        {
                            GigSubscription      _GigSubscription      = new GigSubscription();
                            GigSubscriptionModel _GigSubscriptionModel = new GigSubscriptionModel();
                            _GigSubscription.GigSubscriptionId = subid.GetValueOrDefault();

                            List <GigSubscription> _GigSubscriptionList = _GigSubscriptionModel.LoadSubscriptionDetails(_GigSubscription);
                            if (_GigSubscriptionList.Count() > 0)
                            {
                                TempData["BidMessage"]               = _GigSubscriptionList.FirstOrDefault().Description;
                                TempData["GigTitle"]                 = _GigSubscriptionList.FirstOrDefault().Title;
                                TempData["GigCompletionDate"]        = _GigSubscriptionList.FirstOrDefault().JobCompletionDate;
                                TempData["GigSubscriptionId"]        = _GigSubscriptionList.FirstOrDefault().GigSubscriptionId;
                                TempData["JobCompletionDateDisplay"] = _GigSubscriptionList.FirstOrDefault().JobCompletionDateDisplay;
                                TempData["NoofDocuments"]            = _GigSubscriptionList.FirstOrDefault().NoofDocuments;
                                TempData["GigSubscriptionStatus"]    = _GigSubscriptionList.FirstOrDefault().GigSubscriptionStatus;
                            }
                        }
                    }
                }
            }
            return(View("Details", _Gig));
        }
Exemplo n.º 5
0
 public IModelAssertor Actual(IEntity actual)
 {
     _actual = (Gig)actual;
     return(this);
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Gig createdGig = (Gig)Context.Items["createdGig"];

            lblGigCreatedId.Text = createdGig.gigId.ToString();
        }
Exemplo n.º 7
0
        public void DeleteGig(int id)
        {
            Gig toDelete = GetGig(id);

            _repo.Delete(toDelete);
        }
Exemplo n.º 8
0
 public void GetFollowing(Gig gig, GigsDetailsViewModel viewModel, string userId)
 {
     viewModel.IsFollowing = _context.Followings
                             .Any(f => f.FolloweeId == gig.ArtistId && f.FollowerId == userId);
 }
Exemplo n.º 9
0
        public Gig GetGigFromId(int id)
        {
            Gig gig = context.Gigs.Where(r => r.GigId == id).FirstOrDefault();

            return(gig);
        }
 public void update(Gig g)
 {
     db.Entry(g).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     db.SaveChanges();
 }
 public void add(Gig g)
 {
     db.Gigs.Add(g);
     db.SaveChanges();
 }
Exemplo n.º 12
0
 public void AddGigToRepostory(Gig gig)
 {
     _context.Gigs.Add(gig);
 }
Exemplo n.º 13
0
 public void CancelGig(Gig gig)
 {
     gig.Cancel();
 }
Exemplo n.º 14
0
 public void UpdateGig(Gig gig, DateTime newDate, byte newGenreId, String newVenue)
 {
     gig.Modify(newDate, newGenreId, newVenue);
 }
Exemplo n.º 15
0
 public void Remove(Gig gig)
 {
     _context.Gigs.Remove(gig);
 }
Exemplo n.º 16
0
 public void Run(string applicationMessage)
 {
     if (session.Advanced.LuceneQuery<Gig>().WaitForNonStaleResults().Any())
         return;
     for (var i = 0; i < 200; i++)
     {
         var gig = new Gig
                       {
                           Venue = venues[venues.Count().RandomFromZeroTo()],
                           BandNames = new[]
                                           {
                                               new BandName
                                                   {
                                                       Value = bandNames[bandNames.Count().RandomFromZeroTo()]
                                                   },
                                               new BandName
                                                   {
                                                       Value = bandNames[bandNames.Count().RandomFromZeroTo()]
                                                   },
                                               new BandName
                                                   {
                                                       Value = bandNames[bandNames.Count().RandomFromZeroTo()]
                                                   }
                                             },
                           StartTime = "18:00",
                           Price = prices[prices.Count().RandomFromZeroTo()],
                           Date = DateTime.Now.AddDays(i).Date,
                           Source = "auto generated test data",
                           MoreInfo = "This is a test record only. Please make sure none of these appear in the real deployed code " + applicationMessage,
                       };
         session.Store(gig);
     }
     session.SaveChanges();
 }
Exemplo n.º 17
0
        public Gig GetGigById(int id)
        {
            Gig gig = context.Gigs.Include("Venue").Where(g => g.GigId == id).FirstOrDefault();

            return(gig);
        }
Exemplo n.º 18
0
 public bool GetAttendances(Gig gig, string userId)
 {
     return(gig.Attendances.Any(a => a.AttendeeId == userId));
 }
        private async Task SeedCatalogAsync(DataSeedContext context)
        {
            var names = new[] { "Development", "Marketing", "Cooking" };

            var rollDice = new Random();

            var categories = names
                             .Select(t => names[rollDice.Next(0, names.Length)])
                             .Select(name => Category
                                     .Create(Guid.NewGuid(), name, $"{name} description"))
                             .ToList();
            var specialCategory = Category.Create(Guid.Parse(Zero1FiveTestData.CategoryId), "Special", "Special Category");

            categories.Add(specialCategory);
            await categoryRepository.InsertManyAsync(categories, true);

            List <Gig> gigs = new();

            for (var i = 1; i < 10; i++)
            {
                var id          = Guid.NewGuid();
                var title       = $"Gig {i}";
                var cover       = $"cover{i}.jpg";
                var description = $"Gig {i} Description";
                if (i == 2)
                {
                    id = Guid.Parse(Zero1FiveTestData.GigId);
                }
                var gig = Gig
                          .Create(id,
                                  categoryId: Guid.Parse(Zero1FiveTestData.CategoryId),
                                  title,
                                  cover,
                                  description);

                gig.CreatorId    = Guid.Parse(Zero1FiveTestData.UserId);
                gig.CreationTime = DateTime.Now;
                gigs.Add(gig);
            }

            await gigRepository.InsertManyAsync(gigs, true);

            List <Product> products = new();

            for (var x = 0; x < 10; x++)
            {
                var name       = $"Product {x}";
                var categoryId = categories[rollDice.Next(0, categories.Count)].Id;

                var gigId   = Guid.Parse(Zero1FiveTestData.GigId);
                var product = Product.Create(Guid.NewGuid(), gigId, categoryId, name, $"image");

                product.Description = $"{name} Description";

                if (x == 1)
                {
                    product.IsPublished = true;
                }

                products.Add(product);
            }
            await productRepository.InsertManyAsync(products, true);           // List<Product> products = new();
        }
        public void RemoveGigPhotoFileUpload(Gig gigDB)
        {
            var file = _context.FileUploads.Remove(gigDB.FileUploads.First(f => f.FileType == FileType.Photo));

            _context.FileUploads.Remove(file);
        }
Exemplo n.º 21
0
 public bool GetFollowing(string userId, Gig gig)
 {
     return(_context.Followings
            .Any(f => f.FolloweeId == userId && f.FolloweeId == gig.ArtistId));
 }
Exemplo n.º 22
0
 public IModelAssertor Expected(IEntity expected)
 {
     _expected = (Gig)expected;
     return(this);
 }
Exemplo n.º 23
0
 public bool GetAttending(Gig gig, string userId)
 {
     return(_context.Attendances
            .Any(a => a.GigId == gig.Id && a.AttendeeId == userId));
 }
Exemplo n.º 24
0
        public ActionResult SaveGig(Gig gig)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                //job.JobTitle = ToCamelCase(job.JobTitle);
                if (Convert.ToInt32(gig.GigTrendingTagsMappingList.Count) == 0)
                {
                    if (Session["TrendingTagsList"] != null)
                    {
                        gig.GigTrendingTagsMappingList = (List <GigTrendingTagsMapping>)Session["TrendingTagsList"];
                    }
                }

                if (Convert.ToInt32(gig.GigSkillsMappingList.Count) == 0)
                {
                    if (Session["SkillsList"] != null)
                    {
                        gig.GigSkillsMappingList = (List <GigSkillsMapping>)Session["SkillsList"];
                    }
                }


                gig.UserId = Convert.ToInt32(Session["UserId"]);


                List <GigDocuments> fileList = new List <GigDocuments>();

                if (TempData["fileList"] != null)
                {
                    fileList = (List <GigDocuments>)TempData.Peek("fileList");
                }

                if (gig != null)
                {
                    if (Convert.ToInt32(gig.GigDocumentsList.Count) == 0)
                    {
                        if (fileList != null)
                        {
                            foreach (var file in fileList)
                            {
                                gig.GigDocumentsList.Add(new GigDocuments()
                                {
                                    DocumentName = file.DocumentName.ToString(), IsActive = "Y", FileSize = file.FileSize
                                });
                            }
                        }
                    }
                }

                var _tagsObjModel = new TrendingTagsModel();
                foreach (var item in gig.GigTrendingTagsMappingList)
                {
                    if (item.TrendingTagsId == 0)
                    {
                        var _trendingTag = new TrendingTags()
                        {
                            Description    = item.Description,
                            TrendingTagsId = item.TrendingTagsId,
                            JobCategoryId  = gig.JobCategoryId,
                            TagType        = "U"
                        };
                        item.TrendingTagsId = objTrendingMod.Save(_trendingTag);
                    }
                }
                var gigId = 0;
                if ((gigId = objGigMod.SaveWithTransaction(gig)) > 0)
                {
                    if (Session["UserType"] != null && Session["UserType"].ToString() == "2")
                    {
                        Session["UserType"] = "3";
                        UsersModel _Model   = new UsersModel();
                        Users      _userobj = new Users();
                        _userobj.UserId   = Convert.ToInt32(Session["UserId"]);
                        _userobj.UserType = Session["UserType"].ToString();
                        int k = _Model.ChangeUserRole(_userobj);
                    }
                    if (gig.GigId > 0)
                    {
                        message = "Your service has been edited and is now pending for approval";
                        MatchBxCommon.sendGigPostedEmailToAdmin(2, gig.GigTitle, gig.GigId);
                        TempData["CreateGig"] = gig.GigId;
                        TempData["DeleteGig"] = 0;
                    }
                    else
                    {
                        message = "Your service has been created and is now pending for approval";
                        MatchBxCommon.sendGigPostedEmailToAdmin(1, gig.GigTitle, gigId);
                        TempData["CreateGig"] = 0;
                        TempData["DeleteGig"] = 0;
                    }

                    TempData.Remove("fileList");
                    Session["FileList"]   = null;
                    Session["GigCreated"] = "Y";
                }
                else
                {
                    if (gig.GigId > 0)
                    {
                        message = "Failed to edit service";
                    }
                    else
                    {
                        message = "Failed to create service";
                    }

                    TempData.Remove("fileList");
                    Session["FileList"] = null;

                    Session["GigCreated"] = "N";
                }
                if (Convert.ToInt32(Session["UserType"]) != 3)
                {
                    Session["FirstLogin"] = "******";
                }
            }
            else
            {
                message = "Failed to create service";

                TempData.Remove("fileList");
                Session["FileList"]   = null;
                Session["GigCreated"] = "N";
                Session["FirstLogin"] = "******";
            }

            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 25
0
        // GET: /Gigs/Edit/id
        public ActionResult Edit(int id)
        {
            Gig g = database.Gigs.Where(x => x.id == id).First();

            return(View(g));
        }
Exemplo n.º 26
0
        public ActionResult SaveGigSubscription(int GigId, int JobPosterId, string Description, string JobCompletionDate, string Title, int GigSubscriptionId)
        {
            GigSubscription      _GigSubscription      = new GigSubscription();
            GigSubscriptionModel _GigSubscriptionModel = new GigSubscriptionModel();
            string message = "failed";

            _GigSubscription.GigId             = GigId;
            _GigSubscription.JobPosterId       = JobPosterId;
            _GigSubscription.Description       = Description;
            _GigSubscription.GigSubscriptionId = GigSubscriptionId;
            //CultureInfo culture = new CultureInfo("en-US");
            //DateTime tempDate = Convert.ToDateTime(JobCompletionDate, culture);
            DateTime tempDate = DateTime.ParseExact(JobCompletionDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            _GigSubscription.JobCompletionDate     = tempDate;
            _GigSubscription.IsActive              = "Y";
            _GigSubscription.GigSubscriptionStatus = "S";
            _GigSubscription.Title = Title;



            List <GigSubscriptionDocument> fileList        = new List <GigSubscriptionDocument>();
            List <GigSubscriptionDocument> fileUpdatedList = new List <GigSubscriptionDocument>();

            if (TempData["fileList"] != null)
            {
                fileList = (List <GigSubscriptionDocument>)TempData.Peek("fileList");
            }

            if (Session["GigSubDocMasterList"] != null)
            {
                fileUpdatedList = (List <GigSubscriptionDocument>)Session["GigSubDocMasterList"];
            }

            if (GigId != 0)
            {
                if (Convert.ToInt32(_GigSubscription.GigSubscriptionDocumentList.Count) == 0)
                {
                    if (fileList != null)
                    {
                        foreach (var file in fileList)
                        {
                            _GigSubscription.GigSubscriptionDocumentList.Add(new GigSubscriptionDocument()
                            {
                                DocumentName = file.DocumentName.ToString(), IsActive = "Y", FileSize = file.FileSize
                            });
                        }
                    }
                    if (fileUpdatedList != null)
                    {
                        foreach (var file in fileUpdatedList)
                        {
                            _GigSubscription.GigSubscriptionDocumentList.Add(new GigSubscriptionDocument()
                            {
                                DocumentName = file.DocumentName.ToString(), IsActive = file.IsActive, FileSize = file.FileSize, GigSubscriptionDocumentId = file.GigSubscriptionDocumentId, GigSubscriptionId = file.GigSubscriptionId, CreatedDate = file.CreatedDate
                            });
                        }
                    }
                }
            }

            var gigId = 0;

            if ((gigId = _GigSubscriptionModel.SaveWithTransaction(_GigSubscription)) > 0)
            {
                Users      _objuser    = new Users();
                UsersModel objUsersMod = new UsersModel();
                if (Convert.ToInt32(Session["UserType"]) == 1)
                {
                    _objuser.UserId   = Convert.ToInt32(Session["UserId"]);
                    _objuser.UserType = "3";
                    int returnvalue = objUsersMod.ChangeUserRole(_objuser);
                    if (returnvalue > 0)
                    {
                        Session["UserType"] = "3";
                    }
                }
                message = "success";
                if (MatchBxCommon.checkuseremailpreferences("4,5", Convert.ToInt32(Session["UserId"])) == true)
                {
                    try
                    {
                        Gig      _objGig      = new Gig();
                        GigModel _objGigModel = new GigModel();
                        _objGig  = _objGigModel.GetARecord(GigId);
                        _objuser = objUsersMod.GetList("*", " UserId = '" + _objGig.UserId + "'").FirstOrDefault();
                        string email    = _objuser.Email;
                        string fullname = _objuser.FullName != null ? _objuser.FullName : _objuser.UserName;
                        MatchBxCommon.sendGigOfferEmail(email, false, Session["UserName"].ToString(), Title, fullname);
                    }
                    catch (Exception e)
                    {
                    }
                }

                Session["GigSubDocMasterList"] = null;
                Session["GigSubDocList"]       = null;
            }

            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 27
0
 public async Task CreateGig(Gig gig)
 {
     await this.gigRepository.AddAsync(gig);
 }
Exemplo n.º 28
0
 public Task <BaseResponseDto <GigDto> > CreateGig(Gig gig)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 29
0
 public async Task UpdateGig(Gig gig)
 {
     await this.gigRepository.UpdateAsync(gig);
 }
Exemplo n.º 30
0
 public void Add(Gig gig)
 {
     _context.Gigs.Add(gig);
 }
Exemplo n.º 31
0
 public void AddGig(Gig gig)
 {
     context.Gigs.Add(gig);
 }
Exemplo n.º 32
0
 public Gig Save(Gig gig)
 {
     session.Store(gig);
     session.SaveChanges();
     return gig;
 }
Exemplo n.º 33
0
        public void Update_VenueIsNull_ThrowArgumentNullException()
        {
            var gig = new Gig();

            Assert.ThrowsException <ArgumentNullException>(() => gig.Update(DateTime.Now, 1, null), "venue");
        }