Ejemplo n.º 1
0
        public Auction GetCurrentOrLast(AuctionCategoryEnum pEnmCategory = 0)
        {
            /* # Categories
             * - Subasta = 1,
             * - Trato directo = 2,
             * - Borregos = 3
             */

            DateTime lDtmStartDate = DateTime.Now.Date;
            DateTime lDtmEndDate   = DateTime.Now.Date.AddHours(24);

            IQueryable <Auction> lLsObjAuctionList = mObjAuctionDAO.GetEntitiesList().Where(x => x.Active && x.Opened);

            //if (pEnmCategory != 0)
            //{
            //    //lLsObjAuctionList = lLsObjAuctionList.Where(x=> x.Category == pEnmCategory);
            //}

            if (lLsObjAuctionList.Where(x => x.Date >= lDtmStartDate && x.Date <= lDtmEndDate).Count() > 0)
            {
                return(lLsObjAuctionList.Where(x => x.Date >= lDtmStartDate && x.Date <= lDtmEndDate).FirstOrDefault());
            }
            else
            {
                return(lLsObjAuctionList.FirstOrDefault());
            }
        }
Ejemplo n.º 2
0
        private string GetNextAuction()
        {
            AuctionCategoryEnum lEnmCategory   = GetSelectedCategory();
            DateTime            lDtmAutionDate = !string.IsNullOrEmpty(dpDate.Text) ? Convert.ToDateTime(dpDate.Text) : DateTime.Now;
            DateTime            lDtmStartDate  = new DateTime(lDtmAutionDate.Year, 1, 1);
            DateTime            lDtmEndDate    = new DateTime(lDtmAutionDate.Year, 12, 31);

            //List<Auction> lLstAuction = mObjAuctionServiceFactory.GetAuctionService().GetList().ToList();

            int    lIntAuctionsCount = 0;
            string lStrCurrentFolio  = string.Empty;

            if (mLonId > 0)
            {
                lStrCurrentFolio = mObjAuctionServiceFactory
                                   .GetAuctionService()
                                   .GetListFilteredByCC()
                                   .Where(x => x.Id == mLonId).Select(y => y.Folio)
                                   .FirstOrDefault();

                lStrCurrentFolio  = lStrCurrentFolio.Substring(lStrCurrentFolio.Length - 4, 4);
                lIntAuctionsCount = Convert.ToInt32(lStrCurrentFolio) - 1;
            }
            else
            {
                lIntAuctionsCount = mObjAuctionServiceFactory
                                    .GetAuctionService()
                                    .GetListFilteredByCC().Where(x => x.Date >= lDtmStartDate && x.Date <= lDtmEndDate && x.Category == lEnmCategory)
                                    .Count();
            }

            return(string.Concat(lDtmAutionDate.ToString("yy"), (lIntAuctionsCount + 1).ToString("0000")));
        }
Ejemplo n.º 3
0
 private string GetCategoryAbreviation(AuctionCategoryEnum pEnmCategory)
 {
     return(GetCategoriesList().Where(x => x.Category == pEnmCategory).Select(x => x.Abbreviation).FirstOrDefault() ?? "");
 }