Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Not Sure How To Make This Change

Not Sure How To Make This Change

Scheduled Pinned Locked Moved Design and Architecture
databasehelptutorialcsharpwpf
6 Posts 5 Posters 20 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    Working on a WPF app. Currently, I have a table in SQL called Lookups that contains all kinds of lookup data. Here is a set of that data called Employee Types.

    Caption Category AppCode

    Director of field Operations employee_types director_of_field_operations
    Drafting employee_types drafting
    Driver employee_types driver
    Estimator employee_types estimator
    Foreman employee_types foreman
    General Forman employee_types general_forman
    Office employee_types office
    President employee_types president
    Project Coordinator employee_types project_coordinator
    Project Manager employee_types project_manager
    System Administrator employee_types system_admin
    Vice President

    Each employee is assigned an Employee Type. I can the query for specific types of employees. For example, there is a Foreman report that gets all employees who's EmployeeTypeId is in the Lookups of AppCode 'foreman' or 'general_forman'. The AppCode is defined by me when I create new Lookup entries so I can reference them in code. The problem is, now my client wants to be able to add and remove employee types via the UI. I don't see how I can allow them to manage this list without the AppCode. I would have nothing to key off of when running reports or sending automated notifications to people in specific roles. I can provide more detail if needed. Any ideas on this?

    In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

    M Richard DeemingR J L 4 Replies Last reply
    0
    • K Kevin Marois

      Working on a WPF app. Currently, I have a table in SQL called Lookups that contains all kinds of lookup data. Here is a set of that data called Employee Types.

      Caption Category AppCode

      Director of field Operations employee_types director_of_field_operations
      Drafting employee_types drafting
      Driver employee_types driver
      Estimator employee_types estimator
      Foreman employee_types foreman
      General Forman employee_types general_forman
      Office employee_types office
      President employee_types president
      Project Coordinator employee_types project_coordinator
      Project Manager employee_types project_manager
      System Administrator employee_types system_admin
      Vice President

      Each employee is assigned an Employee Type. I can the query for specific types of employees. For example, there is a Foreman report that gets all employees who's EmployeeTypeId is in the Lookups of AppCode 'foreman' or 'general_forman'. The AppCode is defined by me when I create new Lookup entries so I can reference them in code. The problem is, now my client wants to be able to add and remove employee types via the UI. I don't see how I can allow them to manage this list without the AppCode. I would have nothing to key off of when running reports or sending automated notifications to people in specific roles. I can provide more detail if needed. Any ideas on this?

      In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      When they create a new type (via a dialog) check for existing, then suggest a "code" based on the entered content after checking for an existing code. This is the drawback of using a "code" and also storing different types of data in the same table - classic mistake. I know the argument that they are all lookups and they are all simple UNTIL THEY ARE NOT! You now have to faff about working around the problem instead of having an EmployeeType table with an ID as the primary key.

      Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

      K 1 Reply Last reply
      0
      • M Mycroft Holmes

        When they create a new type (via a dialog) check for existing, then suggest a "code" based on the entered content after checking for an existing code. This is the drawback of using a "code" and also storing different types of data in the same table - classic mistake. I know the argument that they are all lookups and they are all simple UNTIL THEY ARE NOT! You now have to faff about working around the problem instead of having an EmployeeType table with an ID as the primary key.

        Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        But the problem is that my code can never know what the code is.

        In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

        1 Reply Last reply
        0
        • K Kevin Marois

          Working on a WPF app. Currently, I have a table in SQL called Lookups that contains all kinds of lookup data. Here is a set of that data called Employee Types.

          Caption Category AppCode

          Director of field Operations employee_types director_of_field_operations
          Drafting employee_types drafting
          Driver employee_types driver
          Estimator employee_types estimator
          Foreman employee_types foreman
          General Forman employee_types general_forman
          Office employee_types office
          President employee_types president
          Project Coordinator employee_types project_coordinator
          Project Manager employee_types project_manager
          System Administrator employee_types system_admin
          Vice President

          Each employee is assigned an Employee Type. I can the query for specific types of employees. For example, there is a Foreman report that gets all employees who's EmployeeTypeId is in the Lookups of AppCode 'foreman' or 'general_forman'. The AppCode is defined by me when I create new Lookup entries so I can reference them in code. The problem is, now my client wants to be able to add and remove employee types via the UI. I don't see how I can allow them to manage this list without the AppCode. I would have nothing to key off of when running reports or sending automated notifications to people in specific roles. I can provide more detail if needed. Any ideas on this?

          In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          As Mycroft said, stuffing every lookup into a single "lookups" table is a bad idea. It makes life much harder when you want to evolve a single type of lookup. Start by moving the employee types to its own table. The next step will depend on your precise requirements:

          • If you only ever want to report on a specific group of employee types, then replace the AppCode with a lookup to an "employee type group" table. When the user adds a new employee type, let them select the appropriate group, so that those types can be included in the relevant reports.
          • If you need more flexible grouping for your reports, add a many-to-many relationship between the employee type and the employee type groups. You can optionally let the user add the new types to one or more groups; if they don't, then those types won't be included in the reports.

          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          • K Kevin Marois

            Working on a WPF app. Currently, I have a table in SQL called Lookups that contains all kinds of lookup data. Here is a set of that data called Employee Types.

            Caption Category AppCode

            Director of field Operations employee_types director_of_field_operations
            Drafting employee_types drafting
            Driver employee_types driver
            Estimator employee_types estimator
            Foreman employee_types foreman
            General Forman employee_types general_forman
            Office employee_types office
            President employee_types president
            Project Coordinator employee_types project_coordinator
            Project Manager employee_types project_manager
            System Administrator employee_types system_admin
            Vice President

            Each employee is assigned an Employee Type. I can the query for specific types of employees. For example, there is a Foreman report that gets all employees who's EmployeeTypeId is in the Lookups of AppCode 'foreman' or 'general_forman'. The AppCode is defined by me when I create new Lookup entries so I can reference them in code. The problem is, now my client wants to be able to add and remove employee types via the UI. I don't see how I can allow them to manage this list without the AppCode. I would have nothing to key off of when running reports or sending automated notifications to people in specific roles. I can provide more detail if needed. Any ideas on this?

            In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            You have an application enum and now the requirement is to allow customers to manage the enum as well. So first decision is one of these 1. Open it up entirely. 2. Allow them their own additional enums. Only the additions can be modified. If the there is only one customer per table (how ever you designed that) then the caption can be under user control completely for all enums with the following rules 1. Must not be empty. 2. Must not be a duplicate of another. Then the decision is how to store them. Probably easiest is going to be to add another column which flags it as a user value. Then the other changes 1. Provide a UI to manage them. I would just show all of them. This is required to manage the caption anyways (above.) But also allows them to see groupings. The flag controls whether they can delete them. Naturally you will need a length limit. 2. Figure out how to allow the usage. The second is tricky if you store them in another table. Such as a custom report. If so then you must either force them to remove the usage first before deleting or you must do it yourself.

            1 Reply Last reply
            0
            • K Kevin Marois

              Working on a WPF app. Currently, I have a table in SQL called Lookups that contains all kinds of lookup data. Here is a set of that data called Employee Types.

              Caption Category AppCode

              Director of field Operations employee_types director_of_field_operations
              Drafting employee_types drafting
              Driver employee_types driver
              Estimator employee_types estimator
              Foreman employee_types foreman
              General Forman employee_types general_forman
              Office employee_types office
              President employee_types president
              Project Coordinator employee_types project_coordinator
              Project Manager employee_types project_manager
              System Administrator employee_types system_admin
              Vice President

              Each employee is assigned an Employee Type. I can the query for specific types of employees. For example, there is a Foreman report that gets all employees who's EmployeeTypeId is in the Lookups of AppCode 'foreman' or 'general_forman'. The AppCode is defined by me when I create new Lookup entries so I can reference them in code. The problem is, now my client wants to be able to add and remove employee types via the UI. I don't see how I can allow them to manage this list without the AppCode. I would have nothing to key off of when running reports or sending automated notifications to people in specific roles. I can provide more detail if needed. Any ideas on this?

              In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              ... "and remove". Total disaster. Breaks referential integrity. The only way to "remove" "codes" is to "expire" them with a start and end date.

              "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups