protected async void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } using (var client = new HttpClient()) { var hostIp = Environment.GetEnvironmentVariable("Fabric_NodeIPOrFQDN"); client.BaseAddress = new Uri($"http://{hostIp}:19081/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var JsonSentiments = ""; HttpResponseMessage response = await client.GetAsync("SmartHotel.RegistrationApp/SentimentIntegration/api/values"); if (response.IsSuccessStatusCode) { JsonSentiments = await response.Content.ReadAsStringAsync(); } var sentiments = JsonConvert.DeserializeObject <List <Tweet> >(JsonSentiments); RegistrationGrid.DataSource = sentiments; RegistrationGrid.DataBind(); var sentimentControl = Page.Master.FindControl("Sentiments") as HtmlGenericControl; sentimentControl.InnerText = sentiments.Count.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } using (var client = ServiceClientFactory.NewServiceClient()) { var registrations = client.GetTodayRegistrations(); RegistrationGrid.DataSource = registrations; RegistrationGrid.DataBind(); } }
protected async void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } using (var client = ServiceClientFactory.NewServiceClient()) { var registrations = client.GetTodayRegistrations(); RegistrationGrid.DataSource = registrations; RegistrationGrid.DataBind(); } var hostIp = Environment.GetEnvironmentVariable("Fabric_NodeIPOrFQDN"); var fullAppName = Environment.GetEnvironmentVariable("Fabric_ApplicationName"); var appName = fullAppName.Substring(8); if (!string.IsNullOrEmpty(hostIp)) { using (var client = new HttpClient()) { client.BaseAddress = new Uri($"http://{hostIp}:19081/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var JsonSentiments = ""; HttpResponseMessage response = await client.GetAsync($"{appName}/SentimentIntegration/api/values"); if (response.IsSuccessStatusCode) { JsonSentiments = await response.Content.ReadAsStringAsync(); } var sentiments = JsonConvert.DeserializeObject <List <Tweet> >(JsonSentiments); var sentimentControl = Page.Master.FindControl("Sentiments") as HtmlGenericControl; sentimentControl.InnerText = sentiments.Count.ToString(); } } else { var sentimentControl = Page.Master.FindControl("Sentiments") as HtmlGenericControl; sentimentControl.Visible = false; } }
protected async void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } var isStoreKPIEnabled = Environment.GetEnvironmentVariable("UseStoreKPIsStatefulService"); if (isStoreKPIEnabled == bool.FalseString) { ShowKPIsButton.Visible = false; } using (var client = ServiceClientFactory.NewServiceClient()) { var registrations = client.GetTodayRegistrations(); RegistrationGrid.DataSource = registrations; RegistrationGrid.DataBind(); } }
public void BindGrid(string filename) { //----------------Get File from azure blob stoarge----------------------------------// string storageName = "smarthotelappstr"; string storagekey = "rLUGJmc6ruwOJHRdsQC6rErh9nxPM3vzz18uR+Tq2IlZXyjqE3Ych1MsU2eTg4lDNA3XgSDAcHreIXCA5Ps2sQ=="; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", storageName, storagekey)); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("excelcont"); // Retrieve reference to a blob CloudBlockBlob blockBlob = container.GetBlockBlobReference(filename); DataSet ds; using (var memoryStream = new MemoryStream()) { //downloads blob's content to a stream blockBlob.DownloadToStream(memoryStream); var excelReader = ExcelReaderFactory.CreateOpenXmlReader(memoryStream); ds = excelReader.AsDataSet(); DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(string)); dt.Columns.Add("Type", typeof(string)); dt.Columns.Add("CustomerName", typeof(string)); dt.Columns.Add("Passport", typeof(string)); dt.Columns.Add("CustomerId", typeof(string)); dt.Columns.Add("Address", typeof(string)); ds.Tables[0].AsEnumerable().Skip(1).ToList().ForEach(dr => dt.Rows.Add(dr[0], dr[7], dr[2], dr[6], dr[2], dr[0])); RegistrationGrid.DataSource = dt; //binding the gridview RegistrationGrid.DataBind(); excelReader.Close(); } lbltxt.Text = "File uplaod successfully"; }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } using (var context = new BookingsDbContext()) { var checkins = context.Bookings .Where(b => b.From == DateTime.Today) .Select(BookingTypes.BookingToCheckin); var checkouts = context.Bookings .Where(b => b.To == DateTime.Today) .Select(BookingTypes.BookingToCheckout); var registrations = checkins.Concat(checkouts).OrderBy(r => r.Date).ToList(); RegistrationGrid.DataSource = registrations; RegistrationGrid.DataBind(); } }