Пример #1
0
        public SercurityService(IIPRequestDetails iIPRequestDetails)
        {
            SqlInsightDbProvider.RegisterProvider();
            //  string sqlConnection = "Data Source=.;Initial Catalog=EmployeeManage;Integrated Security=True";
            string       sqlConnection = Caching.Instance.GetApplicationConfigs("DBConnection");
            DbConnection c             = new SqlConnection(sqlConnection);

            _IUserAccountRepository  = c.As <IUserAccountRepository>();
            _IAppAnalyticsRepository = c.As <IAppAnalyticsRepository>();
            _IIPRequestDetails       = iIPRequestDetails;
        }
Пример #2
0
        /// <summary>
        /// Initializes the database connection
        /// </summary>
        static LogicAndDataAccess()
        {
            SqlInsightDbProvider.RegisterProvider();
            DbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["AbsenceSoft"].ConnectionString);

            Database = connection.As <IDataAccess>();
        }
        public UserAccountService()
        {
            SqlInsightDbProvider.RegisterProvider();
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            _IUserAccountRepository = c.As <IUserAccountRepository>();
        }
        public virtual void RegisterAllUserAccount()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();
        }
        public async Task <List <EmployeeModel> > LoadEmployeeData()
        {
            //List<EmployeeModel> employeeDetails = new List<EmployeeModel>();

            var employeeDetails = Builder <EmployeeModel> .CreateListOfSize(1000)
                                  .All()
                                  .With(c => c.FullName  = Faker.Name.FullName())
                                  .With(c => c.FirstName = Faker.Name.FirstName())
                                  .With(c => c.LastName  = Faker.Name.LastName())
                                  .With(c => c.Email     = Faker.User.Email())
                                  .With(c => c.Initial   = Faker.Name.Gender())

                                  .With(c => c.DateOfBirth   = Faker.Date.Birthday())
                                  .With(c => c.DateOfJoining = Faker.Date.Recent(5))
                                  .With(c => c.TIN           = Faker.Number.RandomNumber(56123488).ToString())
                                  .With(c => c.PASSPORT      = Faker.Number.RandomNumber(86123488).ToString())
                                  .With(c => c.UserId        = 1)

                                  .Build();

            Parallel.ForEach(employeeDetails, new ParallelOptions {
                MaxDegreeOfParallelism = 30
            }, item =>
            {
                EmployeeAddressModel employeeAddressModelP = new EmployeeAddressModel();
                employeeAddressModelP.Address1             = Faker.Address.SecondaryAddress();
                employeeAddressModelP.Address2             = Faker.Address.SecondaryAddress();
                employeeAddressModelP.Address3             = Faker.Address.SecondaryAddress();
                employeeAddressModelP.City  = Faker.Address.USCity();
                employeeAddressModelP.State = Faker.Address.State();

                EmployeeAddressModel employeeAddressModelC = new EmployeeAddressModel();
                employeeAddressModelC.Address1             = Faker.Address.SecondaryAddress();
                employeeAddressModelC.Address2             = Faker.Address.SecondaryAddress();
                employeeAddressModelC.Address3             = Faker.Address.SecondaryAddress();
                employeeAddressModelC.City  = Faker.Address.USCity();
                employeeAddressModelC.State = Faker.Address.State();

                List <EmployeeAddressModel> employeeAddresses = new List <EmployeeAddressModel>();
                employeeAddresses.Add(employeeAddressModelP);
                employeeAddresses.Add(employeeAddressModelC);

                IEmployeeManageRepository _IEmployeeManageRepository1;

                SqlInsightDbProvider.RegisterProvider();
                //  string sqlConnection = "Data Source=.;Initial Catalog=EmployeeManage;Integrated Security=True";
                string sqlConnection1 = Caching.Instance.GetApplicationConfigs("DBConnection")
                ;
                DbConnection c1 = new SqlConnection(sqlConnection1);

                _IEmployeeManageRepository1 = c1.As <IEmployeeManageRepository>();

                var returnValue = _IEmployeeManageRepository1.LoadEmployeeData(item, employeeAddresses);
                //var returnValue = this._IEmployeeManageRepository.LoadEmployeeData(item);
            });
            return(employeeDetails.ToList());
        }
