コード例 #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;
     }
 }
コード例 #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;
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public DealerApplicationConfigurationService(CommonContext commonContext, IMapper mapper, IHttpContextAccessor accessor) : base(commonContext, mapper)
 {
     _accessor = accessor;
 }
コード例 #5
0
 public AuthorizationService(CommonContext commonContext) : base(commonContext)
 {
 }
コード例 #6
0
        public void SetConnectionString(string commonServerName, string username, string password)
        {
            var connectionString = CommonMethods.CreateCommonConnection(commonServerName, username, password);

            CommonContext = new CommonContext(connectionString);
        }
コード例 #7
0
 protected BaseService(CommonContext context, IMapper mapper)
 {
     CommonContext = context;
     Mapper        = mapper;
 }
コード例 #8
0
 protected BaseService(CommonContext context)
 {
     CommonContext = context;
 }