Exemplo n.º 1
0
 public string Add(DealerApplicationConfigurationDTO data)
 {
     try
     {
         var isDuplicateData = IsDuplicateData(data.DealerId, data.Application, data.DeviceId);
         if (isDuplicateData)
         {
             return("Can not add duplicate DealerId and Application");
         }
         var insertData = Mapper.Map <DealerApplicationConfiguration>(data);
         insertData.CreationTimestamp = DateTime.Now;
         insertData.CreationEmpId     = DefaultUsername;
         if (insertData.ExpiredDate.HasValue)
         {
             insertData.ExpiredDate = insertData.ExpiredDate.Value.Date;
         }
         CommonContext.DealerApplicationConfiguration.Add(insertData);
         CommonContext.SaveChanges();
         return(string.Empty);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public string Update(DealerApplicationConfigurationDTO data)
 {
     try
     {
         var dataEntity = CommonContext.DealerApplicationConfiguration.Find(data.DealerApplicationConfigurationKey);
         if (dataEntity == null)
         {
             return("Dealer Application Configuration not found");
         }
         var isDuplicateData = IsDuplicateData(data.DealerId, data.Application, data.DeviceId, data.DealerApplicationConfigurationKey);
         if (isDuplicateData)
         {
             return("Not allow to add duplicate DealerId and Application");
         }
         var updateData = Mapper.Map(data, dataEntity);
         if (updateData.ExpiredDate.HasValue)
         {
             updateData.ExpiredDate = updateData.ExpiredDate.Value.ToLocalTime();
         }
         CommonContext.DealerApplicationConfiguration.Update(updateData);
         CommonContext.SaveChanges();
         return(string.Empty);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public int Authenticate(string commonServerName, string userId, string password)
        {
            var connectionString = CommonMethods.CreateCommonConnection(commonServerName, userId, password);

            CommonContext = new CommonContext(connectionString);
            try
            {
                if (CommonContext.Database.CanConnect())
                {
                    try
                    {
                        if (CommonContext.DealerApplicationConfiguration.Count() >= 0)
                        {
                            return((int)LoginStatus.Success);
                        }
                    }
                    catch (Exception)
                    {
                        return((int)LoginStatus.NoPermission);
                    }
                }
            }
            catch (Exception ex)
            {
                return((int)LoginStatus.Fail);
            }
            return((int)LoginStatus.Fail);
        }
Exemplo n.º 4
0
 public DealerApplicationConfigurationService(CommonContext commonContext, IMapper mapper, IHttpContextAccessor accessor) : base(commonContext, mapper)
 {
     _accessor = accessor;
 }
 public AuthorizationService(CommonContext commonContext) : base(commonContext)
 {
 }
Exemplo n.º 6
0
        public void SetConnectionString(string commonServerName, string username, string password)
        {
            var connectionString = CommonMethods.CreateCommonConnection(commonServerName, username, password);

            CommonContext = new CommonContext(connectionString);
        }
Exemplo n.º 7
0
 protected BaseService(CommonContext context, IMapper mapper)
 {
     CommonContext = context;
     Mapper        = mapper;
 }
Exemplo n.º 8
0
 protected BaseService(CommonContext context)
 {
     CommonContext = context;
 }