Пример #6
0
        public AppAnalyticsService(DbConnection Parameter, IIPRequestDetails iIPRequestDetails)
        {
            SqlInsightDbProvider.RegisterProvider();
            string       sqlConnection = Caching.Instance.GetApplicationConfigs("DBConnection");
            DbConnection c             = new SqlConnection(sqlConnection);

            _IAppAnalyticsRepository = c.As <IAppAnalyticsRepository>();
            _IIPRequestDetails       = iIPRequestDetails;
        }
        public StoreServerService()
        {
            SqlInsightDbProvider.RegisterProvider();
            //string sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            string       sqlConnection = "Data Source=.;Initial Catalog=HRAMDashBoard;Integrated Security=True";
            DbConnection c             = new SqlConnection(sqlConnection);

            _IStoreServerRepository = c.As <IStoreServerRepository>();
        }
        public UserAccountService(DbConnection Parameter, ISercurityService iSercurityService)
        {
            SqlInsightDbProvider.RegisterProvider();
            string       sqlConnection = Caching.Instance.GetApplicationConfigs("DBConnection");
            DbConnection c             = new SqlConnection(sqlConnection);

            _IUserAccountRepository = c.As <IUserAccountRepository>();

            _ISercurityService = iSercurityService;
        }
        public DashBoardService(DbConnection Parameter, IWeatherForecast iWeatherForecast,
                                IIPRequestDetails iIPRequestDetails, IEmailService iEmailService)
        {
            SqlInsightDbProvider.RegisterProvider();
            //  string sqlConnection = "Data Source=.;Initial Catalog=EmployeeManage;Integrated Security=True";
            string sqlConnection = Caching.Instance.GetApplicationConfigs("DBConnection")
            ;
            DbConnection c = new SqlConnection(sqlConnection);

            _IUserAccountRepository = c.As <IUserAccountRepository>();
            _IIPRequestDetails      = iIPRequestDetails;

            _IWeatherForecast = iWeatherForecast;
            _IEmailService    = iEmailService;
        }
        public virtual void AddUserRolesCache()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <UserRolesCacheModel> v = i.GetAllRoleDetails();


            foreach (var item in v)
            {
                base.AddUserRolesCache(item.RoleId, item.RoleName);
            }
        }
        public virtual new void GetAllUsersAccountsToCache()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <UserAccountCacheModel> v  = i.GetAllUsers();
            IList <UserRolesCacheModel>   v1 = i.GetAllUserRoleDetails();

            foreach (var item in v)
            {
                item.Roles = v1.Where(x => x.UserId == item.UserId).Select(x => x.RoleName).ToList();
                AddUserAccountToCache(item.UserName, item);
            }
        }
        public virtual new void AddItems()
        {
            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <ApplicationCacheModel> v = i.GetBeerByType();

            foreach (var item in v)
            {
                AddItem(item.Key, item.Value.ToUpper());
            }
            AddItem("TotalCaches", v.Count.ToString());
            AddItem("LastCachedOn", DateTime.Now.ToString("MM-dd-yyyy  hh:mm tt"));
        }
        public virtual void RefreshApplicationCacheItems()
        {
            base.RemoveApplicationCacheItems();

            string       sqlConnection = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection c             = new SqlConnection(sqlConnection);

            // DbConnection c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");

            IBeerRepository i = c.As <IBeerRepository>();

            IList <ApplicationCacheModel> v = i.GetBeerByType();

            foreach (var item in v)
            {
                AddItem(item.Key, item.Value.ToUpper());
            }
        }
        public virtual void RefreshDashBoardWidgetDetails()
        {
            string                    sqlConnection             = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString;
            DbConnection              c                         = new SqlConnection(sqlConnection);
            IBeerRepository           i                         = c.As <IBeerRepository>();
            DashBoardWidgetCacheModel dashBoardWidgetCacheModel = new DashBoardWidgetCacheModel();

            dashBoardWidgetCacheModel = i.RefreshDashBoardWidgetDetails();

            List <DashBoardWidgetCacheModel> fileEncryptionDetailsChart = new List <DashBoardWidgetCacheModel>();

            fileEncryptionDetailsChart = i.GetFileEncryptionDetailsForDashBoard();

            dashBoardWidgetCacheModel.FileUploadChartLables = "'" + string.Join("','", fileEncryptionDetailsChart.Select(x => x.FileUploadChartLables)) + "'";

            dashBoardWidgetCacheModel.FileUploadChartData = string.Join(",", fileEncryptionDetailsChart.Select(x => x.FileUploadChartData));


            base.AddDashBoardDetails("Widgets", dashBoardWidgetCacheModel);
        }
        public void Execute_Create_Empty_Proc_Execute_And_Drop_Procedure()
        {
            using var connection = new SqlConnection(fixture.ConnectionString);
            connection
            .Execute("create procedure EmptyStoreProc as /* empty */")
            .AsProcedure()
            .Execute("EmptyStoreProc")
            .AsText()
            .Execute("drop procedure EmptyStoreProc");

            var procMissing = false;

            try
            {
                connection.As(CommandType.StoredProcedure).Execute("EmptyStoreProc");
            }
            catch (SqlException)
            {
                procMissing = true;
            }
            Assert.True(procMissing);
        }
        public void Execute(IJobExecutionContext context)
        {
            Debug.WriteLine("Service Checker Started");
            try
            {
                List <ServerDetailModel> serverList      = new List <ServerDetailModel>();
                List <ServerDetailModel> serverJobStatus = new List <ServerDetailModel>();
                DbConnection             c = new SqlConnection("Data Source=.;Initial Catalog=FileEncryption;Integrated Security=True");
                ISharedRepository        i = c.As <ISharedRepository>();

                serverList = i.GetServerDetails();

                Int64 jobId = i.StartServerStatusJob();

                Console.WriteLine($"Server Status Checking started for {serverList.Count} Servers");

                Parallel.ForEach(serverList, address =>
                {
                    try
                    {
                        Ping myPing     = new Ping();
                        PingReply reply = myPing.Send(address.ServerIPAddress, 5000);
                        if (reply != null)
                        {
                            Console.WriteLine("Status :  " + reply.Status + " \n Time : " + reply.RoundtripTime.ToString() + " \n Address : " + reply.Address);
                        }
                        address.ServerStatus = reply.Status.ToString();
                        address.JobId        = jobId;
                        address.CreatedOn    = DateTime.Now;
                        address.UpdatedOn    = DateTime.Now;

                        lock (serverJobStatus)
                        {
                            serverJobStatus.Add(address);
                        }

                        if (reply != null && reply.Status == IPStatus.Success)
                        {
                        }
                    }

                    catch (Exception)
                    {
                    }
                }

                                 );

                Console.WriteLine($"Server Status Checking Completed");
                i.SaveStartServerStatusJob(serverJobStatus);
            }

            catch (Exception e)
            {
                Console.WriteLine("\nUriFormatException is thrown.Message is {0}", e.Message);

                Console.WriteLine("\nThe format of the myProxy address you entered is invalid");

                Console.WriteLine("\nPress any key to continue.........");

                Console.Read();
            }
        }
 public CategoryController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <ICategoryDataAccess>();
 }
 public InvitationController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <IInvitationDataAccess>();
 }
 public dashboardController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <IDashboardAccess>();
 }
Пример #20
0
 /// <summary>
 /// Determines the <see cref="Version"/> based on the given <paramref name="connection"/>
 /// </summary>
 public static Version GetVersion(SqlConnection connection) => GetVersion(connection.As <IDbConnection>());
 public BudgetItemController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <IBudgetItemDataAccess>();
 }
 public TransactionsController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <ITransactionDataAccess>();
 }
Пример #23
0
 public FinancialAccountController()
 {
     c  = new SqlConnection(connectionString);
     db = c.As <IAccountDataAccess>();
 }