private List <Sirket> ListAllCustomers() { try { using (var sirketSoapClient = new SirketWebServiceSoapClient()) { List <Sirket> sirkets = new List <Sirket>(); foreach (var responsedSirket in sirketSoapClient.SelectAllSirkets().OrderBy(x => x.sirketId).ToList()) { Sirket castedSirket = new Sirket() { sirketAdi = responsedSirket.sirketAdi, sirketId = responsedSirket.sirketId, sehir = responsedSirket.sehir, adres = responsedSirket.adres, aracSayisi = responsedSirket.aracSayisi, sirketPuani = responsedSirket.sirketPuani }; sirkets.Add(castedSirket); } return(sirkets); } } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Customer doesn't exists."); } }
private void btnListele_Click(object sender, EventArgs e) { using (var sirketSoapClient = new SirketWebServiceSoapClient()) { dataGridView1.DataSource = sirketSoapClient.SelectAllSirkets(); } }