Exemplo n.º 1
0
        private void DeleteAllAssignedEmployeesByWorksheetID(int worksheetID)
        {
            SqlCommand command = new SqlCommand("spDeleteAllAssignedEmployeesByWorksheetID");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@WorksheetID", worksheetID));
            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 2
0
        private void CreateEmployeeQualification(int employeeID, QualificationType qualificationType)
        {
            SqlCommand command = new SqlCommand("spInsertEmployeeQualification");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@EmployeeID", employeeID));
            command.Parameters.Add(new SqlParameter("@QualificationType", qualificationType.ToString()));
            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 3
0
        public void Delete(Employee employee)
        {
            SqlCommand command = new SqlCommand("spDeleteEmployee");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", employee.ID));
            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 4
0
        public void Delete(Worksheet worksheet)
        {
            SqlCommand command = new SqlCommand("spDeleteWorksheet");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", worksheet.ID));
            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 5
0
        public void Delete(Customer customer)
        {
            SqlCommand command = new SqlCommand("spDeleteCustomer");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", customer.ID));
            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 6
0
        private void CreateAssignedEmployee(int employeeID, int worksheetID)
        {
            SqlCommand command = new SqlCommand("spInsertAssignedEmployee");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@WorksheetID", worksheetID));
            command.Parameters.Add(new SqlParameter("@EmployeeID", employeeID));

            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 7
0
        public void Update(Employee employee)
        {
            SqlCommand command = new SqlCommand("spUpdateEmployee");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", employee.ID));
            command.Parameters.Add(new SqlParameter("@FirstName", employee.Name.FirstName));
            command.Parameters.Add(new SqlParameter("@LastName", employee.Name.LastName));

            UpdateQualificationsForEmployee(employee);

            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 8
0
        private void UpdateQualificationsForEmployee(Employee employee)
        {
            SqlCommand command = new SqlCommand("spDeleteAllEmployeeQualificationsByID");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@EmployeeID", employee.ID));
            DatabaseController.ExecuteNonQuerySP(command);

            foreach (QualificationType qualificationType in employee.Qualifications)
            {
                CreateEmployeeQualification(employee.ID, qualificationType);
            }
        }
Exemplo n.º 9
0
        public void Update(Customer customer)
        {
            SqlCommand command = new SqlCommand("spUpdateCustomer");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", customer.ID));
            command.Parameters.Add(new SqlParameter("@FirstName", customer.Name.FirstName));
            command.Parameters.Add(new SqlParameter("@LastName", customer.Name.LastName));
            command.Parameters.Add(new SqlParameter("@Address", customer.Address.Street));
            command.Parameters.Add(new SqlParameter("@City", customer.Address.City));
            command.Parameters.Add(new SqlParameter("@ZIPcode", customer.Address.ZIPcode));
            command.Parameters.Add(new SqlParameter("@PhoneNumber", customer.PhoneNumber));
            command.Parameters.Add(new SqlParameter("@Email", customer.Email));

            DatabaseController.ExecuteNonQuerySP(command);
        }
Exemplo n.º 10
0
        public void Update(Worksheet worksheet)
        {
            SqlCommand command = new SqlCommand("spUpdateWorksheet");

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@WorksheetID", worksheet.ID));
            command.Parameters.Add(new SqlParameter("@CustomerID", worksheet.Customer.ID));
            command.Parameters.Add(new SqlParameter("@Workplace", worksheet.Workplace));
            command.Parameters.Add(new SqlParameter("@StartDateTime", worksheet.StartDateTime));
            command.Parameters.Add(new SqlParameter("@EndDateTime", worksheet.EndDateTime));
            command.Parameters.Add(new SqlParameter("@WorkDescription", worksheet.WorkDescription));
            command.Parameters.Add(new SqlParameter("@IsGuarantee", worksheet.IsGuarantee));
            command.Parameters.Add(new SqlParameter("@StatusType", worksheet.Status.ToString()));

            UpdateAssignedEmployees(worksheet);

            DatabaseController.ExecuteNonQuerySP(command);
        }