Saving Data from a dynamically created form
-
Here are the constraints that I am facing Can only use SQL Server Cannot use Entity Framework or Dapper Can only use .NET Framework (can't use any Python or JS) What I am working on is a project for a factory I work for is that I am digitizing our quality inspections, of which there are numerous. The first step is that I created some models to that are used to create a Quality Inspection plan, which are here below:
public class QualityInspection
{
public int Id;
public string Name;
public double Frequency;
public List Sections;
}public class InspectionSection
{
public int Id;
public int InspectionId;
public string Name;
public List Points;
}public class InspectionPoint
{
public int Id;
public int SectionId;
public string Name;
public List InspectionResults;
}public class NonConformance
{
public int Id;
public string Name;
public List Level;
}public enum NonConformanceLevel
{
None,
Minor,
Major
}This is an example of a dummy inspections plan:
QualityInspection inspection = new QualityInspection()
{
Id = 1,
Name = "FgInspection",
Frequency = 2,
Sections.AddRange(new[]
{
new InspectionSection() {
Id = 1,
InspectionId = 1,
Name = "Packaging",
Points.AddRange(new[]
{
new InspectionPoint()
{
Id = 1,
SectionId = 1,
Name = "Seals",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 1, Name = "Torn", Level = NonConformanceLevel.Minor},
new NonConformance() {Id = 2, Name = "None", Level = NonConformanceLevel.None})
});
},
new InspectionPoint()
{
Id = 2,
SectionId = 1,
Name = "Dates",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 3, Name = "Smudged", Level = NonConformanceLevel.Minor}, -
Here are the constraints that I am facing Can only use SQL Server Cannot use Entity Framework or Dapper Can only use .NET Framework (can't use any Python or JS) What I am working on is a project for a factory I work for is that I am digitizing our quality inspections, of which there are numerous. The first step is that I created some models to that are used to create a Quality Inspection plan, which are here below:
public class QualityInspection
{
public int Id;
public string Name;
public double Frequency;
public List Sections;
}public class InspectionSection
{
public int Id;
public int InspectionId;
public string Name;
public List Points;
}public class InspectionPoint
{
public int Id;
public int SectionId;
public string Name;
public List InspectionResults;
}public class NonConformance
{
public int Id;
public string Name;
public List Level;
}public enum NonConformanceLevel
{
None,
Minor,
Major
}This is an example of a dummy inspections plan:
QualityInspection inspection = new QualityInspection()
{
Id = 1,
Name = "FgInspection",
Frequency = 2,
Sections.AddRange(new[]
{
new InspectionSection() {
Id = 1,
InspectionId = 1,
Name = "Packaging",
Points.AddRange(new[]
{
new InspectionPoint()
{
Id = 1,
SectionId = 1,
Name = "Seals",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 1, Name = "Torn", Level = NonConformanceLevel.Minor},
new NonConformance() {Id = 2, Name = "None", Level = NonConformanceLevel.None})
});
},
new InspectionPoint()
{
Id = 2,
SectionId = 1,
Name = "Dates",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 3, Name = "Smudged", Level = NonConformanceLevel.Minor},That's your "logical view". You said SQL "table"; I see 4-5 tables. In other words, there is nothing stopping you from "adding inspections" later.
"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
-
That's your "logical view". You said SQL "table"; I see 4-5 tables. In other words, there is nothing stopping you from "adding inspections" later.
"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
There is nothing stopping me from saving another inspection later. That isn't the problem. My user creates this inspection, and the inspection is then saved to the SQL tables. A form is then generated from these Inspections for factory operators to fill out later. For example, if there are two inspection points, then two drop down options on the form will be generated, one for each point. The problem is saving the data from those dropdowns, because those dropdowns are generated from the inspection, created by another user, so I don't have a SQL table that can map to the data from the dropdowns - since a user created those fields, not me.
-
There is nothing stopping me from saving another inspection later. That isn't the problem. My user creates this inspection, and the inspection is then saved to the SQL tables. A form is then generated from these Inspections for factory operators to fill out later. For example, if there are two inspection points, then two drop down options on the form will be generated, one for each point. The problem is saving the data from those dropdowns, because those dropdowns are generated from the inspection, created by another user, so I don't have a SQL table that can map to the data from the dropdowns - since a user created those fields, not me.
Your "explanations" make no sense: the "inspection point" "drop down" would contain multiple "inspection points" and that's where you would add another "inspection point"; not the other way around (creating "new" dropdowns)
"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
-
There is nothing stopping me from saving another inspection later. That isn't the problem. My user creates this inspection, and the inspection is then saved to the SQL tables. A form is then generated from these Inspections for factory operators to fill out later. For example, if there are two inspection points, then two drop down options on the form will be generated, one for each point. The problem is saving the data from those dropdowns, because those dropdowns are generated from the inspection, created by another user, so I don't have a SQL table that can map to the data from the dropdowns - since a user created those fields, not me.
I'm sorry ... I can't see the problem in the moment. Perhaps you should explain those points where you stuck better. I see the following : - from somewhere your 2 Dropdown (Comboboxes ?) are filled with data ... so those data must allready be saved somewhere - how does that data is entered into your Dropdowns ? - at a time someone makes a selection with this Dropdowns - what happens then ?
-
Here are the constraints that I am facing Can only use SQL Server Cannot use Entity Framework or Dapper Can only use .NET Framework (can't use any Python or JS) What I am working on is a project for a factory I work for is that I am digitizing our quality inspections, of which there are numerous. The first step is that I created some models to that are used to create a Quality Inspection plan, which are here below:
public class QualityInspection
{
public int Id;
public string Name;
public double Frequency;
public List Sections;
}public class InspectionSection
{
public int Id;
public int InspectionId;
public string Name;
public List Points;
}public class InspectionPoint
{
public int Id;
public int SectionId;
public string Name;
public List InspectionResults;
}public class NonConformance
{
public int Id;
public string Name;
public List Level;
}public enum NonConformanceLevel
{
None,
Minor,
Major
}This is an example of a dummy inspections plan:
QualityInspection inspection = new QualityInspection()
{
Id = 1,
Name = "FgInspection",
Frequency = 2,
Sections.AddRange(new[]
{
new InspectionSection() {
Id = 1,
InspectionId = 1,
Name = "Packaging",
Points.AddRange(new[]
{
new InspectionPoint()
{
Id = 1,
SectionId = 1,
Name = "Seals",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 1, Name = "Torn", Level = NonConformanceLevel.Minor},
new NonConformance() {Id = 2, Name = "None", Level = NonConformanceLevel.None})
});
},
new InspectionPoint()
{
Id = 2,
SectionId = 1,
Name = "Dates",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 3, Name = "Smudged", Level = NonConformanceLevel.Minor},Data model looks week. Basically looks like you will need to load everything before using anything and that is seldom a good idea.
Member 13612263 wrote:
In essence I am trying to save the RESULTS of an a user created inspection plan.
That isn't clear. But either you are attempting to manage a reference or you are attempting to provide a meta data model to the user. For the first when they saved that data there should have been database ids. You use this in this location as the reference. For the second you will need a at least one new table and perhaps at least a few more to let a user define the parts of a plan. Then reference (ids) those rows in some other table when you save it.
-
Here are the constraints that I am facing Can only use SQL Server Cannot use Entity Framework or Dapper Can only use .NET Framework (can't use any Python or JS) What I am working on is a project for a factory I work for is that I am digitizing our quality inspections, of which there are numerous. The first step is that I created some models to that are used to create a Quality Inspection plan, which are here below:
public class QualityInspection
{
public int Id;
public string Name;
public double Frequency;
public List Sections;
}public class InspectionSection
{
public int Id;
public int InspectionId;
public string Name;
public List Points;
}public class InspectionPoint
{
public int Id;
public int SectionId;
public string Name;
public List InspectionResults;
}public class NonConformance
{
public int Id;
public string Name;
public List Level;
}public enum NonConformanceLevel
{
None,
Minor,
Major
}This is an example of a dummy inspections plan:
QualityInspection inspection = new QualityInspection()
{
Id = 1,
Name = "FgInspection",
Frequency = 2,
Sections.AddRange(new[]
{
new InspectionSection() {
Id = 1,
InspectionId = 1,
Name = "Packaging",
Points.AddRange(new[]
{
new InspectionPoint()
{
Id = 1,
SectionId = 1,
Name = "Seals",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 1, Name = "Torn", Level = NonConformanceLevel.Minor},
new NonConformance() {Id = 2, Name = "None", Level = NonConformanceLevel.None})
});
},
new InspectionPoint()
{
Id = 2,
SectionId = 1,
Name = "Dates",
InspectionResults.AddRange(new[]
{
new NonConformance() {Id = 3, Name = "Smudged", Level = NonConformanceLevel.Minor},What you are saying doesn't seem to make much sense - it's probably just that you are using terms like "user created" wrongly, or we are misunderstanding what the dataflow is like. What is sounds like is the user is actually creating columns which need to be added to the database along with the existing columns, rather than adding rows of data which need to be added (which is what usually happens) What I think you are trying to say is that the user adds data which needs to be stored in tables with existing data, but the user code doesn't have any access to the existing tables so you don't know how to add rows of data to it. Is that right?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!