protected void Button1_Click(object sender, EventArgs e) { Lbl_Succsess.Text = ""; try { ShipperServiceClient client = new ShipperServiceClient(); var updatedShipper = new Shipper { ShipperID = int.Parse(Tbx_Id.Text), CompanyName = Tbx_Name.Text, Phone = Tbx_Phone.Text }; var result = client.UpdateShipper(updatedShipper); if (result == true) Lbl_Succsess.ForeColor = Color.Green; Lbl_Succsess.Text = "The shipper has been updated"; } catch (FaultException ex) { Lbl_Succsess.ForeColor = Color.Red; Lbl_Succsess.Text = "FaultException" + ex.Message; } catch (Exception) { Lbl_Succsess.ForeColor = Color.Red; Lbl_Succsess.Text = "Error!"; } }
protected void SaveButton_Click(object sender, EventArgs e) { try { ShipperServiceClient client = new ShipperServiceClient(); Label4.Text = ""; var shipper = new Shipper { CompanyName = shipperCompanyNameText.Text, Phone = shipperPhoneText.Text, ShipperId = int.Parse(shipperIdTextResult.Text) }; bool flag = client.UpdateShipper(shipper); if (flag == true) Label4.Text = "Allting uppdaterades som det skulle!"; else Label4.Text = "Något gick fel när datan skulle sparas i databasen"; } catch (Exception ex) { Label5.Text = "Something went wrong " + ex.Message; } }