예제 #1
0
 public static bool DeleteEmployee(string name)
 {
     try
     {
         Employee employee = SearchLinqToSql.Search(name);
         if (employee != null)
         {
             ConnectionDB.DeleteEmployee(employee);
         }
         else
         {
             throw new ArgumentException();
         }
     } catch
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            this.outputBox.Text = "";
            string   name     = this.searchBox.Text;
            Employee employee = SearchLinqToSql.Search(name);
            string   output   = "";

            if (employee == null)
            {
                output += "No match found.";
            }
            else
            {
                output += $"Name:\t{employee.Name}";
                output += Environment.NewLine + $"Age:\t{employee.Age}";
                output += Environment.NewLine + $"Post:\t{employee.post.Name}";
                output += Environment.NewLine + Environment.NewLine + $"Skills:";
                for (int i = 0; i < employee.skill.Length; i++)
                {
                    output += $"\t{employee.skill[i].Name}" + Environment.NewLine;
                }
            }
            this.outputBox.Text = output;
        }