public int countdb() { Console.WriteLine("-----count db table rows"); int count = MySQLConnections.getTableCount("select count(*) from customer"); return(count); }
public HttpResponseMessage cleardb() { Console.WriteLine("-----clear db"); HttpResponseMessage httpresponse = new HttpResponseMessage(); MySQLConnections.runDeleteDBTableQuery("TRUNCATE TABLE customer"); httpresponse.Content = new StringContent("cleared all entries from table customer."); httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return(httpresponse); }
public HttpResponseMessage GetCustomersTable(int count) { Console.WriteLine("-----Get all Customers from db------"); int intMAXNumber = count == 0 ? 1000 : count; HttpResponseMessage httpresponse = new HttpResponseMessage(); mystopwatch.Start(); String response = MySQLConnections.getTableContent("select Id, Name, Email, Address,TelephoneNumber from customer"); mystopwatch.Stop(); response = "Database's Table [customer], Elapsed time :" + mystopwatch.ElapsedMilliseconds + " Milliseconds <br/>==================================<br/>" + response; httpresponse.Content = new StringContent(response); httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return(httpresponse); }
public Boolean Bulkload(int amount) { Console.WriteLine("-----get number:" + amount); var customers = Builder <Customer> .CreateListOfSize(amount) .All() .With(c => c.Name = Faker.Name.FullName()) .With(c => c.Address = Faker.Address.City() + Faker.Address.StreetAddress()) .With(c => c.Email = Faker.Internet.Email()) .With(c => c.TelephoneNumber = Faker.Phone.Number()) .Build(); foreach (Customer curCustomer in customers) { region[curCustomer.Id] = curCustomer; } //load the same data into customer database MySQLConnections.bulkLoaddataIntoCustomer(customers); return(true); }
public CustomerController() { if (region == null) { Monitor.Enter(monitor); try { if (region == null) { ConnectToCloudCache(); } } finally { Monitor.Exit(monitor); } } if (MySQLConnections.hasDbConnection) { MySQLConnections.InitializeMYSQLDB(); } }