public void AddEmployee(Employee employee)
        {
            String sql =
                "INSERT into MITARBEITER(NAME,VORNAME,BERUF) VALUES ('" +
                employee.LastName + "','" +
                employee.FirstName + "','" +
                employee.Profession + "')";

            FbCommand com = new FbCommand(sql, conn);
            FbDataReader dr = com.ExecuteReader();
            dr.Read();
            dr.Close();
        }
 public void AddEmployee(Employee employee)
 {
     if (_employees.Count > 0)
     {
         int highestId = _employees[_employees.Count - 1].Id;
         employee.Id = highestId + 1;
     }
     else
     {
         employee.Id = 1;
     }
     _employees.Add(employee);
 }
        //Werden Mitarbeiter anders gespeichert/ausgelesen? Ich bekomme keinen Fehler aber auch keine Daten.
        private void addMitarbeiter()
        {
            Console.WriteLine("Bitte geben sie den Familiennamen des Mitarbeiters an:");
            var name = Console.ReadLine();
            Console.WriteLine("Bitte geben sie den Vornamen des Mitarbeiters an:");
            var firstname = Console.ReadLine();
            Console.WriteLine("Bitte geben sie den Beruf des Mitarbeiters an.");
            var profession = Console.ReadLine();

            var Eemployee = new Employee();
            Eemployee.LastName = name;
            Eemployee.FirstName = firstname;
            Eemployee.Profession = profession;

            fachkonzept.AddEmployee(Eemployee);
        }
        public void AddEmployee(Employee employee)
        {
            //XML
            DataTable dt = new DataTable();
            dt.TableName = "Mitarbeiter";

            DataColumn p_mitarbeiter_id = new DataColumn("P_MITARBEITER_ID");
            DataColumn name = new DataColumn("NAME");
            DataColumn vorname = new DataColumn("VORNAME");
            DataColumn beruf = new DataColumn("BERUF");

            dt.Columns.Add(p_mitarbeiter_id);
            dt.Columns.Add(name);
            dt.Columns.Add(vorname);
            dt.Columns.Add(beruf);
            /*TextBox müssen noch angepasst werden */
            dt.Rows.Add(TextBox.Text, TextBox.Text, TextBox.Text, TextBox.Text);

            DataSet ds = new DataSet();
            ds.Tables.Add(dt);
            ds.WriteXml("ASProjekt.xml");
        }
        public MockStorage()
        {
            Employee marioSuper = new Employee("Super", "Mario");
            marioSuper.Profession = "Klempner";
            AddEmployee(marioSuper);

            Employee gordenFreeman = new Employee("Freeman", "Gorden");
            gordenFreeman.Profession = "Physiker";
            AddEmployee(gordenFreeman);

            Project BER = new Project();
            BER.Location = "Berlin";
            BER.Title = "Flughafen Berlin Brandenbug";
            BER.Start = "1157457600";
            BER.End = "1504612800";
            AddProject(BER);

            Worklog foo = new Worklog();
            foo.EmployeeId = 1;
            foo.ProjectId = 1;
            foo.Start = "1448276947";
            foo.End = "1448301924";
            AddWorklog(foo);
        }
 public void CreateEmployee(Employee employee)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public void UpdateEmployee(Employee employee)
 {
     _storage.UpdateEmployee(employee);
 }
Esempio n. 8
0
 public void AddEmployee(Employee employee)
 {
     _storage.AddEmployee(employee);
 }
        public void UpdateEmployee(Employee employee)
        {
            //XML
              DataTable dt = new DataTable();
              dt.TableName = "Mitarbeiter";

              DataColumn p_mitarbeiter_id = new DataColumn("P_MITARBEITER_ID");
              DataColumn name = new DataColumn("NAME");
              DataColumn vorname = new DataColumn("VORNAME");
              DataColumn beruf = new DataColumn("BERUF");

              /*TextBox müssen noch angepasst werden */
              /*Rows Dynamisch* anpassen*/
              dt.Rows.Add(TextBox.Text, TextBox.Text, TextBox.Text, TextBox.Text);
              dt.Rows[][p_mitarbeiter_id] = TextBox.Text;
              dt.Rows[][name] = TextBox.Text;
              dt.Rows[][vorname] = TextBox.Text;
              dt.Rows[][beruf] = TextBox.Text;
              DataSet ds = new DataSet();
              ds.Tables.Add(dt);
              ds.WriteXml("ASProjekt.xml");
        }
Esempio n. 10
0
 public void UpdateEmployee(Employee updatedEmployee)
 {
     Employee employee = _employees.FirstOrDefault(o => o.Id == updatedEmployee.Id);
     if (employee != null)
     {
         employee = updatedEmployee;
     }
     else
     {
         throw new ArgumentException("Employee not found in storage.");
     }
 }
 public void UpdateEmployee(Employee employee)
 {
     BusinessLogic.UpdateEmployee(employee);
 }
 public void AddEmployee(Employee employee)
 {
     BusinessLogic.AddEmployee(employee);
 }
 protected int CompareEmployeeByLastName(Employee employee1, Employee employee2)
 {
     return String.Compare(employee1.LastName, employee2.LastName, StringComparison.CurrentCulture);
 }
        public void UpdateEmployee(Employee employee)
        {
            {
                //Firebird
                /*
                FbConnection conn = new FbConnection(connString);
                conn.Open();
                String sql =
                    "UPDATE MITARBEITER SET ('P_MITARBEITER_ID' = '@P_MITARBEITER_ID' , 'NAME' = '@NAME' , 'VORNAME' = '@VORNAME' , 'BERUF' = '@BERUF')";
                FbCommand com = new FbCommand(sql, conn);

                com.Parameters.Add("@P_MITARBEITER_ID", TextBox.Text);
                com.Parameters.Add("@NAME", TextBox.Text);
                com.Parameters.Add("@VORNAME", TextBox.Text);
                com.Parameters.Add("@BERUF", TextBox.Text);
                com.ExecuteNonQuery();
                FbDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    Console.WriteLine(dr.GetString(0));
                }
                dr.Close();
                conn.Close();
                Console.ReadLine();
                 */
            }
        }
        public List<Employee> GetEmployees()
        {
            String sql = "SELECT * FROM MITARBEITER";
            FbCommand com = new FbCommand(sql, conn);
            FbDataReader dr = com.ExecuteReader();
            List<Employee> resultsList = new List<Employee>();
            while (dr.Read())
            {
                int id = dr.GetInt32(0);
                string lastName = dr.GetString(1);
                string firstName = dr.GetString(2);
                string profession = dr.GetString(3);
                Employee employee = new Employee(lastName, firstName)
                {
                    Profession = profession,
                    Id = id
                };
                resultsList.Add(employee);
            }
            dr.Close();

            return resultsList;
        }