Esempio n. 1
0
 private void AddEmployee()
 {
     Employee emp;
     Console.WriteLine("Введите имя:");
     string firstName = Console.ReadLine();
     Console.WriteLine("Введите фамилию:");
     string lastName = Console.ReadLine();
     Console.WriteLine("Введите должность:");
     string position = Console.ReadLine();
     if (employees.Count == 0)
     {
         emp = new Employee(firstName, lastName, position, 1);
     }
     else
     {
         emp = new Employee(firstName, lastName, position, employees.Last().ID + 1);
     }
     employees.Add(emp);
     Console.WriteLine("Сотруник успешно добавлен. ");
     Console.WriteLine("------");
 }
Esempio n. 2
0
 /// <summary>
 /// 创建新的 Employee 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="startTime">StartTime 属性的初始值。</param>
 /// <param name="endTime">EndTime 属性的初始值。</param>
 /// <param name="empCode">EmpCode 属性的初始值。</param>
 /// <param name="userID">UserID 属性的初始值。</param>
 /// <param name="isvalid">Isvalid 属性的初始值。</param>
 public static Employee CreateEmployee(global::System.Int32 id, global::System.String startTime, global::System.String endTime, global::System.String empCode, global::System.Int32 userID, global::System.String isvalid)
 {
     Employee employee = new Employee();
     employee.Id = id;
     employee.StartTime = startTime;
     employee.EndTime = endTime;
     employee.EmpCode = empCode;
     employee.UserID = userID;
     employee.Isvalid = isvalid;
     return employee;
 }
Esempio n. 3
0
 /// <summary>
 /// 用于向 Employees1 EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToEmployees1(Employee employee)
 {
     base.AddObject("Employees1", employee);
 }