private int AddHistoryLocation() { string path = "Phonecalls/" + phonenumberText.Text; FirebaseResponse response = client.Get(path); Phonecall phonecall = response.ResultAs <Phonecall>(); //The response will contain the data being retreived //neu day la lan dien thoai dau tien cua khach if (phonecall == null) { Location[] locs = new Location[1]; if (originRBtn.Checked) { locs[0] = new Location(locationCb.Text, 3, "origin"); } else { locs[0] = new Location(locationCb.Text, 3, "premium"); } phonecall = new Phonecall { locations = locs }; response = client.Set(path, phonecall); Phonecall result = response.ResultAs <Phonecall>(); return(0); } //neu khach da goi truoc do nhung nhap vao 1 dia chi moi else { int length = 0; List <Location> ls = new List <Location>(); length = phonecall.locations.Length; for (int i = 0; i < phonecall.locations.Length; i++) { ls.Add(phonecall.locations[i]); } if (originRBtn.Checked) { ls.Add(new Location(locationCb.Text, 3, "origin")); } else { ls.Add(new Location(locationCb.Text, 3, "premium")); } Location[] locs = ls.ToArray(); phonecall = new Phonecall { locations = locs }; response = client.Set(path, phonecall); Phonecall result = response.ResultAs <Phonecall>(); return(length); } }
private void locationCb_DropDown(object sender, EventArgs e) { verifyCb = true; try { //lay data va chinh sua noi dung data string path = "Phonecalls/" + phonenumberText.Text; FirebaseResponse response = client.Get(path); Phonecall phonecall = response.ResultAs <Phonecall>(); //The response will contain the data being retreived Location[] locs = phonecall.locations; for (int i = 0; i < locs.Length; i++) { if (locs[i].status == 1) { locs[i].detail = locs[i].detail + " (confirmed)"; } else if (locs[i].status == 2) { locs[i].detail = locs[i].detail + " (not found motor)"; } else if (locs[i].status == 3) { locs[i].detail = locs[i].detail + " (not located)"; } } //binding len combobox bindingSource1.DataSource = locs; locationCb.DataSource = bindingSource1.DataSource; locationCb.DisplayMember = "detail"; locationCb.ValueMember = "status"; } catch { MessageBox.Show("nothing"); locationCb.DataSource = null; locationCb.Items.Clear(); } }