private void buttonReservationCounter_Click(object sender, EventArgs e) { HttpResponseMessage response = HttpClientRequest.GetResult("/Relation/GetLineReservationCounter"); if (response.IsSuccessStatusCode) { dataGridViewRelations.DataSource = response.Content.ReadAsAsync <List <usp_Get_Reservation_Counter_On_Line_Result> >().Result; } }
private void buttonLineEarning_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxLineId.Text)) { MessageBox.Show("Molimo odaberite liniju da poogledate zaradu"); return; } IDictionary <string, string> query = new Dictionary <string, string>(); query.Add("lineId", textBoxLineId.Text); HttpResponseMessage response = HttpClientRequest.GetResult("/Relation/GetLineEarning/{lineId}", query); if (response.IsSuccessStatusCode) { dataGridViewRelations.DataSource = response.Content.ReadAsAsync <List <usp_Get_Line_Earnings_Result> >().Result; } }
private void RelationForm_Load(object sender, EventArgs e) { List <usp_Get_All_Cities_Result> citiesStart = new List <usp_Get_All_Cities_Result>(); List <usp_Get_All_Cities_Result> citiesDestination; //Get all lines with traveler name. HttpResponseMessage response = HttpClientRequest.GetResult("/Relation/RelationWithTraveler"); dataGridViewRelations.DataSource = response.Content.ReadAsAsync <List <usp_Get_Lines_With_Traveler_Result> >().Result; dataGridViewRelations.Columns["Id"].Visible = false; //Get all travelers HttpResponseMessage responseTravelers = HttpClientRequest.GetResult("/Traveler/Index"); comboBoxTravelers.DataSource = responseTravelers.Content.ReadAsAsync <List <usp_Get_Travelers_Result> >().Result; comboBoxTravelers.DisplayMember = "Naziv"; comboBoxTravelers.ValueMember = "Id"; //Get a start city and destination city HttpResponseMessage cityResponse = HttpClientRequest.GetResult("/City/Index"); citiesStart = cityResponse.Content.ReadAsAsync <List <usp_Get_All_Cities_Result> >().Result; citiesDestination = new List <usp_Get_All_Cities_Result>(citiesStart); comboBoxStartLine.DataSource = citiesStart; comboBoxStartLine.DisplayMember = "Naziv"; comboBoxStartLine.ValueMember = "Id"; comboBoxDestinationLine.DataSource = citiesDestination; comboBoxDestinationLine.DisplayMember = "Naziv"; comboBoxStartLine.ValueMember = "Id"; //Add button to make line unactive DataGridViewButtonColumn activeButton = new DataGridViewButtonColumn(); activeButton.Name = "Neaktivna-aktivna"; activeButton.Text = "Promjeni liniju u neaktivnu"; activeButton.UseColumnTextForButtonValue = true; dataGridViewRelations.Columns.Insert(4, activeButton); dataGridViewRelations.CellClick += dataGridViewRelations_CellClick; }