Ejemplo n.º 1
0
 public bool DealerTypeExists(DealerType dealerType)
 {
     try
     {
         return(_ctx.DealerTypes.Any(c => c.DealerTypeName == dealerType.DealerTypeName && c.DealerTypeId != dealerType.DealerTypeId));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed in DealerTypeExists: {ex}");
         return(false);
     }
 }
Ejemplo n.º 2
0
 public Dealer(string tpCode, string phone, string address,
               string contactName, string name, string ruc,
               int maxCashiers, DealerType type)
 {
     TPCode      = tpCode;
     Phone       = phone;
     Address     = address;
     ContactName = contactName;
     Name        = name;
     Ruc         = ruc;
     MaxCashiers = maxCashiers;
     Type        = type;
     Status      = Status.Active;
 }
Ejemplo n.º 3
0
        public DealerType CreateDealerType(DealerType dealerType, int userId = -1)
        {
            try
            {
                var dealerTypeEntityEntry = _ctx.DealerTypes.Add(dealerType);

                if (!Save(userId))
                {
                    return(null);
                }
                return(dealerTypeEntityEntry.Entity);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in CreateDealerType: {ex}");
                return(null);
            }
        }
Ejemplo n.º 4
0
        public DealerType GetDealerType(int dealerTypeId, string propertyToInclude = null)
        {
            try
            {
                DealerType dealerType = null;
                if (!String.IsNullOrEmpty(propertyToInclude))
                {
                    dealerType = _ctx.DealerTypes.Include(propertyToInclude)
                                 .Where(c => c.DealerTypeId == dealerTypeId)
                                 .FirstOrDefault();
                }
                dealerType = _ctx.DealerTypes
                             .Where(c => c.DealerTypeId == dealerTypeId).FirstOrDefault();

                return(dealerType);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in GetDealerType: {ex}");
                return(null);
            }
        }
Ejemplo n.º 5
0
        public DealerType UpdateDealerType(int dealerTypeId, DealerType dealerType, int userId = -1)
        {
            try
            {
                var existingDealerType = GetDealerType(dealerTypeId);
                _ctx.Entry(existingDealerType).CurrentValues.SetValues(dealerType);
                _ctx.Entry(existingDealerType).Property(x => x.AdmCreated).IsModified   = false;
                _ctx.Entry(existingDealerType).Property(x => x.AdmCreatedBy).IsModified = false;
                var dealerTypeEntityEntry = _ctx.Entry(existingDealerType);

                if (!Save(userId))
                {
                    return(null);
                }
                return(dealerTypeEntityEntry.Entity);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in UpdateDealerType: {ex}");
                return(null);
            }
        }
Ejemplo n.º 6
0
 public CanadianLocatorResult(DealerType dealerType)
 {
     this.dealerType = dealerType;
 }