Example #1
0
 /// <summary>
 /// if all fields are correct call engineer service to create a new client in the database
 /// if the return client is null means the operation failed
 /// return is not null client is created, redirect to clientlist page
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Submit_btn_Click(object sender, EventArgs e)
 {
     try
     {
         Client client = engineerService.createClient(ClientName.Text, Clientlocation.Text);
         if (client != null)
         {
             Response.Redirect("~/Engineer/ClientList.aspx", false);
         }
         else
         {
             // give creation failed feedback to user
             ClientScript.RegisterStartupScript(GetType(), "N", "alert('Creation failed!');", true);
         }
     }
     catch (Exception)
     {
         Response.Redirect("~/Errors/InternalErrors.aspx", true);
     }
 }